Delete Profile Stub
This commit is contained in:
parent
f753bfd1c1
commit
75a508fe74
3
SPEC.md
3
SPEC.md
|
@ -59,6 +59,9 @@ required - any new Cwtch work is beyond the scope of this initial spec.
|
|||
- [ ] Error Message When Attempting to Update Password with Wrong Old Password
|
||||
- [ ] Easy Transition from Unencrypted Profile -> Encrypted Profile
|
||||
- [ ] Delete a Profile
|
||||
- [ ] Dialog Acknowledgement
|
||||
- [ ] Require Old Password Gate
|
||||
- [ ] Async Checking of Password
|
||||
- [X] Copy Profile Onion Address
|
||||
|
||||
## Profile Pane (formally Contacts Pane)
|
||||
|
|
|
@ -29,6 +29,7 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
final ctrlrPass2 = TextEditingController(text: "");
|
||||
final ctrlrOnion = TextEditingController(text: "");
|
||||
bool usePassword;
|
||||
bool deleted;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
|
@ -63,8 +64,10 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
Widget _buildForm() {
|
||||
return Consumer<OpaqueTheme>(builder: (context, theme, child) {
|
||||
return LayoutBuilder(builder: (BuildContext context, BoxConstraints viewportConstraints) {
|
||||
return SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAliasWithSaveLayer,
|
||||
return Scrollbar(
|
||||
isAlwaysShown: true,
|
||||
child: SingleChildScrollView(
|
||||
clipBehavior: Clip.antiAlias,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(
|
||||
minHeight: viewportConstraints.maxHeight,
|
||||
|
@ -225,8 +228,23 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
onPressed: _createPressed,
|
||||
style: ElevatedButton.styleFrom(primary: theme.current().defaultButtonColor()),
|
||||
child: Text(Provider.of<ProfileInfoState>(context).onion.isEmpty ? AppLocalizations.of(context).addNewProfileBtn : AppLocalizations.of(context).saveProfileBtn),
|
||||
),
|
||||
Visibility(
|
||||
visible: Provider.of<ProfileInfoState>(context, listen: false).onion.isNotEmpty,
|
||||
child: Column(mainAxisAlignment: MainAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.end, children: [
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
ElevatedButton.icon(
|
||||
onPressed: () {
|
||||
showAlertDialog(context);
|
||||
},
|
||||
style: ElevatedButton.styleFrom(primary: theme.current().defaultButtonColor()),
|
||||
icon: Icon(Icons.delete_forever),
|
||||
label: Text(AppLocalizations.of(context).deleteBtn),
|
||||
)
|
||||
])))));
|
||||
]))
|
||||
]))))));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
@ -286,3 +304,54 @@ class _AddEditProfileViewState extends State<AddEditProfileView> {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
showAlertDialog(BuildContext context) {
|
||||
// set up the buttons
|
||||
Widget cancelButton = TextButton(
|
||||
child: Text("Cancel"),
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(Opaque.current().defaultButtonColor()),
|
||||
foregroundColor: MaterialStateProperty.all(Opaque.current().defaultButtonTextColor()),
|
||||
overlayColor: MaterialStateProperty.all(Opaque.current().defaultButtonActiveColor()),
|
||||
padding: MaterialStateProperty.all(EdgeInsets.all(20))),
|
||||
onPressed: () {
|
||||
Navigator.of(context).pop(); // dismiss dialog
|
||||
},
|
||||
);
|
||||
Widget continueButton = TextButton(
|
||||
style: ButtonStyle(
|
||||
backgroundColor: MaterialStateProperty.all(Opaque.current().defaultButtonColor()),
|
||||
foregroundColor: MaterialStateProperty.all(Opaque.current().defaultButtonTextColor()),
|
||||
overlayColor: MaterialStateProperty.all(Opaque.current().defaultButtonActiveColor()),
|
||||
padding: MaterialStateProperty.all(EdgeInsets.all(20))),
|
||||
child: Text(AppLocalizations.of(context).deleteProfileConfirmBtn),
|
||||
onPressed: () {
|
||||
// TODO Actually Delete the Peer
|
||||
Navigator.of(context).pop(); // dismiss dialog
|
||||
},
|
||||
);
|
||||
|
||||
// set up the AlertDialog
|
||||
AlertDialog alert = AlertDialog(
|
||||
backgroundColor: Provider.of<OpaqueTheme>(context, listen: false).current().backgroundPaneColor(),
|
||||
title: Text(AppLocalizations.of(context).deleteProfileConfirmBtn),
|
||||
titleTextStyle: TextStyle(
|
||||
color: Provider.of<OpaqueTheme>(context, listen: false).current().mainTextColor(),
|
||||
),
|
||||
contentTextStyle: TextStyle(
|
||||
color: Provider.of<OpaqueTheme>(context, listen: false).current().mainTextColor(),
|
||||
),
|
||||
actions: [
|
||||
cancelButton,
|
||||
continueButton,
|
||||
],
|
||||
);
|
||||
|
||||
// show the dialog
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return alert;
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue