This commit is contained in:
parent
ae197684ac
commit
893e59b00e
|
@ -1,6 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:vikunja_app/global.dart';
|
import 'package:vikunja_app/global.dart';
|
||||||
import 'package:vikunja_app/models/list.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 {
|
class ListEditPage extends StatefulWidget {
|
||||||
final TaskList list;
|
final TaskList list;
|
||||||
|
@ -27,7 +29,7 @@ class _ListEditPageState extends State<ListEditPage> {
|
||||||
child: Form(
|
child: Form(
|
||||||
key: _formKey,
|
key: _formKey,
|
||||||
child: ListView(
|
child: ListView(
|
||||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
padding: const EdgeInsets.all(16.0),
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Padding(
|
Padding(
|
||||||
padding: EdgeInsets.symmetric(vertical: 10.0),
|
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||||
|
@ -43,7 +45,10 @@ class _ListEditPageState extends State<ListEditPage> {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
decoration:
|
decoration:
|
||||||
new InputDecoration(labelText: 'Title'),
|
new InputDecoration(
|
||||||
|
labelText: 'Title',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Padding(
|
Padding(
|
||||||
|
@ -52,8 +57,7 @@ class _ListEditPageState extends State<ListEditPage> {
|
||||||
maxLines: null,
|
maxLines: null,
|
||||||
keyboardType: TextInputType.multiline,
|
keyboardType: TextInputType.multiline,
|
||||||
initialValue: widget.list.description,
|
initialValue: widget.list.description,
|
||||||
onSaved: (description) =>
|
onSaved: (description) => _description = description,
|
||||||
_description = description,
|
|
||||||
validator: (description) {
|
validator: (description) {
|
||||||
if (description.length > 1000) {
|
if (description.length > 1000) {
|
||||||
return 'The description can have a maximum of 1000 characters.';
|
return 'The description can have a maximum of 1000 characters.';
|
||||||
|
@ -61,32 +65,34 @@ class _ListEditPageState extends State<ListEditPage> {
|
||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
decoration: new InputDecoration(
|
decoration: new InputDecoration(
|
||||||
labelText: 'Description'),
|
labelText: 'Description',
|
||||||
|
border: OutlineInputBorder(),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Builder(
|
Builder(
|
||||||
builder: (context) => RaisedButton(
|
builder: (context) => Padding(
|
||||||
padding:
|
padding: EdgeInsets.symmetric(vertical: 10.0),
|
||||||
EdgeInsets.symmetric(vertical: 10.0),
|
child: FancyButton(
|
||||||
onPressed: !_loading
|
onPressed: !_loading ? () {
|
||||||
? () {
|
if (_formKey.currentState.validate()) {
|
||||||
if (_formKey.currentState
|
Form.of(context).save();
|
||||||
.validate()) {
|
|
||||||
Form.of(context)
|
|
||||||
.save(); // Why does this not work?
|
|
||||||
_saveList(context);
|
_saveList(context);
|
||||||
} else {
|
|
||||||
print(
|
|
||||||
"sdf"); // TODO: handle error
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
: null,
|
: null,
|
||||||
child: _loading
|
child: _loading
|
||||||
? CircularProgressIndicator()
|
? CircularProgressIndicator()
|
||||||
: Text('Save'),
|
: VikunjaButtonText('Save'),
|
||||||
)),
|
)
|
||||||
])),
|
)
|
||||||
)));
|
),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
_saveList(BuildContext context) async {
|
_saveList(BuildContext context) async {
|
||||||
|
|
Reference in New Issue
Block a user