2021-04-17 09:27:52 +00:00
|
|
|
import 'package:comunic/ui/routes/login_route.dart';
|
2021-04-17 08:10:31 +00:00
|
|
|
import 'package:comunic/ui/widgets/create_account_widget.dart';
|
2021-04-17 09:46:57 +00:00
|
|
|
import 'package:comunic/ui/widgets/login_route_container.dart';
|
2019-11-02 17:09:34 +00:00
|
|
|
import 'package:comunic/utils/intl_utils.dart';
|
2019-11-02 17:54:30 +00:00
|
|
|
import 'package:flutter/cupertino.dart';
|
2019-11-02 17:09:34 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
/// Create account route
|
|
|
|
///
|
|
|
|
/// @author Pierre HUBERT
|
|
|
|
|
|
|
|
class CreateAccountRoute extends StatelessWidget {
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2021-04-17 09:46:57 +00:00
|
|
|
return LoginRouteContainer(
|
2021-04-17 09:16:21 +00:00
|
|
|
child: Scaffold(
|
|
|
|
appBar: AppBar(
|
2022-03-10 18:39:57 +00:00
|
|
|
title: Text(tr("Create an account")!),
|
2021-04-17 09:16:21 +00:00
|
|
|
),
|
|
|
|
body: _CreateAccountRouteBody(),
|
2021-04-17 08:59:06 +00:00
|
|
|
),
|
2019-11-02 17:09:34 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class _CreateAccountRouteBody extends StatefulWidget {
|
|
|
|
@override
|
|
|
|
__CreateAccountRouteBodyState createState() =>
|
|
|
|
__CreateAccountRouteBodyState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> {
|
|
|
|
@override
|
2021-04-17 08:10:31 +00:00
|
|
|
Widget build(BuildContext context) =>
|
|
|
|
CreateAccountWidget(onCreated: _accountCreated);
|
2019-11-02 17:54:30 +00:00
|
|
|
|
|
|
|
void _accountCreated() async {
|
|
|
|
await showCupertinoDialog(
|
|
|
|
context: context,
|
|
|
|
builder: (c) => CupertinoAlertDialog(
|
2022-03-10 18:39:57 +00:00
|
|
|
title: Text(tr("Account created")!),
|
2019-11-02 17:54:30 +00:00
|
|
|
content: Text(tr(
|
2022-03-10 18:39:57 +00:00
|
|
|
"Your account has been successfully created. You can now login to start to use it.")!),
|
2019-11-02 17:54:30 +00:00
|
|
|
actions: <Widget>[
|
|
|
|
CupertinoButton(
|
2022-03-10 18:39:57 +00:00
|
|
|
child: Text(tr("Login")!), onPressed: () => Navigator.of(c).pop())
|
2019-11-02 17:54:30 +00:00
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
|
2021-04-17 09:27:52 +00:00
|
|
|
Navigator.of(context)
|
|
|
|
.pushReplacement(MaterialPageRoute(builder: (c) => LoginRoute()));
|
2019-11-02 17:16:16 +00:00
|
|
|
}
|
2019-11-02 17:09:34 +00:00
|
|
|
}
|