mirror of
https://gitlab.com/comunic/comunicmobile
synced 2024-11-25 22:39:22 +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/ui/widgets/create_account_widget.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
import 'package:flutter/cupertino.dart';
|
import 'package:flutter/cupertino.dart';
|
||||||
@ -11,10 +12,52 @@ class CreateAccountRoute extends StatelessWidget {
|
|||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Scaffold(
|
||||||
|
backgroundColor: Config.get().splashBackgroundColor,
|
||||||
appBar: AppBar(
|
appBar: AppBar(
|
||||||
|
backgroundColor: Colors.transparent,
|
||||||
|
elevation: 0,
|
||||||
title: Text(tr("Create an account")),
|
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/create_account_route.dart';
|
||||||
import 'package:comunic/ui/routes/forgot_password_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_scaffold.dart';
|
||||||
import 'package:comunic/ui/widgets/login_widget.dart';
|
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@ -10,12 +8,12 @@ import 'package:flutter/material.dart';
|
|||||||
///
|
///
|
||||||
/// @author Pierre HUBERT
|
/// @author Pierre HUBERT
|
||||||
|
|
||||||
class LoginRoute extends StatefulWidget {
|
class WelcomeRoute extends StatefulWidget {
|
||||||
@override
|
@override
|
||||||
State<StatefulWidget> createState() => _LoginRouteState();
|
State<StatefulWidget> createState() => _WelcomeRouteState();
|
||||||
}
|
}
|
||||||
|
|
||||||
class _LoginRouteState extends State<LoginRoute> {
|
class _WelcomeRouteState extends State<WelcomeRoute> {
|
||||||
void _openCreateAccountPage() {
|
void _openCreateAccountPage() {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.push(MaterialPageRoute(builder: (c) => CreateAccountRoute()));
|
.push(MaterialPageRoute(builder: (c) => CreateAccountRoute()));
|
||||||
@ -28,36 +26,27 @@ class _LoginRouteState extends State<LoginRoute> {
|
|||||||
|
|
||||||
/// Build login form
|
/// Build login form
|
||||||
Widget _buildLoginForm() {
|
Widget _buildLoginForm() {
|
||||||
return SingleChildScrollView(
|
return Material(
|
||||||
child: Padding(
|
color: Colors.transparent,
|
||||||
padding: const EdgeInsets.all(8.0),
|
|
||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
LoginWidget(
|
ListTile(
|
||||||
onSignedIn: () => Navigator.pushReplacement(context,
|
leading: Icon(Icons.login, color: Colors.white),
|
||||||
MaterialPageRoute(builder: (b) => InitializeWidget())),
|
title: Text(tr("Login")),
|
||||||
),
|
|
||||||
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.person_add_alt_1, color: Colors.white),
|
||||||
|
title: Text(tr("Join the network")),
|
||||||
|
onTap: _openCreateAccountPage,
|
||||||
|
)
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@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,
|
obscureText: isPassword,
|
||||||
maxLength: maxLength,
|
maxLength: maxLength,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
|
counterText: "",
|
||||||
alignLabelWithHint: true,
|
alignLabelWithHint: true,
|
||||||
errorText: error,
|
errorText: error,
|
||||||
labelText: label,
|
labelText: label,
|
||||||
|
@ -59,7 +59,7 @@ class _InitializeWidgetState extends SafeState<InitializeWidget> {
|
|||||||
/// Open login page
|
/// Open login page
|
||||||
_openLoginPage() {
|
_openLoginPage() {
|
||||||
Navigator.of(context)
|
Navigator.of(context)
|
||||||
.pushReplacement(MaterialPageRoute(builder: (c) => LoginRoute()));
|
.pushReplacement(MaterialPageRoute(builder: (c) => WelcomeRoute()));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Try to connect to server
|
/// Try to connect to server
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:comunic/models/config.dart';
|
||||||
import 'package:comunic/utils/intl_utils.dart';
|
import 'package:comunic/utils/intl_utils.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
@ -7,9 +8,10 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
class LoginScaffold extends StatelessWidget {
|
class LoginScaffold extends StatelessWidget {
|
||||||
final Widget child;
|
final Widget child;
|
||||||
|
final Widget noStyleChild;
|
||||||
|
|
||||||
const LoginScaffold({Key key, @required this.child})
|
const LoginScaffold({Key key, @required this.child, this.noStyleChild})
|
||||||
: assert(child != null),
|
: assert(child != null || noStyleChild != null),
|
||||||
super(key: key);
|
super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -34,7 +36,7 @@ class LoginScaffold extends StatelessWidget {
|
|||||||
fillColor: Colors.white,
|
fillColor: Colors.white,
|
||||||
hoverColor: Colors.white,
|
hoverColor: Colors.white,
|
||||||
),
|
),
|
||||||
scaffoldBackgroundColor: Colors.indigo.shade900,
|
scaffoldBackgroundColor: Config.get().splashBackgroundColor,
|
||||||
textTheme: TextTheme(
|
textTheme: TextTheme(
|
||||||
bodyText2: TextStyle(color: Colors.white),
|
bodyText2: TextStyle(color: Colors.white),
|
||||||
button: TextStyle(color: Colors.white),
|
button: TextStyle(color: Colors.white),
|
||||||
@ -50,18 +52,26 @@ class LoginScaffold extends StatelessWidget {
|
|||||||
child: Column(
|
child: Column(
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Spacer(flex: 3),
|
Spacer(flex: 3),
|
||||||
Text("Comunic", style: TextStyle(fontSize: 50)),
|
Text("Comunic",
|
||||||
|
textAlign: TextAlign.center,
|
||||||
|
style: TextStyle(fontSize: 50)),
|
||||||
Spacer(flex: 1),
|
Spacer(flex: 1),
|
||||||
Text(tr("Free social network that respect your privacy")),
|
Text(
|
||||||
Spacer(flex: 1),
|
tr("Free social network that respect your privacy"),
|
||||||
Padding(
|
textAlign: TextAlign.center,
|
||||||
|
),
|
||||||
|
Spacer(flex: 3),
|
||||||
|
child != null
|
||||||
|
? Padding(
|
||||||
padding: const EdgeInsets.all(8.0),
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Material(
|
child: Material(
|
||||||
child: child,
|
child: child,
|
||||||
color: Colors.indigo.shade500,
|
color: Colors.indigo.shade500,
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
Spacer(flex: 5),
|
: Container(),
|
||||||
|
noStyleChild ?? Container(),
|
||||||
|
Spacer(flex: 3),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
Loading…
Reference in New Issue
Block a user