mobile: Fine tune account settings

If the user enters something into the login fields, the values will be
copied to the registration screen. Also, the password is required to
delete an account now.
This commit is contained in:
Elias Projahn 2020-05-13 17:54:16 +02:00
parent 0e10edb87f
commit 5ffecb97c6
3 changed files with 127 additions and 25 deletions

View file

@ -4,6 +4,14 @@ import 'package:musicus_common/musicus_common.dart';
/// A screen for creating a new Musicus account.
class RegisterScreen extends StatefulWidget {
final String username;
final String password;
RegisterScreen({
this.username,
this.password,
});
@override
_RegisterScreenState createState() => _RegisterScreenState();
}
@ -16,6 +24,19 @@ class _RegisterScreenState extends State<RegisterScreen> {
bool _loading = false;
@override
void initState() {
super.initState();
if (widget.username != null) {
nameController.text = widget.username;
}
if (widget.password != null) {
passwordController.text = widget.password;
}
}
@override
Widget build(BuildContext context) {
final backend = MusicusBackend.of(context);