1
0
mirror of https://github.com/go-vikunja/app synced 2024-06-02 18:49:47 +00:00
app-mirror-github/lib/components/AddDialog.dart
Timo Reichl ee99869cf6
fix: warnings (#1)
* Ran make format

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>

* Add VS Code launch config

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>

* pages/list/list.dart: Stop spinning wheel after adding a task

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>

* stores/list_store.dart: Fix updateTask() not being a future

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>

* Replace FlatButton with TextButton widgets

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>

* components/TaskTile.dart: Remove dead code

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>

* theme/theme.dart: Fix accentColor deprecation

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>

* pages/list/list_edit.dart: Fix SnackBar.hideCurrentSnackBar() deprecation

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>

* Remove unused folder lib/managers

Signed-off-by: Timo Reichl <timo.reichl@mailbox.org>
2021-12-21 12:22:17 +01:00

40 lines
1.1 KiB
Dart

import 'package:flutter/material.dart';
class AddDialog extends StatelessWidget {
final ValueChanged<String> onAdd;
final InputDecoration decoration;
const AddDialog({Key key, this.onAdd, this.decoration}) : super(key: key);
@override
Widget build(BuildContext context) {
var textController = TextEditingController();
return new AlertDialog(
contentPadding: const EdgeInsets.all(16.0),
content: new Row(children: <Widget>[
Expanded(
child: new TextField(
autofocus: true,
decoration: this.decoration,
controller: textController,
),
)
]),
actions: <Widget>[
new TextButton(
child: const Text('CANCEL'),
onPressed: () => Navigator.pop(context),
),
new TextButton(
child: const Text('ADD'),
onPressed: () {
if (this.onAdd != null && textController.text.isNotEmpty)
this.onAdd(textController.text);
Navigator.pop(context);
},
)
],
);
}
}