Skip to content

Commit

Permalink
Merge pull request #230 from takenet/release/0.0.87
Browse files Browse the repository at this point in the history
[Release] 0.0.87
  • Loading branch information
githubdoandre authored Nov 20, 2023
2 parents 37b2108 + 48be0e6 commit 870933a
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 102 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.0.87

- [DSCircularProgress] Added widget to build circular progress indicator.
- [DSSearchInput] Added ```enabled``` property.

## 0.0.86

- [DSMediaFormatService] Added service to format all kinds of media, like audios and videos.
Expand Down
2 changes: 2 additions & 0 deletions lib/blip_ds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ export 'src/widgets/utils/ds_cached_network_image_view.widget.dart'
show DSCachedNetworkImageView;
export 'src/widgets/utils/ds_card.widget.dart' show DSCard;
export 'src/widgets/utils/ds_chip.widget.dart' show DSChip;
export 'src/widgets/utils/ds_circular_progress.widget.dart'
show DSCircularProgress;
export 'src/widgets/utils/ds_divider.widget.dart' show DSDivider;
export 'src/widgets/utils/ds_expanded_image.widget.dart' show DSExpandedImage;
export 'src/widgets/utils/ds_file_extension_icon.util.dart'
Expand Down
28 changes: 6 additions & 22 deletions lib/src/widgets/chat/ds_image_message_bubble.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import '../../models/ds_document_select.model.dart';
import '../../models/ds_message_bubble_style.model.dart';
import '../../themes/colors/ds_colors.theme.dart';
import '../texts/ds_caption_text.widget.dart';
import '../utils/ds_circular_progress.widget.dart';
import '../utils/ds_expanded_image.widget.dart';
import 'ds_document_select.widget.dart';
import 'ds_message_bubble.widget.dart';
Expand Down Expand Up @@ -114,7 +115,11 @@ class _DSImageMessageBubbleState extends State<DSImageMessageBubble>
isLoading: false,
shouldAuthenticate: widget.shouldAuthenticate,
)
: _buildDownloadProgress(),
: DSCircularProgress(
currentProgress: _controller.downloadProgress,
maximumProgress: _controller.maximumProgress,
foregroundColor: foregroundColor,
),
),
if ((widget.title?.isNotEmpty ?? false) ||
(widget.text?.isNotEmpty ?? false))
Expand Down Expand Up @@ -161,27 +166,6 @@ class _DSImageMessageBubbleState extends State<DSImageMessageBubble>
);
}

Widget _buildDownloadProgress() {
final foregroundColor = widget.style.isLightBubbleBackground(widget.align)
? DSColors.neutralDarkCity
: DSColors.neutralLightSnow;

final double percent = _controller.maximumProgress.value > 0
? _controller.downloadProgress.value / _controller.maximumProgress.value
: 0;

return Center(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: CircularProgressIndicator(
color: foregroundColor,
backgroundColor: Colors.grey,
value: percent,
),
),
);
}

@override
bool get wantKeepAlive => true;
}
36 changes: 6 additions & 30 deletions lib/src/widgets/chat/video/ds_video_message_bubble.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import '../../../services/ds_auth.service.dart';
import '../../../themes/colors/ds_colors.theme.dart';
import '../../../themes/icons/ds_icons.dart';
import '../../buttons/ds_button.widget.dart';
import '../../texts/ds_caption_small_text.widget.dart';
import '../../utils/ds_circular_progress.widget.dart';
import '../ds_message_bubble.widget.dart';
import '../ds_show_more_text.widget.dart';
import 'ds_video_body.widget.dart';
Expand Down Expand Up @@ -131,7 +131,11 @@ class _DSVideoMessageBubbleState extends State<DSVideoMessageBubble>
color: DSColors.neutralDarkRooftop,
)
: _controller.isDownloading.value
? _buildDownloadProgress(foregroundColor)
? DSCircularProgress(
currentProgress: _controller.downloadProgress,
maximumProgress: _controller.maximumProgress,
foregroundColor: foregroundColor,
)
: _controller.thumbnail.isEmpty
? Center(
child: SizedBox(
Expand Down Expand Up @@ -186,32 +190,4 @@ class _DSVideoMessageBubbleState extends State<DSVideoMessageBubble>
),
);
}

Widget _buildDownloadProgress(final Color foregroundColor) {
final double percent = _controller.maximumProgress.value > 0
? _controller.downloadProgress.value / _controller.maximumProgress.value
: 0;

return AnimatedOpacity(
opacity: _controller.maximumProgress.value > 0 ? 1 : 0,
duration: const Duration(milliseconds: 250),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: CircularProgressIndicator(
color: foregroundColor,
backgroundColor: Colors.grey,
value: percent,
),
),
DSCaptionSmallText(
_controller.getDownloadProgress(),
color: foregroundColor,
)
],
),
);
}
}
20 changes: 13 additions & 7 deletions lib/src/widgets/fields/ds_search_input.widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class DSSearchInput extends StatelessWidget {
this.hintText,
this.iconBackgroundColor = DSColors.disabledBg,
this.iconForegroundColor = DSColors.primaryNight,
this.enabled,
});

final void Function(String term) onSearch;
Expand All @@ -25,13 +26,15 @@ class DSSearchInput extends StatelessWidget {
final String? hintText;
final Color iconBackgroundColor;
final Color iconForegroundColor;
final bool? enabled;

// TODO: check if can use DSTextField or DSInputContainer
@override
Widget build(BuildContext context) {
return SizedBox(
height: 44.0,
child: TextField(
enabled: enabled ?? true,
focusNode: focusNode,
controller: controller,
onChanged: onSearch,
Expand Down Expand Up @@ -81,13 +84,8 @@ class DSSearchInput extends StatelessWidget {
width: 1.0,
),
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: const BorderSide(
color: DSColors.neutralMediumWave,
width: 1.0,
),
),
disabledBorder: _getBorder(),
enabledBorder: _getBorder(),
filled: true,
hintText: hintText,
hintStyle: const DSBodyTextStyle(
Expand All @@ -97,4 +95,12 @@ class DSSearchInput extends StatelessWidget {
),
);
}

OutlineInputBorder _getBorder() => OutlineInputBorder(
borderRadius: BorderRadius.circular(8.0),
borderSide: const BorderSide(
color: DSColors.neutralMediumWave,
width: 1.0,
),
);
}
2 changes: 1 addition & 1 deletion lib/src/widgets/radio/ds_radio_tile.widget.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:flutter/material.dart';

import '../../../blip_ds.dart';
import 'ds_radio.widget.dart';

class DSRadioTile<T> extends StatelessWidget {
/// Create a Design System's tile widget with a radio button
Expand Down
64 changes: 64 additions & 0 deletions lib/src/widgets/utils/ds_circular_progress.widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
import 'package:file_sizes/file_sizes.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

import '../../themes/colors/ds_colors.theme.dart';
import '../texts/ds_caption_small_text.widget.dart';

class DSCircularProgress extends StatelessWidget {
final RxInt maximumProgress;
final RxInt currentProgress;
final Color? foregroundColor;

const DSCircularProgress({
super.key,
required this.maximumProgress,
required this.currentProgress,
this.foregroundColor,
});

@override
Widget build(BuildContext context) {
return Obx(
() {
final double percent = maximumProgress.value > 0
? currentProgress.value / maximumProgress.value
: 0;

return SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
mainAxisSize: MainAxisSize.max,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: CircularProgressIndicator(
color: DSColors.primary,
backgroundColor: Colors.grey,
value: currentProgress.value < maximumProgress.value
? percent
: null,
),
),
DSCaptionSmallText(
_buildProgress(),
color: foregroundColor ?? DSColors.neutralDarkCity,
)
],
),
);
},
);
}

String _buildProgress() {
String getSize(int value) => FileSize.getSize(
value,
precision: PrecisionValue.One,
);

return '${getSize(currentProgress.value)} / ${getSize(maximumProgress.value)}';
}
}
3 changes: 1 addition & 2 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: blip_ds
description: Blip Design System for Flutter.
version: 0.0.86
version: 0.0.87
homepage: https://github.com/takenet/blip-ds-flutter#readme
repository: https://github.com/takenet/blip-ds-flutter

Expand Down Expand Up @@ -33,7 +33,6 @@ dependencies:
pointer_interceptor: ^0.9.1
debounce_throttle: ^2.0.0
file_sizes: ^1.0.6
intl_phone_number_input: ^0.7.3+1
mask_text_input_formatter: ^2.4.0
dotted_border: ^2.0.0+3
map_launcher: ^2.5.0+1
Expand Down
40 changes: 0 additions & 40 deletions sample/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.0+3"
equatable:
dependency: transitive
description:
name: equatable
sha256: c2b87cb7756efdf69892005af546c56c0b5037f54d2a88269b4f347a505e3ca2
url: "https://pub.dev"
source: hosted
version: "2.0.5"
fake_async:
dependency: transitive
description:
Expand Down Expand Up @@ -303,14 +295,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.2"
intl_phone_number_input:
dependency: transitive
description:
name: intl_phone_number_input
sha256: b812c6e3924e56e65b9684076ccd8eb24126abe0c84091d35d75a25e613a1793
url: "https://pub.dev"
source: hosted
version: "0.7.3+1"
js:
dependency: transitive
description:
Expand Down Expand Up @@ -343,30 +327,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.4.8"
libphonenumber_platform_interface:
dependency: transitive
description:
name: libphonenumber_platform_interface
sha256: cdd1230aad1d8e12fb4d9752d67ed2361b1cbb26fc8d202a9990c218553b3963
url: "https://pub.dev"
source: hosted
version: "0.4.0"
libphonenumber_plugin:
dependency: transitive
description:
name: libphonenumber_plugin
sha256: "1be7c9de4beaed6dffdaf4a3d87758ef9b259c1111283736faef2179919e3ca2"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
libphonenumber_web:
dependency: transitive
description:
name: libphonenumber_web
sha256: "35a106149d2f7a05a670d02be2f4ea288258d7bca2f8bdda8a96617151dfa5b9"
url: "https://pub.dev"
source: hosted
version: "0.3.0"
linkify:
dependency: transitive
description:
Expand Down

0 comments on commit 870933a

Please sign in to comment.