Add More Prominant Unlock Profile Button
continuous-integration/drone/pr Build is pending Details

+ add buttons to onboarding flow

Fix: #561
This commit is contained in:
Sarah Jamie Lewis 2022-11-23 10:02:41 -08:00
parent b282ace9c3
commit ed4bb99fde
3 changed files with 103 additions and 7 deletions

View File

@ -165,7 +165,7 @@ class Settings extends ChangeNotifier {
if (code.length == 1) { if (code.length == 1) {
this.switchLocale(Locale(languageCode)); this.switchLocale(Locale(languageCode));
} else { } else {
this.switchLocale(Locale(code[0],code[1])); this.switchLocale(Locale(code[0], code[1]));
} }
} }

43
lib/themes/juniper.dart Normal file
View File

@ -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;
}

View File

@ -336,7 +336,7 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
Widget _buildProfileManager() { Widget _buildProfileManager() {
return Consumer<ProfileListState>( return Consumer<ProfileListState>(
builder: (context, pls, child) { builder: (context, pls, child) {
final tiles = pls.profiles.map( var tiles = pls.profiles.map(
(ProfileInfoState profile) { (ProfileInfoState profile) {
return ChangeNotifierProvider<ProfileInfoState>.value( return ChangeNotifierProvider<ProfileInfoState>.value(
value: profile, value: profile,
@ -345,17 +345,70 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
}, },
); );
List<ChangeNotifierProvider<ProfileInfoState>> widgetTiles = tiles.toList(growable: true);
widgetTiles.add(ChangeNotifierProvider<ProfileInfoState>.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<Settings>(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( final divided = ListTile.divideTiles(
context: context, context: context,
tiles: tiles, tiles: widgetTiles,
).toList(); ).toList();
// Display the welcome message / unlock profiles button to new accounts
if (tiles.isEmpty) { if (tiles.isEmpty) {
return Center( return Center(
child: Text( child: Column(mainAxisSize: MainAxisSize.min, mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center, children: [
AppLocalizations.of(context)!.unlockProfileTip, Text(AppLocalizations.of(context)!.unlockProfileTip, textAlign: TextAlign.center),
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<Settings>(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); return ListView(children: divided);