mirror of
https://github.com/go-vikunja/app
synced 2024-06-01 02:06:51 +00:00
ee99869cf6
* 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>
76 lines
1.9 KiB
Dart
76 lines
1.9 KiB
Dart
import 'dart:async';
|
|
|
|
import 'package:flutter/material.dart';
|
|
import 'package:vikunja_app/models/task.dart';
|
|
|
|
class TaskTile extends StatefulWidget {
|
|
final Task task;
|
|
final VoidCallback onEdit;
|
|
final ValueSetter<bool> onMarkedAsDone;
|
|
final bool loading;
|
|
|
|
const TaskTile(
|
|
{Key key,
|
|
@required this.task,
|
|
this.onEdit,
|
|
this.loading = false,
|
|
this.onMarkedAsDone})
|
|
: assert(task != null),
|
|
super(key: key);
|
|
|
|
@override
|
|
TaskTileState createState() {
|
|
return new TaskTileState(this.loading);
|
|
}
|
|
}
|
|
|
|
class TaskTileState extends State<TaskTile> {
|
|
bool _loading;
|
|
|
|
TaskTileState(this._loading) {
|
|
assert(_loading != null);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
if (_loading) {
|
|
return ListTile(
|
|
leading: Padding(
|
|
padding: const EdgeInsets.all(8.0),
|
|
child: SizedBox(
|
|
height: Checkbox.width,
|
|
width: Checkbox.width,
|
|
child: CircularProgressIndicator(
|
|
strokeWidth: 2.0,
|
|
)),
|
|
),
|
|
title: Text(widget.task.title),
|
|
subtitle:
|
|
widget.task.description == null || widget.task.description.isEmpty
|
|
? null
|
|
: Text(widget.task.description),
|
|
trailing: IconButton(
|
|
icon: Icon(Icons.settings),
|
|
onPressed: () => widget.onEdit,
|
|
),
|
|
);
|
|
}
|
|
return CheckboxListTile(
|
|
title: Text(widget.task.title),
|
|
controlAffinity: ListTileControlAffinity.leading,
|
|
value: widget.task.done ?? false,
|
|
subtitle:
|
|
widget.task.description == null || widget.task.description.isEmpty
|
|
? null
|
|
: Text(widget.task.description),
|
|
secondary: IconButton(
|
|
icon: Icon(Icons.settings),
|
|
onPressed: widget.onEdit,
|
|
),
|
|
onChanged: widget.onMarkedAsDone,
|
|
);
|
|
}
|
|
}
|
|
|
|
typedef Future<void> TaskChanged(Task task, bool newValue);
|