1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-01-29 21:23:00 +00:00
comunicmobile/lib/ui/routes/create_account_route.dart

55 lines
1.5 KiB
Dart
Raw Normal View History

2021-04-17 11:27:52 +02:00
import 'package:comunic/ui/routes/login_route.dart';
2021-04-17 10:10:31 +02:00
import 'package:comunic/ui/widgets/create_account_widget.dart';
2021-04-17 11:46:57 +02:00
import 'package:comunic/ui/widgets/login_route_container.dart';
2019-11-02 18:09:34 +01:00
import 'package:comunic/utils/intl_utils.dart';
2019-11-02 18:54:30 +01:00
import 'package:flutter/cupertino.dart';
2019-11-02 18:09:34 +01:00
import 'package:flutter/material.dart';
/// Create account route
///
/// @author Pierre HUBERT
class CreateAccountRoute extends StatelessWidget {
@override
Widget build(BuildContext context) {
2021-04-17 11:46:57 +02:00
return LoginRouteContainer(
2021-04-17 11:16:21 +02:00
child: Scaffold(
appBar: AppBar(
title: Text(tr("Create an account")),
),
body: _CreateAccountRouteBody(),
2021-04-17 10:59:06 +02:00
),
2019-11-02 18:09:34 +01:00
);
}
}
class _CreateAccountRouteBody extends StatefulWidget {
@override
__CreateAccountRouteBodyState createState() =>
__CreateAccountRouteBodyState();
}
class __CreateAccountRouteBodyState extends State<_CreateAccountRouteBody> {
@override
2021-04-17 10:10:31 +02:00
Widget build(BuildContext context) =>
CreateAccountWidget(onCreated: _accountCreated);
2019-11-02 18:54:30 +01: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 11:27:52 +02:00
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: (c) => LoginRoute()));
}
2019-11-02 18:09:34 +01:00
}