2023-01-07 21:23:59 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:nextcloud_reminder/task_item.dart';
|
2023-01-09 16:27:04 +00:00
|
|
|
import 'package:nextcloud_reminder/types/tasks.dart';
|
2023-01-07 21:23:59 +00:00
|
|
|
|
|
|
|
class RepeatingTask extends StatefulWidget {
|
2023-01-09 16:27:04 +00:00
|
|
|
const RepeatingTask({super.key, required this.task, this.repeat=1});
|
2023-01-07 21:23:59 +00:00
|
|
|
|
2023-01-09 16:27:04 +00:00
|
|
|
final Task task;
|
2023-01-07 21:23:59 +00:00
|
|
|
final int repeat;
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<StatefulWidget> createState() => _RepeatingTaskState();
|
|
|
|
}
|
|
|
|
|
|
|
|
class _RepeatingTaskState extends State<RepeatingTask> {
|
|
|
|
late List<TaskItem> _occurrences;
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
_occurrences = List<TaskItem>.generate(10, (index) => TaskItem(done: index % widget.repeat == 0 ? false : null));
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: _occurrences,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|