From 84299076506d61b9caab4059f66ae35f7c6a97d2 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Thu, 9 Jun 2022 14:26:02 -0700 Subject: [PATCH] modal menus design fixes --- lib/views/contactsview.dart | 92 +++++++++++++++++++---------------- lib/views/profilemgrview.dart | 91 ++++++++++++++++++++-------------- 2 files changed, 104 insertions(+), 79 deletions(-) diff --git a/lib/views/contactsview.dart b/lib/views/contactsview.dart index a6e51512..d5ed01d2 100644 --- a/lib/views/contactsview.dart +++ b/lib/views/contactsview.dart @@ -257,58 +257,66 @@ class _ContactsViewState extends State { padding: EdgeInsets.all(10.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, - mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, children: [ - Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Spacer(), - Expanded( - child: Tooltip( - message: AppLocalizations.of(context)!.tooltipAddContact, - child: ElevatedButton( - child: Text(AppLocalizations.of(context)!.addContact, semanticsLabel: AppLocalizations.of(context)!.addContact), - onPressed: () { - _pushAddContact(false); - }, - ))), - Spacer() - ]), + Expanded( + child: Tooltip( + message: AppLocalizations.of(context)!.tooltipAddContact, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: Size.fromWidth(double.infinity), + maximumSize: Size.fromWidth(400), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), + ), + child: Text( + AppLocalizations.of(context)!.addContact, + semanticsLabel: AppLocalizations.of(context)!.addContact, + textAlign: TextAlign.center, + ), + onPressed: () { + _pushAddContact(false); + }, + ))), SizedBox( height: 20, ), - Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Spacer(), - Expanded( + Expanded( + child: Tooltip( + message: groupsEnabled ? AppLocalizations.of(context)!.addServerTooltip : AppLocalizations.of(context)!.thisFeatureRequiresGroupExpermientsToBeEnabled, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: Size.fromWidth(double.infinity), + maximumSize: Size.fromWidth(400), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), + ), + child: Text(AppLocalizations.of(context)!.addServerTitle, semanticsLabel: AppLocalizations.of(context)!.addServerTitle, textAlign: TextAlign.center), + onPressed: groupsEnabled + ? () { + _pushAddContact(false); + } + : null, + )), + ), + SizedBox( + height: 20, + ), + Expanded( child: Tooltip( - message: groupsEnabled ? AppLocalizations.of(context)!.addServerTooltip : AppLocalizations.of(context)!.thisFeatureRequiresGroupExpermientsToBeEnabled, + message: groupsEnabled ? AppLocalizations.of(context)!.createGroupTitle : AppLocalizations.of(context)!.thisFeatureRequiresGroupExpermientsToBeEnabled, child: ElevatedButton( - child: Text(AppLocalizations.of(context)!.addServerTitle, semanticsLabel: AppLocalizations.of(context)!.addServerTitle), + style: ElevatedButton.styleFrom( + minimumSize: Size.fromWidth(double.infinity), + maximumSize: Size.fromWidth(400), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), + ), + child: Text(AppLocalizations.of(context)!.createGroupTitle, semanticsLabel: AppLocalizations.of(context)!.createGroupTitle, textAlign: TextAlign.center), onPressed: groupsEnabled ? () { - _pushAddContact(false); + _pushAddContact(true); } : null, - )), - ), - Spacer() - ]), - SizedBox( - height: 20, - ), - Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Spacer(), - Expanded( - child: Tooltip( - message: groupsEnabled ? AppLocalizations.of(context)!.createGroupTitle : AppLocalizations.of(context)!.thisFeatureRequiresGroupExpermientsToBeEnabled, - child: ElevatedButton( - child: Text(AppLocalizations.of(context)!.createGroupTitle, semanticsLabel: AppLocalizations.of(context)!.createGroupTitle), - onPressed: groupsEnabled - ? () { - _pushAddContact(true); - } - : null, - ))), - Spacer() - ]), + ))), ], ))), ))); diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index 1d48ff0c..0212d72e 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -194,49 +194,66 @@ class _ProfileMgrViewState extends State { padding: EdgeInsets.all(10.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, mainAxisSize: MainAxisSize.min, children: [ - Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Spacer(), - Expanded( - child: ElevatedButton( - child: Text(AppLocalizations.of(context)!.addProfileTitle, semanticsLabel: AppLocalizations.of(context)!.addProfileTitle), - onPressed: () { - _pushAddProfile(context); - }, - )), - Spacer() - ]), SizedBox( height: 20, ), - Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [ - Spacer(), - Expanded( - child: Tooltip( - message: AppLocalizations.of(context)!.importProfileTooltip, - child: ElevatedButton( - child: Text(AppLocalizations.of(context)!.importProfile, semanticsLabel: AppLocalizations.of(context)!.importProfile), - onPressed: () { - // 10GB profiles should be enough for anyone? - showFilePicker(context, MaxGeneralFileSharingSize, (file) { - showPasswordDialog(context, AppLocalizations.of(context)!.importProfile, AppLocalizations.of(context)!.importProfile, (password) { - Navigator.popUntil(context, (route) => route.isFirst); - Provider.of(context, listen: false).cwtch.ImportProfile(file.path, password).then((value) { - if (value == "") { - final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.successfullyImportedProfile.replaceFirst("%profile", file.path))); - ScaffoldMessenger.of(context).showSnackBar(snackBar); - } else { - final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.failedToImportProfile)); - ScaffoldMessenger.of(context).showSnackBar(snackBar); - } - }); + Expanded( + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: Size(double.infinity, 20), + maximumSize: Size(400, 20), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), + ), + child: Text( + AppLocalizations.of(context)!.addProfileTitle, + semanticsLabel: AppLocalizations.of(context)!.addProfileTitle, + style: TextStyle(fontWeight: FontWeight.bold), + ), + onPressed: () { + _pushAddProfile(context); + }, + )), + SizedBox( + height: 20, + ), + Expanded( + child: Tooltip( + message: AppLocalizations.of(context)!.importProfileTooltip, + child: ElevatedButton( + style: ElevatedButton.styleFrom( + minimumSize: Size(double.infinity, 20), + maximumSize: Size(400, 20), + shape: RoundedRectangleBorder( + side: BorderSide(color: Provider.of(context).theme.defaultButtonActiveColor, width: 2.0), + borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), + primary: Provider.of(context).theme.backgroundMainColor, + ), + child: + Text(AppLocalizations.of(context)!.importProfile, semanticsLabel: AppLocalizations.of(context)!.importProfile, style: TextStyle(fontWeight: FontWeight.bold)), + onPressed: () { + // 10GB profiles should be enough for anyone? + showFilePicker(context, MaxGeneralFileSharingSize, (file) { + showPasswordDialog(context, AppLocalizations.of(context)!.importProfile, AppLocalizations.of(context)!.importProfile, (password) { + Navigator.popUntil(context, (route) => route.isFirst); + Provider.of(context, listen: false).cwtch.ImportProfile(file.path, password).then((value) { + if (value == "") { + final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.successfullyImportedProfile.replaceFirst("%profile", file.path))); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + } else { + final snackBar = SnackBar(content: Text(AppLocalizations.of(context)!.failedToImportProfile)); + ScaffoldMessenger.of(context).showSnackBar(snackBar); + } }); - }, () {}, () {}); - }, - ))), - Spacer() - ]), + }); + }, () {}, () {}); + }, + ))), + SizedBox( + height: 20, + ), ], ))), )));