diff --git a/lib/ui/routes/create_account_route.dart b/lib/ui/routes/create_account_route.dart index 989dda7..2fd8e9a 100644 --- a/lib/ui/routes/create_account_route.dart +++ b/lib/ui/routes/create_account_route.dart @@ -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(), + ), ); } } diff --git a/lib/ui/routes/login_route.dart b/lib/ui/routes/login_route.dart index 7204f10..80e5c00 100644 --- a/lib/ui/routes/login_route.dart +++ b/lib/ui/routes/login_route.dart @@ -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 createState() => _LoginRouteState(); + State createState() => _WelcomeRouteState(); } -class _LoginRouteState extends State { +class _WelcomeRouteState extends State { void _openCreateAccountPage() { Navigator.of(context) .push(MaterialPageRoute(builder: (c) => CreateAccountRoute())); @@ -28,36 +26,27 @@ class _LoginRouteState extends State { /// Build login form Widget _buildLoginForm() { - return SingleChildScrollView( - child: Padding( - padding: const EdgeInsets.all(8.0), - child: Column( - children: [ - 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, - ), - ], - ), + return Material( + color: Colors.transparent, + child: Column( + children: [ + 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(), + ); } diff --git a/lib/ui/widgets/create_account_widget.dart b/lib/ui/widgets/create_account_widget.dart index 4fb3595..4e3cf2c 100644 --- a/lib/ui/widgets/create_account_widget.dart +++ b/lib/ui/widgets/create_account_widget.dart @@ -278,6 +278,7 @@ class _InputEntry extends StatelessWidget { obscureText: isPassword, maxLength: maxLength, decoration: InputDecoration( + counterText: "", alignLabelWithHint: true, errorText: error, labelText: label, diff --git a/lib/ui/widgets/init_widget.dart b/lib/ui/widgets/init_widget.dart index 8747738..a251202 100644 --- a/lib/ui/widgets/init_widget.dart +++ b/lib/ui/widgets/init_widget.dart @@ -59,7 +59,7 @@ class _InitializeWidgetState extends SafeState { /// Open login page _openLoginPage() { Navigator.of(context) - .pushReplacement(MaterialPageRoute(builder: (c) => LoginRoute())); + .pushReplacement(MaterialPageRoute(builder: (c) => WelcomeRoute())); } /// Try to connect to server diff --git a/lib/ui/widgets/login_scaffold.dart b/lib/ui/widgets/login_scaffold.dart index b02b7a9..9aa58bc 100644 --- a/lib/ui/widgets/login_scaffold.dart +++ b/lib/ui/widgets/login_scaffold.dart @@ -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: [ 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( - padding: const EdgeInsets.all(8.0), - child: Material( - child: child, - color: Colors.indigo.shade500, - ), + Text( + tr("Free social network that respect your privacy"), + textAlign: TextAlign.center, ), - Spacer(flex: 5), + Spacer(flex: 3), + child != null + ? Padding( + padding: const EdgeInsets.all(8.0), + child: Material( + child: child, + color: Colors.indigo.shade500, + ), + ) + : Container(), + noStyleChild ?? Container(), + Spacer(flex: 3), ], ), ),