From ed4bb99fdef0524a6af95d35f2dbbc2885027be8 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 23 Nov 2022 10:02:41 -0800 Subject: [PATCH] Add More Prominant Unlock Profile Button + add buttons to onboarding flow Fix: #561 --- lib/settings.dart | 2 +- lib/themes/juniper.dart | 43 +++++++++++++++++++++++ lib/views/profilemgrview.dart | 65 +++++++++++++++++++++++++++++++---- 3 files changed, 103 insertions(+), 7 deletions(-) create mode 100644 lib/themes/juniper.dart diff --git a/lib/settings.dart b/lib/settings.dart index 3a1349c4..91af7cc2 100644 --- a/lib/settings.dart +++ b/lib/settings.dart @@ -165,7 +165,7 @@ class Settings extends ChangeNotifier { if (code.length == 1) { this.switchLocale(Locale(languageCode)); } else { - this.switchLocale(Locale(code[0],code[1])); + this.switchLocale(Locale(code[0], code[1])); } } diff --git a/lib/themes/juniper.dart b/lib/themes/juniper.dart new file mode 100644 index 00000000..50dc446e --- /dev/null +++ b/lib/themes/juniper.dart @@ -0,0 +1,43 @@ +import 'dart:ui'; +import 'dart:core'; + +import 'package:cwtch/themes/cwtch.dart'; +import 'package:flutter/material.dart'; + +import 'opaque.dart'; + +const juniper_theme = "juniper"; + +OpaqueThemeType GetJuniperTheme(String mode) { + // there is only one juniper theme + return Juniper(); +} + +class Juniper extends CwtchDark { + static final Color background = Color(0xFF1B1B1B); + static final Color backgroundAlt = Color(0xFF494949); + static final Color header = Color(0xFF1B1B1B); + static final Color userBubble = Color(0xFF373737); + static final Color peerBubble = Color(0xFF494949); + static final Color font = Color(0xFFFFFFFF); + static final Color settings = Color(0xFFFFFDFF); + static final Color accent = Color(0xFF9E6A56); + + get theme => juniper_theme; + get mode => mode_dark; + + get backgroundMainColor => background; // darkGreyPurple; + get backgroundPaneColor => header; //darkGreyPurple; + get topbarColor => header; //darkGreyPurple; + get mainTextColor => font; //whiteishPurple; + get defaultButtonColor => accent; //hotPink; + get textfieldHintColor => mainTextColor; //TODO pick + get toolbarIconColor => settings; //whiteishPurple; + get messageFromMeBackgroundColor => userBubble; // mauvePurple; + get messageFromMeTextColor => font; //whiteishPurple; + get messageFromOtherBackgroundColor => peerBubble; //deepPurple; + get messageFromOtherTextColor => font; //whiteishPurple; + get textfieldBackgroundColor => peerBubble; + get textfieldBorderColor => userBubble; + get backgroundHilightElementColor => backgroundAlt; +} diff --git a/lib/views/profilemgrview.dart b/lib/views/profilemgrview.dart index f7885820..eccf6db7 100644 --- a/lib/views/profilemgrview.dart +++ b/lib/views/profilemgrview.dart @@ -336,7 +336,7 @@ class _ProfileMgrViewState extends State { Widget _buildProfileManager() { return Consumer( builder: (context, pls, child) { - final tiles = pls.profiles.map( + var tiles = pls.profiles.map( (ProfileInfoState profile) { return ChangeNotifierProvider.value( value: profile, @@ -345,17 +345,70 @@ class _ProfileMgrViewState extends State { }, ); + List> widgetTiles = tiles.toList(growable: true); + widgetTiles.add(ChangeNotifierProvider.value( + value: ProfileInfoState(onion: ""), + builder: (context, child) { + return Container( + margin: EdgeInsets.only(top: 20), + width: MediaQuery.of(context).size.width, + child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ + Tooltip( + message: AppLocalizations.of(context)!.tooltipUnlockProfiles, + child: TextButton.icon( + icon: Icon(CwtchIcons.lock_open_24px, color: Provider.of(context).current().mainTextColor), + style: TextButton.styleFrom( + minimumSize: Size(MediaQuery.of(context).size.width * 0.79, 50), + maximumSize: Size(MediaQuery.of(context).size.width * 0.8, 50), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), + ), + label: Text( + AppLocalizations.of(context)!.unlock, + semanticsLabel: AppLocalizations.of(context)!.unlock, + style: TextStyle(fontWeight: FontWeight.bold), + ), + onPressed: () { + _modalUnlockProfiles(); + }, + )), + ])); + })); + final divided = ListTile.divideTiles( context: context, - tiles: tiles, + tiles: widgetTiles, ).toList(); + // Display the welcome message / unlock profiles button to new accounts if (tiles.isEmpty) { return Center( - child: Text( - AppLocalizations.of(context)!.unlockProfileTip, - textAlign: TextAlign.center, - )); + child: Column(mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [ + Text(AppLocalizations.of(context)!.unlockProfileTip, textAlign: TextAlign.center), + Container( + width: MediaQuery.of(context).size.width, + margin: EdgeInsets.only(top: 20), + child: Row(mainAxisAlignment: MainAxisAlignment.spaceAround, children: [ + Tooltip( + message: AppLocalizations.of(context)!.addProfileTitle, + child: TextButton.icon( + icon: Icon(Icons.add, color: Provider.of(context).current().mainTextColor), + style: TextButton.styleFrom( + minimumSize: Size(MediaQuery.of(context).size.width * 0.79, 50), + maximumSize: Size(MediaQuery.of(context).size.width * 0.8, 50), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.horizontal(left: Radius.circular(180), right: Radius.circular(180))), + ), + label: Text( + AppLocalizations.of(context)!.addProfileTitle, + semanticsLabel: AppLocalizations.of(context)!.addProfileTitle, + style: TextStyle(fontWeight: FontWeight.bold), + ), + onPressed: () { + _modalAddImportProfiles(); + }, + )), + ])), + widgetTiles[0] + ])); } return ListView(children: divided);