diff --git a/.fvm/fvm_config.json b/.fvm/fvm_config.json index 2f49d15..42fa11a 100644 --- a/.fvm/fvm_config.json +++ b/.fvm/fvm_config.json @@ -1,4 +1,4 @@ { - "flutterSdkVersion": "3.10.6", + "flutterSdkVersion": "3.13.5", "flavors": {} } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 3baea34..ad862ed 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ +## 1.0.0 + +* add dismissAll function by @payam-zahedi +* add toastification manager and alignment to toasts by @payam-zahedi +* add swipe to dismiss feature by @payam-zahedi +* update and deploy example app by @payam-zahedi +* update default icons and primary colors by @payam-zahedi +* add support for textDirection by @payam-zahedi +* add progress bar by @payam-zahedi +* add different close types by @payam-zahedi +* add custom animation to example by @payam-zahedi +* Add equatable and change cupertino with widgets by @benyaminbeyzaie +* Add _disposeAnimation() by @benyaminbeyzaie +* fix example design issues in v1.0.0 by @payam-zahedi +* update the built in toast base on the design by @payam-zahedi +* update theme values by @payam-zahedi +* Remove .vscode from git by @benyaminbeyzaie +* update kotlin_version by @benyaminbeyzaie +* Add new AppBar by @benyaminbeyzaie +* Add Toastification Config Provider by @benyaminbeyzaie +* add new properties to global config by @payam-zahedi +* Feat/update panel by @payam-zahedi +* Update header by @payam-zahedi +* Update toast preview component by @payam-zahedi +* Add responsive toast types by @benyaminbeyzaie +* update code preview widget by @payam-zahedi + ## 0.0.3 * Added custom animation feature with `animation duration` and `animation builder` parameters diff --git a/README.md b/README.md index 89e6b6b..f091085 100644 --- a/README.md +++ b/README.md @@ -278,6 +278,16 @@ Remove a notification with the given ID from the screen. toastification.dismissById('my_notification_id'); ``` +## Design + +Toastification was redesigned by [Sepide Moqadasi](https://sepide.design/). We want to extend our heartfelt appreciation to Sepide for her exceptional design work, which has made Toastification visually appealing and user-friendly. Special thanks to Sepide for her valuable contributions to this project. + + +

+Styles +Styles +

+ ## Contributions diff --git a/doc/image/design_desktop.png b/doc/image/design_desktop.png new file mode 100644 index 0000000..ba91d81 Binary files /dev/null and b/doc/image/design_desktop.png differ diff --git a/doc/image/design_mobile.png b/doc/image/design_mobile.png new file mode 100644 index 0000000..6db6186 Binary files /dev/null and b/doc/image/design_mobile.png differ diff --git a/example/lib/src/features/home/views/pages/home.dart b/example/lib/src/features/home/views/pages/home.dart index b61641f..5f5bc19 100644 --- a/example/lib/src/features/home/views/pages/home.dart +++ b/example/lib/src/features/home/views/pages/home.dart @@ -33,21 +33,23 @@ class _HomeScreenState extends State { @override Widget build(BuildContext context) { - return const ToastificationConfigProvider( + return ToastificationConfigProvider( config: ToastificationConfig( - margin: EdgeInsets.fromLTRB(0, 16, 0, 110), + marginBuilder: (alignment) => const EdgeInsets.fromLTRB(0, 16, 0, 110), ), - child: Scaffold( - extendBody: true, - bottomNavigationBar: BottomNavigationView(), - body: CustomScrollView( - primary: true, - slivers: [ - ToastAppBar(), - SliverToBoxAdapter(child: ToastHeader()), - CustomizationSection(), - SliverToBoxAdapter(child: SizedBox(height: 64)), - ], + child: const Scrollbar( + child: Scaffold( + extendBody: true, + bottomNavigationBar: BottomNavigationView(), + body: CustomScrollView( + primary: true, + slivers: [ + ToastAppBar(), + SliverToBoxAdapter(child: ToastHeader()), + CustomizationSection(), + SliverToBoxAdapter(child: SizedBox(height: 64)), + ], + ), ), ), ); diff --git a/example/lib/src/features/home/views/ui_states/extra.dart b/example/lib/src/features/home/views/ui_states/extra.dart index 2edf099..19e38dc 100644 --- a/example/lib/src/features/home/views/ui_states/extra.dart +++ b/example/lib/src/features/home/views/ui_states/extra.dart @@ -23,19 +23,27 @@ void copyCode(BuildContext context, ToastDetail detail) async { toastification.show( context: context, type: ToastificationType.success, - style: ToastificationStyle.flat, + style: ToastificationStyle.flatColored, title: 'Clipboard', description: 'Code copied to clipboard', autoCloseDuration: const Duration(seconds: 4), + alignment: detail.alignment, + animationDuration: detail.animationDuration, + animationBuilder: detail.animationType.builder, + boxShadow: detail.shadow.shadow, ); } else { toastification.show( context: context, type: ToastificationType.error, - style: ToastificationStyle.flat, + style: ToastificationStyle.flatColored, title: 'Ops!', description: 'Something went wrong', autoCloseDuration: const Duration(seconds: 4), + alignment: detail.alignment, + animationDuration: detail.animationDuration, + animationBuilder: detail.animationType.builder, + boxShadow: detail.shadow.shadow, ); } }, diff --git a/example/lib/src/features/home/views/ui_states/toast_detail_ui_state.dart b/example/lib/src/features/home/views/ui_states/toast_detail_ui_state.dart index 4dc225d..69a3043 100644 --- a/example/lib/src/features/home/views/ui_states/toast_detail_ui_state.dart +++ b/example/lib/src/features/home/views/ui_states/toast_detail_ui_state.dart @@ -31,7 +31,7 @@ class ToastDetail with _$ToastDetail { @Default(ToastificationType.success) ToastificationType type, @Default(ToastificationStyle.flat) ToastificationStyle style, // placement - @Default(Alignment.topRight) AlignmentGeometry alignment, + @Default(Alignment.topLeft) AlignmentGeometry alignment, @Default('Component updates available.') String title, @Default('Component updates available.') String description, Widget? icon, diff --git a/example/lib/src/features/home/views/ui_states/toast_detail_ui_state.freezed.dart b/example/lib/src/features/home/views/ui_states/toast_detail_ui_state.freezed.dart index e947155..d8199a0 100644 --- a/example/lib/src/features/home/views/ui_states/toast_detail_ui_state.freezed.dart +++ b/example/lib/src/features/home/views/ui_states/toast_detail_ui_state.freezed.dart @@ -385,7 +385,7 @@ class _$_ToastDetail implements _ToastDetail { _$_ToastDetail( {this.type = ToastificationType.success, this.style = ToastificationStyle.flat, - this.alignment = Alignment.topRight, + this.alignment = Alignment.topLeft, this.title = 'Component updates available.', this.description = 'Component updates available.', this.icon, diff --git a/example/lib/src/features/home/views/widgets/header.dart b/example/lib/src/features/home/views/widgets/header.dart index 81b95a9..7482510 100644 --- a/example/lib/src/features/home/views/widgets/header.dart +++ b/example/lib/src/features/home/views/widgets/header.dart @@ -149,7 +149,7 @@ class _InformationWidget extends ConsumerWidget { }, child: const ColoredTag( icon: FontAwesomeIcons.github, - text: '101 Stars on Github', + text: '150 Stars on Github', ), ), const SizedBox(height: 12), diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ad4b77c..ce99170 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -3,7 +3,7 @@ description: A new Flutter project. publish_to: "none" -version: 0.0.20+20 +version: 1.0.0+30 environment: sdk: ">=3.0.0 <4.0.0" diff --git a/example/web/favicon.png b/example/web/favicon.png deleted file mode 100644 index 8aaa46a..0000000 Binary files a/example/web/favicon.png and /dev/null differ diff --git a/example/web/icons/Icon-192.png b/example/web/icons/Icon-192.png deleted file mode 100644 index b749bfe..0000000 Binary files a/example/web/icons/Icon-192.png and /dev/null differ diff --git a/example/web/icons/Icon-512.png b/example/web/icons/Icon-512.png deleted file mode 100644 index 88cfd48..0000000 Binary files a/example/web/icons/Icon-512.png and /dev/null differ diff --git a/example/web/icons/Icon-maskable-192.png b/example/web/icons/Icon-maskable-192.png deleted file mode 100644 index eb9b4d7..0000000 Binary files a/example/web/icons/Icon-maskable-192.png and /dev/null differ diff --git a/example/web/icons/Icon-maskable-512.png b/example/web/icons/Icon-maskable-512.png deleted file mode 100644 index d69c566..0000000 Binary files a/example/web/icons/Icon-maskable-512.png and /dev/null differ diff --git a/example/web/icons/android-icon-144x144.png b/example/web/icons/android-icon-144x144.png new file mode 100644 index 0000000..9544efc Binary files /dev/null and b/example/web/icons/android-icon-144x144.png differ diff --git a/example/web/icons/android-icon-192x192.png b/example/web/icons/android-icon-192x192.png new file mode 100644 index 0000000..d58fc66 Binary files /dev/null and b/example/web/icons/android-icon-192x192.png differ diff --git a/example/web/icons/android-icon-36x36.png b/example/web/icons/android-icon-36x36.png new file mode 100644 index 0000000..899d567 Binary files /dev/null and b/example/web/icons/android-icon-36x36.png differ diff --git a/example/web/icons/android-icon-48x48.png b/example/web/icons/android-icon-48x48.png new file mode 100644 index 0000000..ab51683 Binary files /dev/null and b/example/web/icons/android-icon-48x48.png differ diff --git a/example/web/icons/android-icon-72x72.png b/example/web/icons/android-icon-72x72.png new file mode 100644 index 0000000..eba6b5b Binary files /dev/null and b/example/web/icons/android-icon-72x72.png differ diff --git a/example/web/icons/android-icon-96x96.png b/example/web/icons/android-icon-96x96.png new file mode 100644 index 0000000..dc631b0 Binary files /dev/null and b/example/web/icons/android-icon-96x96.png differ diff --git a/example/web/icons/apple-icon-114x114.png b/example/web/icons/apple-icon-114x114.png new file mode 100644 index 0000000..2d03116 Binary files /dev/null and b/example/web/icons/apple-icon-114x114.png differ diff --git a/example/web/icons/apple-icon-120x120.png b/example/web/icons/apple-icon-120x120.png new file mode 100644 index 0000000..76b5bd9 Binary files /dev/null and b/example/web/icons/apple-icon-120x120.png differ diff --git a/example/web/icons/apple-icon-144x144.png b/example/web/icons/apple-icon-144x144.png new file mode 100644 index 0000000..9544efc Binary files /dev/null and b/example/web/icons/apple-icon-144x144.png differ diff --git a/example/web/icons/apple-icon-152x152.png b/example/web/icons/apple-icon-152x152.png new file mode 100644 index 0000000..ddbbccf Binary files /dev/null and b/example/web/icons/apple-icon-152x152.png differ diff --git a/example/web/icons/apple-icon-180x180.png b/example/web/icons/apple-icon-180x180.png new file mode 100644 index 0000000..0c976e8 Binary files /dev/null and b/example/web/icons/apple-icon-180x180.png differ diff --git a/example/web/icons/apple-icon-57x57.png b/example/web/icons/apple-icon-57x57.png new file mode 100644 index 0000000..1da34ec Binary files /dev/null and b/example/web/icons/apple-icon-57x57.png differ diff --git a/example/web/icons/apple-icon-60x60.png b/example/web/icons/apple-icon-60x60.png new file mode 100644 index 0000000..4917644 Binary files /dev/null and b/example/web/icons/apple-icon-60x60.png differ diff --git a/example/web/icons/apple-icon-72x72.png b/example/web/icons/apple-icon-72x72.png new file mode 100644 index 0000000..eba6b5b Binary files /dev/null and b/example/web/icons/apple-icon-72x72.png differ diff --git a/example/web/icons/apple-icon-76x76.png b/example/web/icons/apple-icon-76x76.png new file mode 100644 index 0000000..fe249ff Binary files /dev/null and b/example/web/icons/apple-icon-76x76.png differ diff --git a/example/web/icons/apple-icon-precomposed.png b/example/web/icons/apple-icon-precomposed.png new file mode 100644 index 0000000..fadb002 Binary files /dev/null and b/example/web/icons/apple-icon-precomposed.png differ diff --git a/example/web/icons/apple-icon.png b/example/web/icons/apple-icon.png new file mode 100644 index 0000000..fadb002 Binary files /dev/null and b/example/web/icons/apple-icon.png differ diff --git a/example/web/icons/favicon-16x16.png b/example/web/icons/favicon-16x16.png new file mode 100644 index 0000000..3746333 Binary files /dev/null and b/example/web/icons/favicon-16x16.png differ diff --git a/example/web/icons/favicon-32x32.png b/example/web/icons/favicon-32x32.png new file mode 100644 index 0000000..dd509d6 Binary files /dev/null and b/example/web/icons/favicon-32x32.png differ diff --git a/example/web/icons/favicon-96x96.png b/example/web/icons/favicon-96x96.png new file mode 100644 index 0000000..dc631b0 Binary files /dev/null and b/example/web/icons/favicon-96x96.png differ diff --git a/example/web/icons/favicon.ico b/example/web/icons/favicon.ico new file mode 100644 index 0000000..5680eff Binary files /dev/null and b/example/web/icons/favicon.ico differ diff --git a/example/web/icons/ms-icon-144x144.png b/example/web/icons/ms-icon-144x144.png new file mode 100644 index 0000000..9544efc Binary files /dev/null and b/example/web/icons/ms-icon-144x144.png differ diff --git a/example/web/icons/ms-icon-150x150.png b/example/web/icons/ms-icon-150x150.png new file mode 100644 index 0000000..39b9708 Binary files /dev/null and b/example/web/icons/ms-icon-150x150.png differ diff --git a/example/web/icons/ms-icon-310x310.png b/example/web/icons/ms-icon-310x310.png new file mode 100644 index 0000000..57ee51c Binary files /dev/null and b/example/web/icons/ms-icon-310x310.png differ diff --git a/example/web/icons/ms-icon-70x70.png b/example/web/icons/ms-icon-70x70.png new file mode 100644 index 0000000..12d1b6f Binary files /dev/null and b/example/web/icons/ms-icon-70x70.png differ diff --git a/example/web/index.html b/example/web/index.html index 2c68848..6d7d532 100644 --- a/example/web/index.html +++ b/example/web/index.html @@ -1,5 +1,6 @@ + + Toastification + + - + + + + + + + + + + + + + + - - + + + + + + + + + + - - - example - + + + + + - + + \ No newline at end of file diff --git a/example/web/manifest.json b/example/web/manifest.json index 8f493ec..43a77e2 100644 --- a/example/web/manifest.json +++ b/example/web/manifest.json @@ -10,26 +10,40 @@ "prefer_related_applications": false, "icons": [ { - "src": "icons/Icon-192.png", - "sizes": "192x192", - "type": "image/png" + "src": "icons/android-icon-36x36.png", + "sizes": "36x36", + "type": "image/png", + "density": "0.75" }, { - "src": "icons/Icon-512.png", - "sizes": "512x512", - "type": "image/png" + "src": "icons/android-icon-48x48.png", + "sizes": "48x48", + "type": "image/png", + "density": "1.0" }, { - "src": "icons/Icon-maskable-192.png", - "sizes": "192x192", + "src": "icons/android-icon-72x72.png", + "sizes": "72x72", "type": "image/png", - "purpose": "maskable" + "density": "1.5" }, { - "src": "icons/Icon-maskable-512.png", - "sizes": "512x512", + "src": "icons/android-icon-96x96.png", + "sizes": "96x96", + "type": "image/png", + "density": "2.0" + }, + { + "src": "icons/android-icon-144x144.png", + "sizes": "144x144", + "type": "image/png", + "density": "3.0" + }, + { + "src": "icons/android-icon-192x192.png", + "sizes": "192x192", "type": "image/png", - "purpose": "maskable" + "density": "4.0" } ] -} +} \ No newline at end of file diff --git a/lib/src/core/toastification.dart b/lib/src/core/toastification.dart index 40c4cd7..43754cb 100644 --- a/lib/src/core/toastification.dart +++ b/lib/src/core/toastification.dart @@ -204,6 +204,7 @@ class Toastification { /// autoCloseDuration: Duration(seconds: 3), /// ); /// ``` + /// TODO(payam): add close button icon parameter ToastificationItem show({ required BuildContext context, AlignmentGeometry? alignment, diff --git a/lib/src/core/toastification_config.dart b/lib/src/core/toastification_config.dart index e7bd4d3..fa02253 100644 --- a/lib/src/core/toastification_config.dart +++ b/lib/src/core/toastification_config.dart @@ -13,49 +13,48 @@ const _defaultMargin = EdgeInsets.symmetric(vertical: 32); /// if some of the parameters are not provided, /// /// [Toastification] will use this class to get the default values. -/// +/// /// to provide the [ToastificationConfig] to the widget tree you can use /// the [ToastificationConfigProvider] widget. -/// -/// +/// class ToastificationConfig extends Equatable { const ToastificationConfig({ this.alignment = _defaultAlignment, + this.itemWidth = _defaultWidth, this.animationDuration = _itemAnimationDuration, this.animationBuilder = _defaultAnimationBuilderConfig, - this.itemWidth = _defaultWidth, - this.margin = _defaultMargin, + this.marginBuilder = _defaultMarginBuilder, }); final AlignmentGeometry alignment; + final double itemWidth; final Duration animationDuration; final ToastificationAnimationBuilder animationBuilder; - final double itemWidth; - final EdgeInsetsGeometry margin; + final EdgeInsetsGeometry Function(AlignmentGeometry alignment) marginBuilder; // Copy with method for ToastificationConfig ToastificationConfig copyWith({ AlignmentGeometry? alignment, + double? itemWidth, Duration? animationDuration, ToastificationAnimationBuilder? animationBuilder, - double? itemWidth, - EdgeInsetsGeometry? margin, + EdgeInsetsGeometry Function(AlignmentGeometry alignment)? marginBuilder, }) { return ToastificationConfig( alignment: alignment ?? this.alignment, + itemWidth: itemWidth ?? this.itemWidth, animationDuration: animationDuration ?? this.animationDuration, animationBuilder: animationBuilder ?? this.animationBuilder, - itemWidth: itemWidth ?? this.itemWidth, - margin: margin ?? this.margin, + marginBuilder: marginBuilder ?? this.marginBuilder, ); } @override List get props => [ alignment, - animationDuration, itemWidth, - margin, + animationDuration, + marginBuilder, ]; } @@ -71,3 +70,7 @@ Widget _defaultAnimationBuilderConfig( child: child, ); } + +EdgeInsetsGeometry _defaultMarginBuilder(AlignmentGeometry alignment) { + return _defaultMargin; +} diff --git a/lib/src/core/toastification_manager.dart b/lib/src/core/toastification_manager.dart index d5eea13..8a4151a 100644 --- a/lib/src/core/toastification_manager.dart +++ b/lib/src/core/toastification_manager.dart @@ -194,7 +194,7 @@ class ToastificationManager { Widget overlay = Align( alignment: alignment, child: Container( - margin: config.margin, + margin: config.marginBuilder(alignment), constraints: BoxConstraints.tightFor( width: config.itemWidth, ), diff --git a/lib/src/widget/toastification_config_provider.dart b/lib/src/widget/toastification_config_provider.dart index bb6a8bf..34a6b0c 100644 --- a/lib/src/widget/toastification_config_provider.dart +++ b/lib/src/widget/toastification_config_provider.dart @@ -1,6 +1,7 @@ import 'package:flutter/widgets.dart'; import 'package:toastification/src/core/toastification_config.dart'; + class ToastificationConfigProvider extends InheritedWidget { const ToastificationConfigProvider({ super.key, diff --git a/pubspec.yaml b/pubspec.yaml index a43683d..88cc410 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,8 @@ name: toastification -description: Toastification is a Flutter package that allows you to easily show toast messages in your application. -version: 0.0.3 -homepage: https://github.com/payam-zahedi/toastification +description: Toastification is a Flutter package that allows you to easily show toast and notification messages in your application. +version: 1.0.0 +homepage: https://payamzahedi.com/toastification/ +repository: https://github.com/payam-zahedi/toastification environment: sdk: '>=3.0.0 <4.0.0'