From 019e6dd6ccab57f7d2e8b118bd5de2b11e5e747b Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 12 Mar 2019 19:48:17 +0100 Subject: [PATCH 1/2] Edit list design improvements --- lib/pages/list_edit_page.dart | 54 +++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 22 deletions(-) diff --git a/lib/pages/list_edit_page.dart b/lib/pages/list_edit_page.dart index c81ffc9..6c7ec74 100644 --- a/lib/pages/list_edit_page.dart +++ b/lib/pages/list_edit_page.dart @@ -1,6 +1,8 @@ import 'package:flutter/material.dart'; import 'package:vikunja_app/global.dart'; import 'package:vikunja_app/models/list.dart'; +import 'package:vikunja_app/theme/button.dart'; +import 'package:vikunja_app/theme/buttonText.dart'; class ListEditPage extends StatefulWidget { final TaskList list; @@ -27,7 +29,7 @@ class _ListEditPageState extends State { child: Form( key: _formKey, child: ListView( - padding: const EdgeInsets.symmetric(horizontal: 16.0), + padding: const EdgeInsets.all(16.0), children: [ Padding( padding: EdgeInsets.symmetric(vertical: 10.0), @@ -43,7 +45,10 @@ class _ListEditPageState extends State { return null; }, decoration: - new InputDecoration(labelText: 'Title'), + new InputDecoration( + labelText: 'Title', + border: OutlineInputBorder(), + ), ), ), Padding( @@ -61,32 +66,37 @@ class _ListEditPageState extends State { return null; }, decoration: new InputDecoration( - labelText: 'Description'), + labelText: 'Description', + border: OutlineInputBorder(), + ), ), ), Builder( - builder: (context) => RaisedButton( + builder: (context) => Padding( padding: EdgeInsets.symmetric(vertical: 10.0), - onPressed: !_loading - ? () { - if (_formKey.currentState - .validate()) { - Form.of(context) - .save(); // Why does this not work? - _saveList(context); - } else { - print( - "sdf"); // TODO: handle error + child: FancyButton( + onPressed: !_loading + ? () { + if (_formKey.currentState + .validate()) { + Form.of(context) + .save(); + _saveList(context); + } } - } - : null, - child: _loading - ? CircularProgressIndicator() - : Text('Save'), - )), - ])), - ))); + : null, + child: _loading + ? CircularProgressIndicator() + : VikunjaButtonText('Save'), + ) + ) + ), + ]) + ), + ) + ) + ); } _saveList(BuildContext context) async { -- 2.40.1 From c03aba43b9330ec33124bafa16cbaed2f3272a75 Mon Sep 17 00:00:00 2001 From: kolaente Date: Tue, 12 Mar 2019 20:03:06 +0100 Subject: [PATCH 2/2] Indention --- lib/pages/list_edit_page.dart | 144 +++++++++++++++++----------------- 1 file changed, 70 insertions(+), 74 deletions(-) diff --git a/lib/pages/list_edit_page.dart b/lib/pages/list_edit_page.dart index 6c7ec74..501714e 100644 --- a/lib/pages/list_edit_page.dart +++ b/lib/pages/list_edit_page.dart @@ -21,81 +21,77 @@ class _ListEditPageState extends State { @override Widget build(BuildContext ctx) { return Scaffold( - appBar: AppBar( - title: Text('Edit List'), - ), - body: Builder( - builder: (BuildContext context) => SafeArea( - child: Form( - key: _formKey, - child: ListView( - padding: const EdgeInsets.all(16.0), - children: [ - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0), - child: TextFormField( - maxLines: null, - keyboardType: TextInputType.multiline, - initialValue: widget.list.title, - onSaved: (title) => _title = title, - validator: (title) { - if (title.length < 3 || title.length > 250) { - return 'The title needs to have between 3 and 250 characters.'; - } - return null; - }, - decoration: - new InputDecoration( - labelText: 'Title', - border: OutlineInputBorder(), - ), - ), - ), - Padding( - padding: EdgeInsets.symmetric(vertical: 10.0), - child: TextFormField( - maxLines: null, - keyboardType: TextInputType.multiline, - initialValue: widget.list.description, - onSaved: (description) => - _description = description, - validator: (description) { - if (description.length > 1000) { - return 'The description can have a maximum of 1000 characters.'; - } - return null; - }, - decoration: new InputDecoration( - labelText: 'Description', - border: OutlineInputBorder(), - ), - ), - ), - Builder( - builder: (context) => Padding( - padding: - EdgeInsets.symmetric(vertical: 10.0), - child: FancyButton( - onPressed: !_loading - ? () { - if (_formKey.currentState - .validate()) { - Form.of(context) - .save(); - _saveList(context); - } - } - : null, - child: _loading - ? CircularProgressIndicator() - : VikunjaButtonText('Save'), - ) - ) - ), - ]) + appBar: AppBar( + title: Text('Edit List'), + ), + body: Builder( + builder: (BuildContext context) => SafeArea( + child: Form( + key: _formKey, + child: ListView( + padding: const EdgeInsets.all(16.0), + children: [ + Padding( + padding: EdgeInsets.symmetric(vertical: 10.0), + child: TextFormField( + maxLines: null, + keyboardType: TextInputType.multiline, + initialValue: widget.list.title, + onSaved: (title) => _title = title, + validator: (title) { + if (title.length < 3 || title.length > 250) { + return 'The title needs to have between 3 and 250 characters.'; + } + return null; + }, + decoration: + new InputDecoration( + labelText: 'Title', + border: OutlineInputBorder(), + ), ), - ) - ) + ), + Padding( + padding: EdgeInsets.symmetric(vertical: 10.0), + child: TextFormField( + maxLines: null, + keyboardType: TextInputType.multiline, + initialValue: widget.list.description, + onSaved: (description) => _description = description, + validator: (description) { + if (description.length > 1000) { + return 'The description can have a maximum of 1000 characters.'; + } + return null; + }, + decoration: new InputDecoration( + labelText: 'Description', + border: OutlineInputBorder(), + ), + ), + ), + Builder( + builder: (context) => Padding( + padding: EdgeInsets.symmetric(vertical: 10.0), + child: FancyButton( + onPressed: !_loading ? () { + if (_formKey.currentState.validate()) { + Form.of(context).save(); + _saveList(context); + } + } + : null, + child: _loading + ? CircularProgressIndicator() + : VikunjaButtonText('Save'), + ) + ) + ), + ] + ), + ), + ), + ), ); } -- 2.40.1