1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 04:49:21 +00:00

Add about dialog

This commit is contained in:
Pierre HUBERT 2020-04-16 09:29:37 +02:00
parent 302e5f22ce
commit ec1732088a
3 changed files with 31 additions and 4 deletions

View File

@ -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();

View File

@ -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),
];

View File

@ -31,10 +31,9 @@ Widget buildLoadingPage({
}
/// Build and return an error card
Widget buildErrorCard(String message, {List<Widget> actions, bool hide = false}) {
if(hide)
return Container();
Widget buildErrorCard(String message,
{List<Widget> 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: <Widget>[
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,
),
]);
}