1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2024-11-22 21:09:21 +00:00

Improve login route

This commit is contained in:
Pierre HUBERT 2020-05-04 19:05:21 +02:00
parent 0c2f3a28d0
commit e3c9105b1c
2 changed files with 61 additions and 8 deletions

View File

@ -3,6 +3,7 @@ import 'package:comunic/models/authentication_details.dart';
import 'package:comunic/ui/routes/create_account_route.dart';
import 'package:comunic/ui/routes/reset_password_route.dart';
import 'package:comunic/ui/widgets/init_widget.dart';
import 'package:comunic/ui/widgets/login_scaffold.dart';
import 'package:comunic/utils/input_utils.dart';
import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
@ -96,7 +97,6 @@ class _LoginRouteState extends State<LoginRoute> {
padding: const EdgeInsets.all(8.0),
child: Column(
children: <Widget>[
Text(tr("Please sign into your Comunic account: ")),
Container(
child: _buildErrorCard(),
),
@ -136,7 +136,7 @@ class _LoginRouteState extends State<LoginRoute> {
InkWell(
child: Text(
tr("Create an account"),
style: TextStyle(color: Colors.blue),
style: TextStyle(color: Colors.blue.shade100),
),
onTap: () => _openCreateAccountPage(),
),
@ -146,7 +146,7 @@ class _LoginRouteState extends State<LoginRoute> {
InkWell(
child: Text(
tr("Password forgotten"),
style: TextStyle(color: Colors.blue),
style: TextStyle(color: Colors.blue.shade100),
),
onTap: _openResetPasswordPage,
),
@ -158,10 +158,6 @@ class _LoginRouteState extends State<LoginRoute> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Comunic"),
),
body: _buildLoginForm());
return LoginScaffold(child: _buildLoginForm());
}
}

View File

@ -0,0 +1,57 @@
import 'package:comunic/utils/intl_utils.dart';
import 'package:flutter/material.dart';
/// Custom "Scaffold" for signed out users
///
/// @author Pierre Hubert
class LoginScaffold extends StatelessWidget {
final Widget child;
const LoginScaffold({Key key, @required this.child})
: assert(child != null),
super(key: key);
@override
Widget build(BuildContext context) {
final mediaQuery = MediaQuery.of(context);
final availableHeight =
mediaQuery.size.height - mediaQuery.viewInsets.bottom;
final minHeight = 400.0;
final contentHeight =
availableHeight < minHeight ? minHeight : availableHeight;
return Scaffold(
body: SingleChildScrollView(
child: Center(
child: Container(
height: contentHeight,
child: ConstrainedBox(
constraints: BoxConstraints(maxWidth: 300),
child: Column(
children: <Widget>[
Spacer(flex: 3),
Text("Comunic", 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,
),
),
Spacer(flex: 5),
],
),
),
),
),
),
backgroundColor: Colors.indigo.shade900,
);
}
}