Login page design improvements (#26)
the build failed Details

This commit is contained in:
konrad 2019-03-14 21:12:02 +00:00 committed by Gitea
parent cb360f656f
commit ae197684ac
4 changed files with 94 additions and 92 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 58 KiB

View File

@ -19,88 +19,95 @@ class _LoginPageState extends State<LoginPage> {
@override @override
Widget build(BuildContext ctx) { Widget build(BuildContext ctx) {
return Scaffold( return Scaffold(
appBar: AppBar( body: Center(
title: Text('Login to Vikunja'), child: SingleChildScrollView(
), padding: const EdgeInsets.all(16.0),
body: Builder( child: Builder(
builder: (BuildContext context) => SafeArea( builder: (BuildContext context) => Form(
top: false, autovalidate: true,
bottom: false, key: _formKey,
child: Form( child: Center(
autovalidate: true, child: Column(
key: _formKey, mainAxisAlignment: MainAxisAlignment.center,
child: ListView( crossAxisAlignment: CrossAxisAlignment.center,
padding: const EdgeInsets.symmetric(horizontal: 16.0), children: <Widget>[
children: <Widget>[ Padding(
Padding( padding: EdgeInsets.symmetric(vertical: 30),
padding: vStandardVerticalPadding, child: Image(
child: Image( image: AssetImage('assets/vikunja_logo_full.png'),
image: AssetImage('assets/vikunja_logo.png'), height: 85.0,
height: 128.0, semanticLabel: 'Vikunja Logo',
semanticLabel: 'Vikunja Logo', ),
), ),
), Padding(
Padding( padding: vStandardVerticalPadding,
padding: vStandardVerticalPadding, child: TextFormField(
child: TextFormField( enabled: !_loading,
onSaved: (serverAddress) => _server = serverAddress, onSaved: (serverAddress) =>
validator: (address) { _server = serverAddress,
return isUrl(address) ? null : 'Invalid URL'; validator: (address) {
}, return isUrl(address)
decoration: new InputDecoration( ? null
border: OutlineInputBorder(), : 'Invalid URL';
labelText: 'Server Address'), },
), decoration: new InputDecoration(
), border: OutlineInputBorder(),
Padding( labelText: 'Server Address'),
padding: vStandardVerticalPadding, ),
child: TextFormField( ),
onSaved: (username) => _username = username, Padding(
decoration: padding: vStandardVerticalPadding,
new InputDecoration( child: TextFormField(
border: OutlineInputBorder(), enabled: !_loading,
labelText: 'Username'), onSaved: (username) => _username = username,
), decoration: new InputDecoration(
), border: OutlineInputBorder(),
Padding( labelText: 'Username'),
padding: vStandardVerticalPadding, ),
child: TextFormField( ),
onSaved: (password) => _password = password, Padding(
decoration: padding: vStandardVerticalPadding,
new InputDecoration( child: TextFormField(
border: OutlineInputBorder(), enabled: !_loading,
labelText: 'Password'), onSaved: (password) => _password = password,
obscureText: true, decoration: new InputDecoration(
), border: OutlineInputBorder(),
), labelText: 'Password'),
Builder( obscureText: true,
builder: (context) => FancyButton( ),
onPressed: !_loading ),
? () { Builder(
if (_formKey.currentState builder: (context) => FancyButton(
.validate()) { onPressed: !_loading
Form.of(context).save(); ? () {
_loginUser(context); if (_formKey.currentState
} .validate()) {
} Form.of(context).save();
: null, _loginUser(context);
child: _loading }
? CircularProgressIndicator() }
: VikunjaButtonText('Login'), : null,
)), child: _loading
Builder( ? CircularProgressIndicator()
builder: (context) => FancyButton( : VikunjaButtonText('Login'),
onPressed: () => Navigator.push( )),
context, Builder(
MaterialPageRoute( builder: (context) => FancyButton(
builder: (context) => onPressed: () => Navigator.push(
RegisterPage())), context,
child: VikunjaButtonText('Register'), MaterialPageRoute(
)), builder: (context) =>
], RegisterPage())),
)), child: VikunjaButtonText('Register'),
)),
],
),
), ),
)); ),
),
),
),
);
} }
_loginUser(BuildContext context) async { _loginUser(BuildContext context) async {
@ -114,7 +121,9 @@ class _LoginPageState extends State<LoginPage> {
showDialog( showDialog(
context: context, context: context,
builder: (context) => new AlertDialog( builder: (context) => new AlertDialog(
title: Text('Login failed! Please check your server url and credentials. ' + ex.toString()), title: Text(
'Login failed! Please check your server url and credentials. ' +
ex.toString()),
actions: <Widget>[ actions: <Widget>[
FlatButton( FlatButton(
onPressed: () => Navigator.pop(context), onPressed: () => Navigator.pop(context),

View File

@ -20,7 +20,7 @@ class _RegisterPageState extends State<RegisterPage> {
Widget build(BuildContext ctx) { Widget build(BuildContext ctx) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Register to Vikunja'), title: Text('Register'),
), ),
body: Builder( body: Builder(
builder: (BuildContext context) => SafeArea( builder: (BuildContext context) => SafeArea(
@ -29,16 +29,8 @@ class _RegisterPageState extends State<RegisterPage> {
child: Form( child: Form(
key: _formKey, key: _formKey,
child: ListView( child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0), padding: const EdgeInsets.all(16),
children: <Widget>[ children: <Widget>[
Padding(
padding: vStandardVerticalPadding,
child: Image(
image: AssetImage('assets/vikunja_logo.png'),
height: 128.0,
semanticLabel: 'Vikunja Logo',
),
),
Padding( Padding(
padding: vStandardVerticalPadding, padding: vStandardVerticalPadding,
child: TextFormField( child: TextFormField(

View File

@ -34,6 +34,7 @@ flutter:
assets: assets:
- assets/graphics/hypnotize.png - assets/graphics/hypnotize.png
- assets/vikunja_logo.png - assets/vikunja_logo.png
- assets/vikunja_logo_full.png
fonts: fonts:
- family: Quicksand - family: Quicksand
fonts: fonts: