Slight login/sighup redesign
This commit is contained in:
parent
d4d9a28067
commit
3b42992fa2
|
@ -13,7 +13,7 @@ import 'package:flutter/material.dart';
|
|||
import 'chat_list.dart';
|
||||
|
||||
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;
|
||||
|
||||
|
@ -105,7 +105,7 @@ class _LoginState extends State<Login> {
|
|||
}
|
||||
}
|
||||
|
||||
@override
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
usernameController.text = widget?.username;
|
||||
|
@ -136,14 +136,10 @@ class _LoginState extends State<Login> {
|
|||
body: Builder(builder: (context) {
|
||||
return ListView(
|
||||
padding: EdgeInsets.symmetric(
|
||||
horizontal:
|
||||
max((MediaQuery.of(context).size.width - 600) / 2, 0)),
|
||||
horizontal: max((MediaQuery.of(context).size.width - 600) / 2, 0),
|
||||
vertical: 8.0),
|
||||
children: <Widget>[
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
child: Icon(Icons.account_box,
|
||||
color: Theme.of(context).primaryColor),
|
||||
),
|
||||
title: TextField(
|
||||
readOnly: loading,
|
||||
autocorrect: false,
|
||||
|
@ -151,19 +147,19 @@ class _LoginState extends State<Login> {
|
|||
onChanged: (t) => _checkWellKnownWithCoolDown(t, context),
|
||||
controller: usernameController,
|
||||
decoration: InputDecoration(
|
||||
hintText:
|
||||
'@${L10n.of(context).username.toLowerCase()}:domain',
|
||||
errorText: usernameError,
|
||||
labelText: L10n.of(context).username),
|
||||
icon: Icon(Icons.person_outline),
|
||||
hintText:
|
||||
'@${L10n.of(context).username.toLowerCase()}:domain',
|
||||
errorText: usernameError,
|
||||
labelText: L10n.of(context).username,
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
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(
|
||||
readOnly: loading,
|
||||
autocorrect: false,
|
||||
|
@ -172,16 +168,18 @@ class _LoginState extends State<Login> {
|
|||
obscureText: !showPassword,
|
||||
onSubmitted: (t) => login(context),
|
||||
decoration: InputDecoration(
|
||||
hintText: '****',
|
||||
errorText: passwordError,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(showPassword
|
||||
? Icons.visibility_off
|
||||
: Icons.visibility),
|
||||
onPressed: () =>
|
||||
setState(() => showPassword = !showPassword),
|
||||
),
|
||||
labelText: L10n.of(context).password),
|
||||
icon: Icon(Icons.lock_outline),
|
||||
hintText: '****',
|
||||
errorText: passwordError,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
showPassword ? Icons.visibility_off : Icons.visibility),
|
||||
onPressed: () =>
|
||||
setState(() => showPassword = !showPassword),
|
||||
),
|
||||
labelText: L10n.of(context).password,
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
|
|
|
@ -86,10 +86,6 @@ class _SignUpState extends State<SignUp> {
|
|||
horizontal:
|
||||
max((MediaQuery.of(context).size.width - 600) / 2, 0)),
|
||||
children: <Widget>[
|
||||
Hero(
|
||||
tag: 'loginBanner',
|
||||
child: Image.asset('assets/fluffychat-banner.png'),
|
||||
),
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundImage: avatar == null ? null : FileImage(avatar),
|
||||
|
@ -109,9 +105,12 @@ class _SignUpState extends State<SignUp> {
|
|||
Icons.close,
|
||||
color: Colors.red,
|
||||
),
|
||||
title: Text(avatar == null
|
||||
? L10n.of(context).setAProfilePicture
|
||||
: L10n.of(context).discardPicture),
|
||||
title: Padding(
|
||||
padding: const EdgeInsets.all(11.0),
|
||||
child: Text(avatar == null
|
||||
? L10n.of(context).setAProfilePicture
|
||||
: L10n.of(context).discardPicture),
|
||||
),
|
||||
onTap: avatar == null
|
||||
? setAvatarAction
|
||||
: () => setState(() => avatar = null),
|
||||
|
@ -131,9 +130,11 @@ class _SignUpState extends State<SignUp> {
|
|||
controller: usernameController,
|
||||
onSubmitted: (s) => signUpAction(context),
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.of(context).username,
|
||||
errorText: usernameError,
|
||||
labelText: L10n.of(context).chooseAUsername),
|
||||
hintText: L10n.of(context).username,
|
||||
errorText: usernameError,
|
||||
labelText: L10n.of(context).chooseAUsername,
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
|
|
|
@ -127,11 +127,8 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
|||
padding: EdgeInsets.symmetric(
|
||||
horizontal: max((MediaQuery.of(context).size.width - 600) / 2, 0)),
|
||||
children: <Widget>[
|
||||
SizedBox(height: 10),
|
||||
ListTile(
|
||||
leading: CircleAvatar(
|
||||
backgroundColor: Colors.white,
|
||||
child: Icon(Icons.lock, color: Theme.of(context).primaryColor),
|
||||
),
|
||||
title: TextField(
|
||||
controller: passwordController,
|
||||
obscureText: !showPassword,
|
||||
|
@ -139,15 +136,17 @@ class _SignUpPasswordState extends State<SignUpPassword> {
|
|||
autocorrect: false,
|
||||
onSubmitted: (t) => _signUpAction(context),
|
||||
decoration: InputDecoration(
|
||||
hintText: '****',
|
||||
errorText: passwordError,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
showPassword ? Icons.visibility_off : Icons.visibility),
|
||||
onPressed: () =>
|
||||
setState(() => showPassword = !showPassword),
|
||||
),
|
||||
labelText: L10n.of(context).password),
|
||||
icon: Icon(Icons.lock_outline),
|
||||
hintText: '****',
|
||||
errorText: passwordError,
|
||||
suffixIcon: IconButton(
|
||||
icon: Icon(
|
||||
showPassword ? Icons.visibility_off : Icons.visibility),
|
||||
onPressed: () => setState(() => showPassword = !showPassword),
|
||||
),
|
||||
labelText: L10n.of(context).password,
|
||||
border: OutlineInputBorder(),
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(height: 20),
|
||||
|
|
Loading…
Reference in a new issue