Slight login/sighup redesign

This commit is contained in:
Inex Code 2020-06-14 14:14:10 +03:00
parent d4d9a28067
commit 3b42992fa2
3 changed files with 49 additions and 51 deletions

View file

@ -13,7 +13,7 @@ import 'package:flutter/material.dart';
import 'chat_list.dart'; import 'chat_list.dart';
class Login extends StatefulWidget { class Login extends StatefulWidget {
Login({Key key, String this.username: null}) : super(key:key); Login({Key key, String this.username: null}) : super(key: key);
final String username; final String username;
@ -136,14 +136,10 @@ class _LoginState extends State<Login> {
body: Builder(builder: (context) { body: Builder(builder: (context) {
return ListView( return ListView(
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: horizontal: max((MediaQuery.of(context).size.width - 600) / 2, 0),
max((MediaQuery.of(context).size.width - 600) / 2, 0)), vertical: 8.0),
children: <Widget>[ children: <Widget>[
ListTile( ListTile(
leading: CircleAvatar(
child: Icon(Icons.account_box,
color: Theme.of(context).primaryColor),
),
title: TextField( title: TextField(
readOnly: loading, readOnly: loading,
autocorrect: false, autocorrect: false,
@ -151,19 +147,19 @@ class _LoginState extends State<Login> {
onChanged: (t) => _checkWellKnownWithCoolDown(t, context), onChanged: (t) => _checkWellKnownWithCoolDown(t, context),
controller: usernameController, controller: usernameController,
decoration: InputDecoration( decoration: InputDecoration(
icon: Icon(Icons.person_outline),
hintText: hintText:
'@${L10n.of(context).username.toLowerCase()}:domain', '@${L10n.of(context).username.toLowerCase()}:domain',
errorText: usernameError, errorText: usernameError,
labelText: L10n.of(context).username), labelText: L10n.of(context).username,
border: OutlineInputBorder(),
), ),
), ),
),
SizedBox(
height: 10,
),
ListTile( ListTile(
leading: CircleAvatar(
backgroundColor: Theme.of(context).brightness == Brightness.dark
? Color(0xff121212)
: Colors.white,
child: Icon(Icons.lock, color: Theme.of(context).primaryColor),
),
title: TextField( title: TextField(
readOnly: loading, readOnly: loading,
autocorrect: false, autocorrect: false,
@ -172,16 +168,18 @@ class _LoginState extends State<Login> {
obscureText: !showPassword, obscureText: !showPassword,
onSubmitted: (t) => login(context), onSubmitted: (t) => login(context),
decoration: InputDecoration( decoration: InputDecoration(
icon: Icon(Icons.lock_outline),
hintText: '****', hintText: '****',
errorText: passwordError, errorText: passwordError,
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon(showPassword icon: Icon(
? Icons.visibility_off showPassword ? Icons.visibility_off : Icons.visibility),
: Icons.visibility),
onPressed: () => onPressed: () =>
setState(() => showPassword = !showPassword), setState(() => showPassword = !showPassword),
), ),
labelText: L10n.of(context).password), labelText: L10n.of(context).password,
border: OutlineInputBorder(),
),
), ),
), ),
SizedBox(height: 20), SizedBox(height: 20),

View file

@ -86,10 +86,6 @@ class _SignUpState extends State<SignUp> {
horizontal: horizontal:
max((MediaQuery.of(context).size.width - 600) / 2, 0)), max((MediaQuery.of(context).size.width - 600) / 2, 0)),
children: <Widget>[ children: <Widget>[
Hero(
tag: 'loginBanner',
child: Image.asset('assets/fluffychat-banner.png'),
),
ListTile( ListTile(
leading: CircleAvatar( leading: CircleAvatar(
backgroundImage: avatar == null ? null : FileImage(avatar), backgroundImage: avatar == null ? null : FileImage(avatar),
@ -109,9 +105,12 @@ class _SignUpState extends State<SignUp> {
Icons.close, Icons.close,
color: Colors.red, color: Colors.red,
), ),
title: Text(avatar == null title: Padding(
padding: const EdgeInsets.all(11.0),
child: Text(avatar == null
? L10n.of(context).setAProfilePicture ? L10n.of(context).setAProfilePicture
: L10n.of(context).discardPicture), : L10n.of(context).discardPicture),
),
onTap: avatar == null onTap: avatar == null
? setAvatarAction ? setAvatarAction
: () => setState(() => avatar = null), : () => setState(() => avatar = null),
@ -133,7 +132,9 @@ class _SignUpState extends State<SignUp> {
decoration: InputDecoration( decoration: InputDecoration(
hintText: L10n.of(context).username, hintText: L10n.of(context).username,
errorText: usernameError, errorText: usernameError,
labelText: L10n.of(context).chooseAUsername), labelText: L10n.of(context).chooseAUsername,
border: OutlineInputBorder(),
),
), ),
), ),
SizedBox(height: 20), SizedBox(height: 20),

View file

@ -127,11 +127,8 @@ class _SignUpPasswordState extends State<SignUpPassword> {
padding: EdgeInsets.symmetric( padding: EdgeInsets.symmetric(
horizontal: max((MediaQuery.of(context).size.width - 600) / 2, 0)), horizontal: max((MediaQuery.of(context).size.width - 600) / 2, 0)),
children: <Widget>[ children: <Widget>[
SizedBox(height: 10),
ListTile( ListTile(
leading: CircleAvatar(
backgroundColor: Colors.white,
child: Icon(Icons.lock, color: Theme.of(context).primaryColor),
),
title: TextField( title: TextField(
controller: passwordController, controller: passwordController,
obscureText: !showPassword, obscureText: !showPassword,
@ -139,15 +136,17 @@ class _SignUpPasswordState extends State<SignUpPassword> {
autocorrect: false, autocorrect: false,
onSubmitted: (t) => _signUpAction(context), onSubmitted: (t) => _signUpAction(context),
decoration: InputDecoration( decoration: InputDecoration(
icon: Icon(Icons.lock_outline),
hintText: '****', hintText: '****',
errorText: passwordError, errorText: passwordError,
suffixIcon: IconButton( suffixIcon: IconButton(
icon: Icon( icon: Icon(
showPassword ? Icons.visibility_off : Icons.visibility), showPassword ? Icons.visibility_off : Icons.visibility),
onPressed: () => onPressed: () => setState(() => showPassword = !showPassword),
setState(() => showPassword = !showPassword), ),
labelText: L10n.of(context).password,
border: OutlineInputBorder(),
), ),
labelText: L10n.of(context).password),
), ),
), ),
SizedBox(height: 20), SizedBox(height: 20),