mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-22 04:49:21 +00:00
Improve signup route
This commit is contained in:
parent
9555d35521
commit
ab60593f12
@ -1,3 +1,4 @@
|
||||
import 'package:comunic/models/config.dart';
|
||||
import 'package:comunic/ui/widgets/create_account_widget.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/cupertino.dart';
|
||||
@ -11,10 +12,52 @@ class CreateAccountRoute extends StatelessWidget {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
backgroundColor: Config.get().splashBackgroundColor,
|
||||
appBar: AppBar(
|
||||
backgroundColor: Colors.transparent,
|
||||
elevation: 0,
|
||||
title: Text(tr("Create an account")),
|
||||
),
|
||||
body: _CreateAccountRouteBody(),
|
||||
body: Theme(
|
||||
data: Theme.of(context).copyWith(
|
||||
iconTheme: IconThemeData(color: Colors.white),
|
||||
inputDecorationTheme: InputDecorationTheme(
|
||||
fillColor: Colors.white,
|
||||
hintStyle: TextStyle(color: Colors.white),
|
||||
labelStyle: TextStyle(color: Colors.white),
|
||||
prefixStyle: TextStyle(color: Colors.white),
|
||||
hoverColor: Colors.white,
|
||||
errorStyle: TextStyle(color: Colors.deepOrangeAccent),
|
||||
),
|
||||
checkboxTheme: CheckboxThemeData(
|
||||
fillColor: MaterialStateProperty.all(Colors.white),
|
||||
checkColor:
|
||||
MaterialStateProperty.all(Config.get().splashBackgroundColor),
|
||||
),
|
||||
primaryColor: Colors.white,
|
||||
backgroundColor: Config.get().splashBackgroundColor,
|
||||
disabledColor: Colors.grey,
|
||||
highlightColor: Colors.white,
|
||||
accentColor: Colors.white,
|
||||
hintColor: Colors.white,
|
||||
textTheme: TextTheme(subtitle1: TextStyle(color: Colors.white)),
|
||||
colorScheme: ColorScheme(
|
||||
primary: Colors.white,
|
||||
primaryVariant: Colors.white,
|
||||
secondary: Colors.white,
|
||||
secondaryVariant: Colors.white,
|
||||
surface: Config.get().splashBackgroundColor,
|
||||
background: Config.get().splashBackgroundColor,
|
||||
error: Colors.redAccent,
|
||||
onPrimary: Config.get().splashBackgroundColor,
|
||||
onSecondary: Config.get().splashBackgroundColor,
|
||||
onSurface: Colors.white,
|
||||
onBackground: Colors.white,
|
||||
onError: Colors.redAccent,
|
||||
brightness: Brightness.dark,
|
||||
)),
|
||||
child: _CreateAccountRouteBody(),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1,8 +1,6 @@
|
||||
import 'package:comunic/ui/routes/create_account_route.dart';
|
||||
import 'package:comunic/ui/routes/forgot_password_route.dart';
|
||||
import 'package:comunic/ui/widgets/init_widget.dart';
|
||||
import 'package:comunic/ui/widgets/login_scaffold.dart';
|
||||
import 'package:comunic/ui/widgets/login_widget.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -10,12 +8,12 @@ import 'package:flutter/material.dart';
|
||||
///
|
||||
/// @author Pierre HUBERT
|
||||
|
||||
class LoginRoute extends StatefulWidget {
|
||||
class WelcomeRoute extends StatefulWidget {
|
||||
@override
|
||||
State<StatefulWidget> createState() => _LoginRouteState();
|
||||
State<StatefulWidget> createState() => _WelcomeRouteState();
|
||||
}
|
||||
|
||||
class _LoginRouteState extends State<LoginRoute> {
|
||||
class _WelcomeRouteState extends State<WelcomeRoute> {
|
||||
void _openCreateAccountPage() {
|
||||
Navigator.of(context)
|
||||
.push(MaterialPageRoute(builder: (c) => CreateAccountRoute()));
|
||||
@ -28,36 +26,27 @@ class _LoginRouteState extends State<LoginRoute> {
|
||||
|
||||
/// Build login form
|
||||
Widget _buildLoginForm() {
|
||||
return SingleChildScrollView(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
return Material(
|
||||
color: Colors.transparent,
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
LoginWidget(
|
||||
onSignedIn: () => Navigator.pushReplacement(context,
|
||||
MaterialPageRoute(builder: (b) => InitializeWidget())),
|
||||
),
|
||||
InkWell(
|
||||
child: Text(
|
||||
tr("Create an account"),
|
||||
style: TextStyle(color: Colors.blue.shade100),
|
||||
),
|
||||
onTap: () => _openCreateAccountPage(),
|
||||
),
|
||||
Container(height: 10),
|
||||
InkWell(
|
||||
child: Text(
|
||||
tr("Password forgotten"),
|
||||
style: TextStyle(color: Colors.blue.shade100),
|
||||
),
|
||||
onTap: _openResetPasswordPage,
|
||||
ListTile(
|
||||
leading: Icon(Icons.login, color: Colors.white),
|
||||
title: Text(tr("Login")),
|
||||
),
|
||||
ListTile(
|
||||
leading: Icon(Icons.person_add_alt_1, color: Colors.white),
|
||||
title: Text(tr("Join the network")),
|
||||
onTap: _openCreateAccountPage,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => LoginScaffold(child: _buildLoginForm());
|
||||
Widget build(BuildContext context) => LoginScaffold(
|
||||
child: null,
|
||||
noStyleChild: _buildLoginForm(),
|
||||
);
|
||||
}
|
||||
|
@ -278,6 +278,7 @@ class _InputEntry extends StatelessWidget {
|
||||
obscureText: isPassword,
|
||||
maxLength: maxLength,
|
||||
decoration: InputDecoration(
|
||||
counterText: "",
|
||||
alignLabelWithHint: true,
|
||||
errorText: error,
|
||||
labelText: label,
|
||||
|
@ -59,7 +59,7 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
|
||||
/// Open login page
|
||||
_openLoginPage() {
|
||||
Navigator.of(context)
|
||||
.pushReplacement(MaterialPageRoute(builder: (c) => LoginRoute()));
|
||||
.pushReplacement(MaterialPageRoute(builder: (c) => WelcomeRoute()));
|
||||
}
|
||||
|
||||
/// Try to connect to server
|
||||
|
@ -1,3 +1,4 @@
|
||||
import 'package:comunic/models/config.dart';
|
||||
import 'package:comunic/utils/intl_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
@ -7,9 +8,10 @@ import 'package:flutter/material.dart';
|
||||
|
||||
class LoginScaffold extends StatelessWidget {
|
||||
final Widget child;
|
||||
final Widget noStyleChild;
|
||||
|
||||
const LoginScaffold({Key key, @required this.child})
|
||||
: assert(child != null),
|
||||
const LoginScaffold({Key key, @required this.child, this.noStyleChild})
|
||||
: assert(child != null || noStyleChild != null),
|
||||
super(key: key);
|
||||
|
||||
@override
|
||||
@ -34,7 +36,7 @@ class LoginScaffold extends StatelessWidget {
|
||||
fillColor: Colors.white,
|
||||
hoverColor: Colors.white,
|
||||
),
|
||||
scaffoldBackgroundColor: Colors.indigo.shade900,
|
||||
scaffoldBackgroundColor: Config.get().splashBackgroundColor,
|
||||
textTheme: TextTheme(
|
||||
bodyText2: TextStyle(color: Colors.white),
|
||||
button: TextStyle(color: Colors.white),
|
||||
@ -50,18 +52,26 @@ class LoginScaffold extends StatelessWidget {
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
Spacer(flex: 3),
|
||||
Text("Comunic", style: TextStyle(fontSize: 50)),
|
||||
Text("Comunic",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(fontSize: 50)),
|
||||
Spacer(flex: 1),
|
||||
Text(tr("Free social network that respect your privacy")),
|
||||
Spacer(flex: 1),
|
||||
Padding(
|
||||
Text(
|
||||
tr("Free social network that respect your privacy"),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Spacer(flex: 3),
|
||||
child != null
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(8.0),
|
||||
child: Material(
|
||||
child: child,
|
||||
color: Colors.indigo.shade500,
|
||||
),
|
||||
),
|
||||
Spacer(flex: 5),
|
||||
)
|
||||
: Container(),
|
||||
noStyleChild ?? Container(),
|
||||
Spacer(flex: 3),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user