Skip to content

Commit

Permalink
Merge pull request #49 from payam-zahedi/release/v1.0.0
Browse files Browse the repository at this point in the history
Release/v1.0.0
  • Loading branch information
payam-zahedi authored Oct 15, 2023
2 parents 97288e7 + 1948c5e commit 7c70fb7
Show file tree
Hide file tree
Showing 48 changed files with 158 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .fvm/fvm_config.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"flutterSdkVersion": "3.10.6",
"flutterSdkVersion": "3.13.5",
"flavors": {}
}
27 changes: 27 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.


<p align="left">
<img src="doc\image\design_mobile.png?raw=true" width="49%" alt="Styles" />
<img src="doc\image\design_desktop.png?raw=true" width="49%" alt="Styles" />
</p>


## Contributions

Expand Down
Binary file added doc/image/design_desktop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/image/design_mobile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 15 additions & 13 deletions example/lib/src/features/home/views/pages/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,23 @@ class _HomeScreenState extends State<HomeScreen> {

@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)),
],
),
),
),
);
Expand Down
12 changes: 10 additions & 2 deletions example/lib/src/features/home/views/ui_states/extra.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
);
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion example/lib/src/features/home/views/widgets/header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
Binary file removed example/web/favicon.png
Binary file not shown.
Binary file removed example/web/icons/Icon-192.png
Binary file not shown.
Binary file removed example/web/icons/Icon-512.png
Binary file not shown.
Binary file removed example/web/icons/Icon-maskable-192.png
Binary file not shown.
Binary file removed example/web/icons/Icon-maskable-512.png
Binary file not shown.
Binary file added example/web/icons/android-icon-144x144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/android-icon-192x192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/android-icon-36x36.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/android-icon-48x48.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/android-icon-72x72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/android-icon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-114x114.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-120x120.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-144x144.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-152x152.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-180x180.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-57x57.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-60x60.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-72x72.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-76x76.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon-precomposed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/apple-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added example/web/icons/favicon-32x32.png
Binary file added example/web/icons/favicon-96x96.png
Binary file added example/web/icons/favicon.ico
Binary file not shown.
Binary file added example/web/icons/ms-icon-144x144.png
Binary file added example/web/icons/ms-icon-150x150.png
Binary file added example/web/icons/ms-icon-310x310.png
Binary file added example/web/icons/ms-icon-70x70.png
52 changes: 41 additions & 11 deletions example/web/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<!DOCTYPE html>
<html>

<head>
<!--
If you are serving your web app in a path other than the root, change the
Expand All @@ -16,21 +17,48 @@
-->
<base href="/toastification/">

<title>Toastification</title>
<link rel="manifest" href="manifest.json">

<meta charset="UTF-8">
<meta content="IE=Edge" http-equiv="X-UA-Compatible">
<meta name="description" content="A new Flutter project.">
<meta name="description"
content="Toastification is a Flutter package that allows you to easily show toast messages in your application.">

<meta property="og:type" content="website">
<meta property="og:title" content="Toastification">
<meta property="og:description" content="Toastification is a Flutter package that allows you to easily show toast messages in your application.">
<meta property="og:image"
content="https://raw.githubusercontent.com/payam-zahedi/toastification/main/doc/image/intro.png">

<meta property="twitter:title" content="Toastification">
<meta property="twitter:description" content="Toastification is a Flutter package that allows you to easily show toast messages in your application.">
<meta property="twitter:image"
content="https://raw.githubusercontent.com/payam-zahedi/toastification/main/doc/image/intro.png">

<meta name="msapplication-TileColor" content="#3F5EFF">
<meta name="msapplication-TileImage" content="/ms-icon-144x144.png">
<meta name="theme-color" content="#3F5EFF">

<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="example">
<link rel="apple-touch-icon" href="icons/Icon-192.png">
<meta name="apple-mobile-web-app-title" content="Toastification">
<link rel="apple-touch-icon" sizes="57x57" href="icons/apple-icon-57x57.png">
<link rel="apple-touch-icon" sizes="60x60" href="icons/apple-icon-60x60.png">
<link rel="apple-touch-icon" sizes="72x72" href="icons/apple-icon-72x72.png">
<link rel="apple-touch-icon" sizes="76x76" href="icons/apple-icon-76x76.png">
<link rel="apple-touch-icon" sizes="114x114" href="icons/apple-icon-114x114.png">
<link rel="apple-touch-icon" sizes="120x120" href="icons/apple-icon-120x120.png">
<link rel="apple-touch-icon" sizes="144x144" href="icons/apple-icon-144x144.png">
<link rel="apple-touch-icon" sizes="152x152" href="icons/apple-icon-152x152.png">
<link rel="apple-touch-icon" sizes="180x180" href="icons/apple-icon-180x180.png">

<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>

<title>example</title>
<link rel="manifest" href="manifest.json">
<link rel="icon" type="image/png" sizes="16x16" href="icons/favicon-16x16.png">
<link rel="icon" type="image/png" sizes="32x32" href="icons/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="96x96" href="icons/favicon-96x96.png">
<link rel="icon" type="image/png" sizes="192x192" href="icons/android-icon-192x192.png">

<script>
// The value below is injected by flutter build, do not touch.
Expand All @@ -39,20 +67,22 @@
<!-- This script adds the flutter initialization JS code -->
<script src="flutter.js" defer></script>
</head>

<body>
<script>
window.addEventListener('load', function(ev) {
window.addEventListener('load', function (ev) {
// Download main.dart.js
_flutter.loader.loadEntrypoint({
serviceWorker: {
serviceWorkerVersion: serviceWorkerVersion,
}
}).then(function(engineInitializer) {
}).then(function (engineInitializer) {
return engineInitializer.initializeEngine();
}).then(function(appRunner) {
}).then(function (appRunner) {
return appRunner.runApp();
});
});
</script>
</body>
</html>

</html>
40 changes: 27 additions & 13 deletions example/web/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
}
1 change: 1 addition & 0 deletions lib/src/core/toastification.dart
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ class Toastification {
/// autoCloseDuration: Duration(seconds: 3),
/// );
/// ```
/// TODO(payam): add close button icon parameter
ToastificationItem show({
required BuildContext context,
AlignmentGeometry? alignment,
Expand Down
29 changes: 16 additions & 13 deletions lib/src/core/toastification_config.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object?> get props => [
alignment,
animationDuration,
itemWidth,
margin,
animationDuration,
marginBuilder,
];
}

Expand All @@ -71,3 +70,7 @@ Widget _defaultAnimationBuilderConfig(
child: child,
);
}

EdgeInsetsGeometry _defaultMarginBuilder(AlignmentGeometry alignment) {
return _defaultMargin;
}
2 changes: 1 addition & 1 deletion lib/src/core/toastification_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand Down
1 change: 1 addition & 0 deletions lib/src/widget/toastification_config_provider.dart
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
Loading

0 comments on commit 7c70fb7

Please sign in to comment.