From eef30d41c1f11a48a4756782f226b6e556a68568 Mon Sep 17 00:00:00 2001 From: shirne Date: Mon, 1 Jul 2024 11:48:15 +0800 Subject: [PATCH] message of loading can be null --- CHANGELOG.md | 3 +++ example/lib/custom_page.dart | 38 +++++++++++++++++++++++++++++++++++ lib/src/my_dialog.dart | 4 ++-- lib/src/widgets/progress.dart | 17 ++++++++-------- pubspec.yaml | 8 ++++---- 5 files changed, 56 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e7bcbf3..f560282 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [4.7.4] + * The message of loading can be null + ## [4.7.3] * improve code style * improve dropdown animate diff --git a/example/lib/custom_page.dart b/example/lib/custom_page.dart index 6e1e0c3..a006448 100644 --- a/example/lib/custom_page.dart +++ b/example/lib/custom_page.dart @@ -134,6 +134,44 @@ class ToastInnerPage extends StatelessWidget { ], ), const SizedBox(height: 8), + GridView( + shrinkWrap: true, + gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount( + crossAxisCount: 2), + children: [ + Center( + child: ToastWidget( + '测试消息', + ), + ), + Center( + child: SnackWidget('testaa'), + ), + Center( + child: ToastWidget( + '测试消息', + icon: Icon(DialogIcons.checkmarkFill), + ), + ), + Center( + child: SnackWidget('testaa'), + ), + Center( + child: ToastWidget( + '测试消息', + style: ToastStyle( + direction: Axis.vertical, + iconPadding: EdgeInsets.all(24), + iconTheme: IconThemeData(size: 42), + ), + icon: Icon(DialogIcons.checkmarkFill), + ), + ), + Center( + child: SnackWidget('testaa'), + ), + ], + ), ], ), ), diff --git a/lib/src/my_dialog.dart b/lib/src/my_dialog.dart index dc95ba6..8620450 100644 --- a/lib/src/my_dialog.dart +++ b/lib/src/my_dialog.dart @@ -292,7 +292,7 @@ class MyDialog { /// A wrapper of [ShirneDialog.loading] static ProgressController loading( - String message, { + String? message, { bool? showProgress, Duration? duration, @@ -772,7 +772,7 @@ class ShirneDialog { /// show a loading progress within an [OverlayEntry]. /// keep in `time` seconds or manual control it's status by pass 0 to `time` ProgressController loading( - String message, { + String? message, { bool? showProgress, Duration? duration, diff --git a/lib/src/widgets/progress.dart b/lib/src/widgets/progress.dart index 82911da..4ec250a 100644 --- a/lib/src/widgets/progress.dart +++ b/lib/src/widgets/progress.dart @@ -83,15 +83,16 @@ class _ProgressWidgetState extends State ), strokeWidth: widget.style?.strokeWidth ?? 4, ), - const SizedBox(height: 10), - Text( - widget.message!, - style: const TextStyle( - color: Colors.black54, - decoration: TextDecoration.none, - fontSize: 14, + if (widget.message != null) const SizedBox(height: 10), + if (widget.message != null) + Text( + widget.message!, + style: const TextStyle( + color: Colors.black54, + decoration: TextDecoration.none, + fontSize: 14, + ), ), - ), ], ), ); diff --git a/pubspec.yaml b/pubspec.yaml index 369c36e..f7362ce 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,10 +1,10 @@ name: shirne_dialog description: A flutter package to use alert, toast, popup, snack, imagePreview, loading etc. with customizable style in anywhere. -version: 4.7.3 +version: 4.7.4 homepage: https://shirne.github.io/dialog/ repository: https://github.com/shirne/shirne_dialog -screenshots: - - description: 'list of features with some toasts' +screenshots: + - description: "list of features with some toasts" path: screenshots/preview.jpg topics: - dialog @@ -30,4 +30,4 @@ flutter: fonts: - family: shirne_dialog_icons fonts: - - asset: assets/fonts/icons.ttf \ No newline at end of file + - asset: assets/fonts/icons.ttf