mirror of
				https://gitlab.com/comunic/comunicmobile
				synced 2025-11-04 12:14:11 +00:00 
			
		
		
		
	Improve signup route
This commit is contained in:
		@@ -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),
 | 
			
		||||
        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,
 | 
			
		||||
            ),
 | 
			
		||||
          ],
 | 
			
		||||
        ),
 | 
			
		||||
    return Material(
 | 
			
		||||
      color: Colors.transparent,
 | 
			
		||||
      child: Column(
 | 
			
		||||
        children: <Widget>[
 | 
			
		||||
          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(),
 | 
			
		||||
      );
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user