1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-30 00:36:28 +00:00
comunicmobile/lib/ui/routes/create_account_route.dart

55 lines
1.5 KiB
Dart
Raw Normal View History

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(
title: Text(tr("Create an account")),
),
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(
title: Text(tr("Account created")),
content: Text(tr(
"Your account has been successfully created. You can now login to start to use it.")),
actions: <Widget>[
CupertinoButton(
child: Text(tr("Login")), onPressed: () => Navigator.of(c).pop())
],
),
);
2021-04-17 09:27:52 +00:00
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: (c) => LoginRoute()));
}
2019-11-02 17:09:34 +00:00
}