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
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: <Widget>[
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: <Widget>[
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<LoginPage> {
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: <Widget>[
FlatButton(
onPressed: () => Navigator.pop(context),

View File

@ -20,7 +20,7 @@ class _RegisterPageState extends State<RegisterPage> {
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<RegisterPage> {
child: Form(
key: _formKey,
child: ListView(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
padding: const EdgeInsets.all(16),
children: <Widget>[
Padding(
padding: vStandardVerticalPadding,
child: Image(
image: AssetImage('assets/vikunja_logo.png'),
height: 128.0,
semanticLabel: 'Vikunja Logo',
),
),
Padding(
padding: vStandardVerticalPadding,
child: TextFormField(

View File

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