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';
|
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;
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ class _LoginState extends State<Login> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
usernameController.text = widget?.username;
|
usernameController.text = widget?.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(
|
||||||
hintText:
|
icon: Icon(Icons.person_outline),
|
||||||
'@${L10n.of(context).username.toLowerCase()}:domain',
|
hintText:
|
||||||
errorText: usernameError,
|
'@${L10n.of(context).username.toLowerCase()}:domain',
|
||||||
labelText: L10n.of(context).username),
|
errorText: usernameError,
|
||||||
|
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(
|
||||||
hintText: '****',
|
icon: Icon(Icons.lock_outline),
|
||||||
errorText: passwordError,
|
hintText: '****',
|
||||||
suffixIcon: IconButton(
|
errorText: passwordError,
|
||||||
icon: Icon(showPassword
|
suffixIcon: IconButton(
|
||||||
? Icons.visibility_off
|
icon: Icon(
|
||||||
: Icons.visibility),
|
showPassword ? Icons.visibility_off : 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),
|
||||||
|
|
|
@ -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(
|
||||||
? L10n.of(context).setAProfilePicture
|
padding: const EdgeInsets.all(11.0),
|
||||||
: L10n.of(context).discardPicture),
|
child: Text(avatar == null
|
||||||
|
? L10n.of(context).setAProfilePicture
|
||||||
|
: L10n.of(context).discardPicture),
|
||||||
|
),
|
||||||
onTap: avatar == null
|
onTap: avatar == null
|
||||||
? setAvatarAction
|
? setAvatarAction
|
||||||
: () => setState(() => avatar = null),
|
: () => setState(() => avatar = null),
|
||||||
|
@ -131,9 +130,11 @@ class _SignUpState extends State<SignUp> {
|
||||||
controller: usernameController,
|
controller: usernameController,
|
||||||
onSubmitted: (s) => signUpAction(context),
|
onSubmitted: (s) => signUpAction(context),
|
||||||
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),
|
||||||
|
|
|
@ -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(
|
||||||
hintText: '****',
|
icon: Icon(Icons.lock_outline),
|
||||||
errorText: passwordError,
|
hintText: '****',
|
||||||
suffixIcon: IconButton(
|
errorText: passwordError,
|
||||||
icon: Icon(
|
suffixIcon: IconButton(
|
||||||
showPassword ? Icons.visibility_off : Icons.visibility),
|
icon: Icon(
|
||||||
onPressed: () =>
|
showPassword ? Icons.visibility_off : Icons.visibility),
|
||||||
setState(() => showPassword = !showPassword),
|
onPressed: () => setState(() => showPassword = !showPassword),
|
||||||
),
|
),
|
||||||
labelText: L10n.of(context).password),
|
labelText: L10n.of(context).password,
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
SizedBox(height: 20),
|
SizedBox(height: 20),
|
||||||
|
|
Loading…
Reference in a new issue