From ed4bb99fdef0524a6af95d35f2dbbc2885027be8 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 23 Nov 2022 10:02:41 -0800 Subject: [PATCH 1/4] 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); -- 2.25.1 From b8661241474e19d63a3cd45985ec54dca4ee6afe Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 23 Nov 2022 11:53:48 -0800 Subject: [PATCH 2/4] Hide Address Copy in Peer Settings when Streamer Mode is Enabled Fix: #557 --- lib/themes/juniper.dart | 43 --------------------------------- lib/views/peersettingsview.dart | 32 ++++++++++++------------ 2 files changed, 17 insertions(+), 58 deletions(-) delete mode 100644 lib/themes/juniper.dart diff --git a/lib/themes/juniper.dart b/lib/themes/juniper.dart deleted file mode 100644 index 50dc446e..00000000 --- a/lib/themes/juniper.dart +++ /dev/null @@ -1,43 +0,0 @@ -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/peersettingsview.dart b/lib/views/peersettingsview.dart index 6ddbd6e7..7d4c029e 100644 --- a/lib/views/peersettingsview.dart +++ b/lib/views/peersettingsview.dart @@ -129,21 +129,23 @@ class _PeerSettingsViewState extends State { ]), // Address Copy Button - Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ - SizedBox( - height: 20, - ), - CwtchLabel(label: AppLocalizations.of(context)!.addressLabel), - SizedBox( - height: 20, - ), - CwtchButtonTextField( - controller: TextEditingController(text: Provider.of(context, listen: false).onion), - onPressed: _copyOnion, - icon: Icon(CwtchIcons.address_copy), - tooltip: AppLocalizations.of(context)!.copyBtn, - ) - ]), + Visibility( + visible: settings.streamerMode == false, + child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ + SizedBox( + height: 20, + ), + CwtchLabel(label: AppLocalizations.of(context)!.addressLabel), + SizedBox( + height: 20, + ), + CwtchButtonTextField( + controller: TextEditingController(text: Provider.of(context, listen: false).onion), + onPressed: _copyOnion, + icon: Icon(CwtchIcons.address_copy), + tooltip: AppLocalizations.of(context)!.copyBtn, + ) + ])), Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 20, -- 2.25.1 From cfe5f29213dd776a055966e9d02cf90d9808df2b Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 23 Nov 2022 12:19:01 -0800 Subject: [PATCH 3/4] Juniper Theme A theme dedicated to Juniper. --- lib/themes/juniper.dart | 63 +++++++++++++++++++++++++++++++ lib/themes/opaque.dart | 2 + lib/views/globalsettingsview.dart | 3 ++ 3 files changed, 68 insertions(+) create mode 100644 lib/themes/juniper.dart diff --git a/lib/themes/juniper.dart b/lib/themes/juniper.dart new file mode 100644 index 00000000..1ea17ae4 --- /dev/null +++ b/lib/themes/juniper.dart @@ -0,0 +1,63 @@ +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); + static final Color accentAlt = Color(0xFF845A48); + + + 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 => accent; + + get sendHintTextColor => accentAlt; + get hilightElementColor => accentAlt; + get defaultButtonTextColor => mainTextColor; + get defaultButtonDisabledColor => peerBubble; + get defaultButtonDisabledTextColor => peerBubble; + get textfieldErrorColor => accent; + get scrollbarDefaultColor => accent; + get portraitBackgroundColor => header; + get portraitOnlineBorderColor => font; + get portraitOfflineBorderColor => peerBubble; + get portraitBlockedBorderColor => peerBubble; + get portraitBlockedTextColor => peerBubble; + get portraitContactBadgeColor => accent; + get portraitContactBadgeTextColor => mainTextColor; + get portraitProfileBadgeColor => accent; + get portraitProfileBadgeTextColor => mainTextColor; + get dropShadowColor => accentAlt; +} diff --git a/lib/themes/opaque.dart b/lib/themes/opaque.dart index a5bc6f93..34fef3c8 100644 --- a/lib/themes/opaque.dart +++ b/lib/themes/opaque.dart @@ -2,6 +2,7 @@ import 'dart:ui'; import 'dart:core'; import 'package:cwtch/themes/cwtch.dart'; +import 'package:cwtch/themes/juniper.dart'; import 'package:cwtch/themes/mermaid.dart'; import 'package:cwtch/themes/neon1.dart'; import 'package:cwtch/themes/pumpkin.dart'; @@ -21,6 +22,7 @@ const mode_dark = "dark"; final themes = { cwtch_theme: {mode_light: CwtchLight(), mode_dark: CwtchDark()}, ghost_theme: {mode_light: GhostLight(), mode_dark: GhostDark()}, + juniper_theme: {mode_light: Juniper(), mode_dark: Juniper()}, mermaid_theme: {mode_light: MermaidLight(), mode_dark: MermaidDark()}, midnight_theme: {mode_light: MidnightLight(), mode_dark: MidnightDark()}, neon1_theme: {mode_light: Neon1Light(), mode_dark: Neon1Dark()}, diff --git a/lib/views/globalsettingsview.dart b/lib/views/globalsettingsview.dart index 102855d6..29c45fd8 100644 --- a/lib/views/globalsettingsview.dart +++ b/lib/views/globalsettingsview.dart @@ -3,6 +3,7 @@ import 'dart:io'; import 'dart:math'; import 'package:cwtch/cwtch_icons_icons.dart'; import 'package:cwtch/models/servers.dart'; +import 'package:cwtch/themes/juniper.dart'; import 'package:cwtch/widgets/folderpicker.dart'; import 'package:cwtch/themes/cwtch.dart'; import 'package:cwtch/themes/ghost.dart'; @@ -676,6 +677,8 @@ String getThemeName(context, String theme) { return AppLocalizations.of(context)!.themeNameVampire; case witch_theme: return AppLocalizations.of(context)!.themeNameWitch; + case juniper_theme: + return "Juniper"; // Juniper is a noun, and doesn't get subject to translation... } return theme; } -- 2.25.1 From b0668812e46e23f7daeda53e38f1d932808e5139 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 23 Nov 2022 12:20:02 -0800 Subject: [PATCH 4/4] Juniper Theme Intro --- lib/themes/juniper.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/themes/juniper.dart b/lib/themes/juniper.dart index 1ea17ae4..a8965657 100644 --- a/lib/themes/juniper.dart +++ b/lib/themes/juniper.dart @@ -1,3 +1,4 @@ +/// A theme dedicated to Juniper import 'dart:ui'; import 'dart:core'; -- 2.25.1