diff --git a/assets/vikunja_logo_full.png b/assets/vikunja_logo_full.png new file mode 100644 index 0000000..57e4652 Binary files /dev/null and b/assets/vikunja_logo_full.png differ diff --git a/lib/pages/login_page.dart b/lib/pages/login_page.dart index 4d0673a..ab718b0 100644 --- a/lib/pages/login_page.dart +++ b/lib/pages/login_page.dart @@ -19,88 +19,95 @@ class _LoginPageState extends State { @override Widget build(BuildContext ctx) { return Scaffold( - appBar: AppBar( - title: Text('Login to Vikunja'), - ), - body: Builder( - builder: (BuildContext context) => SafeArea( - top: false, - bottom: false, - child: Form( - autovalidate: true, - key: _formKey, - child: ListView( - padding: const EdgeInsets.symmetric(horizontal: 16.0), - children: [ - Padding( - padding: vStandardVerticalPadding, - child: Image( - image: AssetImage('assets/vikunja_logo.png'), - height: 128.0, - semanticLabel: 'Vikunja Logo', - ), - ), - Padding( - padding: vStandardVerticalPadding, - child: TextFormField( - onSaved: (serverAddress) => _server = serverAddress, - validator: (address) { - return isUrl(address) ? null : 'Invalid URL'; - }, - decoration: new InputDecoration( - border: OutlineInputBorder(), - labelText: 'Server Address'), - ), - ), - Padding( - padding: vStandardVerticalPadding, - child: TextFormField( - onSaved: (username) => _username = username, - decoration: - new InputDecoration( - border: OutlineInputBorder(), - labelText: 'Username'), - ), - ), - Padding( - padding: vStandardVerticalPadding, - child: TextFormField( - onSaved: (password) => _password = password, - decoration: - new InputDecoration( - border: OutlineInputBorder(), - labelText: 'Password'), - obscureText: true, - ), - ), - Builder( - builder: (context) => FancyButton( - onPressed: !_loading - ? () { - if (_formKey.currentState - .validate()) { - Form.of(context).save(); - _loginUser(context); - } - } - : null, - child: _loading - ? CircularProgressIndicator() - : VikunjaButtonText('Login'), - )), - Builder( - builder: (context) => FancyButton( - onPressed: () => Navigator.push( - context, - MaterialPageRoute( - builder: (context) => - RegisterPage())), - child: VikunjaButtonText('Register'), - )), - ], - )), + body: Center( + child: SingleChildScrollView( + padding: const EdgeInsets.all(16.0), + child: Builder( + builder: (BuildContext context) => Form( + autovalidate: true, + key: _formKey, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + crossAxisAlignment: CrossAxisAlignment.center, + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 30), + child: Image( + image: AssetImage('assets/vikunja_logo_full.png'), + height: 85.0, + semanticLabel: 'Vikunja Logo', + ), + ), + Padding( + padding: vStandardVerticalPadding, + child: TextFormField( + enabled: !_loading, + onSaved: (serverAddress) => + _server = serverAddress, + validator: (address) { + return isUrl(address) + ? null + : 'Invalid URL'; + }, + decoration: new InputDecoration( + border: OutlineInputBorder(), + labelText: 'Server Address'), + ), + ), + Padding( + padding: vStandardVerticalPadding, + child: TextFormField( + enabled: !_loading, + onSaved: (username) => _username = username, + decoration: new InputDecoration( + border: OutlineInputBorder(), + labelText: 'Username'), + ), + ), + Padding( + padding: vStandardVerticalPadding, + child: TextFormField( + enabled: !_loading, + onSaved: (password) => _password = password, + decoration: new InputDecoration( + border: OutlineInputBorder(), + labelText: 'Password'), + obscureText: true, + ), + ), + Builder( + builder: (context) => FancyButton( + onPressed: !_loading + ? () { + if (_formKey.currentState + .validate()) { + Form.of(context).save(); + _loginUser(context); + } + } + : null, + child: _loading + ? CircularProgressIndicator() + : VikunjaButtonText('Login'), + )), + Builder( + builder: (context) => FancyButton( + onPressed: () => Navigator.push( + context, + MaterialPageRoute( + builder: (context) => + RegisterPage())), + child: VikunjaButtonText('Register'), + )), + ], + ), ), - )); + ), + ), + ), + ), + ); } _loginUser(BuildContext context) async { @@ -114,7 +121,9 @@ class _LoginPageState extends State { showDialog( context: context, 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: [ FlatButton( onPressed: () => Navigator.pop(context), diff --git a/lib/pages/register_page.dart b/lib/pages/register_page.dart index 17a9d49..3e5c201 100644 --- a/lib/pages/register_page.dart +++ b/lib/pages/register_page.dart @@ -20,7 +20,7 @@ class _RegisterPageState extends State { Widget build(BuildContext ctx) { return Scaffold( appBar: AppBar( - title: Text('Register to Vikunja'), + title: Text('Register'), ), body: Builder( builder: (BuildContext context) => SafeArea( @@ -29,16 +29,8 @@ class _RegisterPageState extends State { child: Form( key: _formKey, child: ListView( - padding: const EdgeInsets.symmetric(horizontal: 16.0), + padding: const EdgeInsets.all(16), children: [ - Padding( - padding: vStandardVerticalPadding, - child: Image( - image: AssetImage('assets/vikunja_logo.png'), - height: 128.0, - semanticLabel: 'Vikunja Logo', - ), - ), Padding( padding: vStandardVerticalPadding, child: TextFormField( diff --git a/pubspec.yaml b/pubspec.yaml index 8774e4b..ee58330 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -34,6 +34,7 @@ flutter: assets: - assets/graphics/hypnotize.png - assets/vikunja_logo.png + - assets/vikunja_logo_full.png fonts: - family: Quicksand fonts: