35 lines
944 B
Dart
35 lines
944 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:nextcloud_reminder/task_item.dart';
|
|
|
|
class RepeatingTask extends StatefulWidget {
|
|
const RepeatingTask({super.key, required this.title, required this.begin, this.repeat=1});
|
|
|
|
final String title;
|
|
final DateTime begin;
|
|
final int repeat;
|
|
|
|
@override
|
|
State<StatefulWidget> createState() => _RepeatingTaskState();
|
|
}
|
|
|
|
class _RepeatingTaskState extends State<RepeatingTask> {
|
|
late List<TaskItem> _occurrences;
|
|
late DateTime _first_occurence;
|
|
late String _title;
|
|
|
|
@override
|
|
void initState() {
|
|
super.initState();
|
|
_title = widget.title;
|
|
_first_occurence = widget.begin;
|
|
_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,
|
|
);
|
|
}
|
|
} |