diff --git a/lib/ui/routes/home_route.dart b/lib/ui/routes/home_route.dart index 49c9ae6..6359a31 100644 --- a/lib/ui/routes/home_route.dart +++ b/lib/ui/routes/home_route.dart @@ -90,6 +90,11 @@ class _HomeRouteState extends HomeController { _openAppSettings(); break; + /// Show about dialog + case BarCallbackActions.OPEN_ABOUT_DIALOG: + showAboutAppDialog(context); + break; + /// Logout user case BarCallbackActions.ACTION_LOGOUT: _logoutRequested(); diff --git a/lib/ui/widgets/navbar_widget.dart b/lib/ui/widgets/navbar_widget.dart index 1a85c24..0b97b3e 100644 --- a/lib/ui/widgets/navbar_widget.dart +++ b/lib/ui/widgets/navbar_widget.dart @@ -18,6 +18,7 @@ enum BarCallbackActions { OPEN_GROUPS, OPEN_GROUP_PAGE, OPEN_APP_SETTINGS, + OPEN_ABOUT_DIALOG, NONE, ACTION_LOGOUT } @@ -86,6 +87,8 @@ final _menuActionsItem = <_ActionMenuItem>[ _ActionMenuItem(label: tr("Groups"), action: BarCallbackActions.OPEN_GROUPS), _ActionMenuItem( label: tr("App settings"), action: BarCallbackActions.OPEN_APP_SETTINGS), + _ActionMenuItem( + label: tr("About Comunic"), action: BarCallbackActions.OPEN_ABOUT_DIALOG), _ActionMenuItem( label: tr("Sign out"), action: BarCallbackActions.ACTION_LOGOUT), ]; diff --git a/lib/utils/ui_utils.dart b/lib/utils/ui_utils.dart index ffeaaf2..905a428 100644 --- a/lib/utils/ui_utils.dart +++ b/lib/utils/ui_utils.dart @@ -31,10 +31,9 @@ Widget buildLoadingPage({ } /// Build and return an error card -Widget buildErrorCard(String message, {List actions, bool hide = false}) { - - if(hide) - return Container(); +Widget buildErrorCard(String message, + {List actions, bool hide = false}) { + if (hide) return Container(); return Card( elevation: 2.0, @@ -190,3 +189,23 @@ const darkerAccentColor = Colors.white30; /// Check out whether dark theme is enabled or not bool darkTheme() => preferences().getBool(PreferencesKeyList.ENABLE_DARK_THEME); + +/// Show about Comunic dialog +void showAboutAppDialog(BuildContext context) { + showAboutDialog( + context: context, + applicationName: "Comunic", + children: [ + Text( + tr("Comunic is a free and OpenSource social network that respect your privacy."), + textAlign: TextAlign.center, + ), + SizedBox( + height: 20, + ), + Text( + "Application built by Pierre Hubert", + textAlign: TextAlign.center, + ), + ]); +}