Design Pass: Profile View, Unlock Modal, Password Entry and Add Profile
This commit is contained in:
parent
28ad4d0ec6
commit
53ff9351cb
|
@ -118,7 +118,9 @@ class CwtchNotifier {
|
||||||
break;
|
break;
|
||||||
case "AppError":
|
case "AppError":
|
||||||
print("New App Error: $data");
|
print("New App Error: $data");
|
||||||
error.handleUpdate(data["Data"]);
|
if (data["Data"] != null) {
|
||||||
|
error.handleUpdate(data["Data"]);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "UpdateGlobalSettings":
|
case "UpdateGlobalSettings":
|
||||||
settings.handleUpdate(jsonDecode(data["Data"]));
|
settings.handleUpdate(jsonDecode(data["Data"]));
|
||||||
|
|
|
@ -1364,10 +1364,14 @@ ThemeData mkThemeData(Settings opaque) {
|
||||||
),
|
),
|
||||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||||
style: ButtonStyle(
|
style: ButtonStyle(
|
||||||
backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor()),
|
backgroundColor: MaterialStateProperty.all(opaque.current().defaultButtonColor()),
|
||||||
foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()),
|
foregroundColor: MaterialStateProperty.all(opaque.current().defaultButtonTextColor()),
|
||||||
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
overlayColor: MaterialStateProperty.all(opaque.current().defaultButtonActiveColor()),
|
||||||
padding: MaterialStateProperty.all(EdgeInsets.all(20))),
|
padding: MaterialStateProperty.all(EdgeInsets.all(20)),
|
||||||
|
shape: MaterialStateProperty.all(RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(18.0),
|
||||||
|
)),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
dialogTheme: DialogTheme(
|
dialogTheme: DialogTheme(
|
||||||
backgroundColor: opaque.current().backgroundPaneColor(),
|
backgroundColor: opaque.current().backgroundPaneColor(),
|
||||||
|
@ -1387,5 +1391,6 @@ ThemeData mkThemeData(Settings opaque) {
|
||||||
caption: TextStyle(color: opaque.current().mainTextColor()),
|
caption: TextStyle(color: opaque.current().mainTextColor()),
|
||||||
button: TextStyle(color: opaque.current().mainTextColor()),
|
button: TextStyle(color: opaque.current().mainTextColor()),
|
||||||
overline: TextStyle(color: opaque.current().mainTextColor())),
|
overline: TextStyle(color: opaque.current().mainTextColor())),
|
||||||
|
textSelectionTheme: TextSelectionThemeData(cursorColor: opaque.current().defaultButtonActiveColor()),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,18 +127,8 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: Provider.of<ProfileInfoState>(context).onion.isEmpty,
|
visible: Provider.of<ProfileInfoState>(context).onion.isEmpty,
|
||||||
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
child: Row(mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[
|
||||||
Radio(
|
Checkbox(
|
||||||
value: false,
|
value: usePassword,
|
||||||
groupValue: usePassword,
|
|
||||||
onChanged: _handleSwitchPassword,
|
|
||||||
),
|
|
||||||
Text(
|
|
||||||
AppLocalizations.of(context).radioNoPassword,
|
|
||||||
style: TextStyle(color: theme.current().mainTextColor()),
|
|
||||||
),
|
|
||||||
Radio(
|
|
||||||
value: true,
|
|
||||||
groupValue: usePassword,
|
|
||||||
onChanged: _handleSwitchPassword,
|
onChanged: _handleSwitchPassword,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
|
@ -214,10 +204,19 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
Row(
|
||||||
onPressed: _createPressed,
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
style: ElevatedButton.styleFrom(primary: theme.current().defaultButtonColor()),
|
children: [
|
||||||
child: Text(Provider.of<ProfileInfoState>(context).onion.isEmpty ? AppLocalizations.of(context).addNewProfileBtn : AppLocalizations.of(context).saveProfileBtn),
|
Expanded(
|
||||||
|
child: ElevatedButton(
|
||||||
|
onPressed: _createPressed,
|
||||||
|
child: Text(
|
||||||
|
Provider.of<ProfileInfoState>(context).onion.isEmpty ? AppLocalizations.of(context).addNewProfileBtn : AppLocalizations.of(context).saveProfileBtn,
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
Visibility(
|
Visibility(
|
||||||
visible: Provider.of<ProfileInfoState>(context, listen: false).onion.isNotEmpty,
|
visible: Provider.of<ProfileInfoState>(context, listen: false).onion.isNotEmpty,
|
||||||
|
|
|
@ -85,7 +85,7 @@ class _ContactsViewState extends State<ContactsView> {
|
||||||
|
|
||||||
Widget _buildContactList() {
|
Widget _buildContactList() {
|
||||||
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
|
final tiles = Provider.of<ContactListState>(context).filteredList().map((ContactInfoState contact) {
|
||||||
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.profileOnion+""+contact.onion), value: contact, builder: (_, __) => ContactRow());
|
return ChangeNotifierProvider<ContactInfoState>.value(key: ValueKey(contact.profileOnion + "" + contact.onion), value: contact, builder: (_, __) => ContactRow());
|
||||||
});
|
});
|
||||||
final divided = ListTile.divideTiles(
|
final divided = ListTile.divideTiles(
|
||||||
context: context,
|
context: context,
|
||||||
|
|
|
@ -132,14 +132,19 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
|
||||||
SizedBox(
|
SizedBox(
|
||||||
height: 20,
|
height: 20,
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
Row(mainAxisAlignment: MainAxisAlignment.spaceEvenly, children: [
|
||||||
child: Text(AppLocalizations.of(context).unlock, semanticsLabel: AppLocalizations.of(context).unlock),
|
Spacer(),
|
||||||
onPressed: () {
|
Expanded(
|
||||||
Provider.of<FlwtchState>(context, listen: false).cwtch.LoadProfiles(ctrlrPassword.value.text);
|
child: ElevatedButton(
|
||||||
ctrlrPassword.text = "";
|
child: Text(AppLocalizations.of(context).unlock, semanticsLabel: AppLocalizations.of(context).unlock),
|
||||||
Navigator.pop(context);
|
onPressed: () {
|
||||||
},
|
Provider.of<FlwtchState>(context, listen: false).cwtch.LoadProfiles(ctrlrPassword.value.text);
|
||||||
),
|
ctrlrPassword.text = "";
|
||||||
|
Navigator.pop(context);
|
||||||
|
},
|
||||||
|
)),
|
||||||
|
Spacer()
|
||||||
|
]),
|
||||||
],
|
],
|
||||||
)),
|
)),
|
||||||
));
|
));
|
||||||
|
@ -161,6 +166,14 @@ class _ProfileMgrViewState extends State<ProfileMgrView> {
|
||||||
tiles: tiles,
|
tiles: tiles,
|
||||||
).toList();
|
).toList();
|
||||||
|
|
||||||
|
if (tiles.isEmpty) {
|
||||||
|
return Center(
|
||||||
|
child: Text(
|
||||||
|
"Please create or unlock a profile to begin!",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
return ListView(children: divided);
|
return ListView(children: divided);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,7 +98,7 @@ class _ContactRowState extends State<ContactRow> {
|
||||||
ChangeNotifierProvider.value(value: profile),
|
ChangeNotifierProvider.value(value: profile),
|
||||||
ChangeNotifierProvider.value(value: profile.contactList.getContact(handle)),
|
ChangeNotifierProvider.value(value: profile.contactList.getContact(handle)),
|
||||||
],
|
],
|
||||||
builder:(context, child) => MessageView(),
|
builder: (context, child) => MessageView(),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
|
|
|
@ -14,16 +14,35 @@ class CwtchPasswordField extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _CwtchTextFieldState extends State<CwtchPasswordField> {
|
class _CwtchTextFieldState extends State<CwtchPasswordField> {
|
||||||
|
bool obscureText = true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
// todo: translations
|
||||||
|
var label = "View Password";
|
||||||
|
if (!obscureText) {
|
||||||
|
label = "Hide Password";
|
||||||
|
}
|
||||||
|
|
||||||
return Consumer<Settings>(builder: (context, theme, child) {
|
return Consumer<Settings>(builder: (context, theme, child) {
|
||||||
return TextFormField(
|
return TextFormField(
|
||||||
controller: widget.controller,
|
controller: widget.controller,
|
||||||
validator: widget.validator,
|
validator: widget.validator,
|
||||||
obscureText: true,
|
obscureText: obscureText,
|
||||||
enableSuggestions: false,
|
enableSuggestions: false,
|
||||||
autocorrect: false,
|
autocorrect: false,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
suffixIcon: IconButton(
|
||||||
|
onPressed: () {
|
||||||
|
obscureText = !obscureText;
|
||||||
|
},
|
||||||
|
icon: Icon((obscureText ? Icons.remove_red_eye : Icons.remove_red_eye_outlined), semanticLabel: label),
|
||||||
|
tooltip: label,
|
||||||
|
color: theme.current().mainTextColor(),
|
||||||
|
highlightColor: theme.current().defaultButtonColor(),
|
||||||
|
focusColor: theme.current().defaultButtonActiveColor(),
|
||||||
|
splashColor: theme.current().defaultButtonActiveColor(),
|
||||||
|
),
|
||||||
errorStyle: TextStyle(
|
errorStyle: TextStyle(
|
||||||
color: theme.current().textfieldErrorColor(),
|
color: theme.current().textfieldErrorColor(),
|
||||||
fontWeight: FontWeight.bold,
|
fontWeight: FontWeight.bold,
|
||||||
|
|
Loading…
Reference in New Issue