diff --git a/CHANGELOG.md b/CHANGELOG.md index f28334c..d6467d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +### [1.0.3] - 2022-10-26 Release +* Task: Scaffold Messenger section Supporting `showSnackBar`. +* Task: added example. +* Task: version bumped to 1.0.3. ### [1.0.2] - 2022-10-26 Release * Task: Theme section added with current variables as following : `theme`, `backgroundColor`, `typography`, `brightness`. * Task: added example. diff --git a/example/lib/main.dart b/example/lib/main.dart index 3be731c..c4c7cb0 100644 --- a/example/lib/main.dart +++ b/example/lib/main.dart @@ -85,6 +85,16 @@ class Demo extends StatelessWidget { const Text('Texting horizontal spacer'), ], ), + TextButton.icon( + onPressed: () { + context.showSnackBar(const SnackBar( + content: Text('Snackbar example!'), + duration: Duration(seconds: 5))); + }, + icon: const Icon( + Icons.podcasts, + ), + label: const Text('Snackbar in context')), ], ), ), diff --git a/lib/src/extensions.dart b/lib/src/extensions.dart index fd48134..8875665 100644 --- a/lib/src/extensions.dart +++ b/lib/src/extensions.dart @@ -104,4 +104,8 @@ extension uih on BuildContext { /// Return `Theme` based [brightness] Brightness get brightness => theme.brightness; + + // Scaffold Message Section + showSnackBar(SnackBar child) => + ScaffoldMessenger.of(this).showSnackBar(child); } diff --git a/pubspec.yaml b/pubspec.yaml index 8ce7fbb..49873b0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: uih description: UiH ( Ui Helper ) is a flutter / dart utility package created to help people improve ui consistency throughout the multiple platform respective to the Ui Design and various hardware factor in real time. Access MediaQuery sizing info directly on the context, also adds some helper methods for sizing and layout. -version: 1.0.2 +version: 1.0.3 homepage: https://packages.prodevplus.com/uih environment: