From cce1b255bcf6c9a5f3a60c67610b779bd9727aaa Mon Sep 17 00:00:00 2001 From: mediocre9 Date: Wed, 5 Jul 2023 03:33:31 +0500 Subject: [PATCH] refactor: add common mixin standard app widgets --- lib/widgets/common.dart | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 lib/widgets/common.dart diff --git a/lib/widgets/common.dart b/lib/widgets/common.dart new file mode 100644 index 0000000..884aee4 --- /dev/null +++ b/lib/widgets/common.dart @@ -0,0 +1,33 @@ +import 'package:flutter/material.dart'; +import '../config/strings/app_strings.dart'; + +mixin StandardAppWidgets { + void showAboutDialogWidget( + BuildContext context, MediaQueryData mediaQuery, ThemeData theme) { + return showAboutDialog( + context: context, + applicationName: AppString.kAppName, + applicationVersion: AppString.kAppVersion, + applicationIcon: Image.asset( + 'assets/images/logo.png', + width: mediaQuery.size.width / 5, + ), + children: [ + Text( + AppString.kCopyrightStatement, + style: theme.textTheme.labelMedium, + ), + ], + ); + } + + void showSnackBarWidget(BuildContext context, String message, + {Color? color}) { + ScaffoldMessenger.of(context).showSnackBar( + SnackBar( + content: Text(message), + backgroundColor: color, + ), + ); + } +}