35 lines
984 B
Dart
35 lines
984 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:nextcloud_reminder/task_item.dart';
|
|
import 'package:nextcloud_reminder/types/tasks.dart';
|
|
|
|
class RepeatingTask extends StatefulWidget {
|
|
const RepeatingTask({super.key, required this.task, this.repeat=1});
|
|
|
|
final Task task;
|
|
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 Container(
|
|
decoration: const BoxDecoration(border: Border(bottom: BorderSide(),)),
|
|
margin: const EdgeInsets.all(0.0),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: _occurrences,
|
|
)
|
|
);
|
|
}
|
|
} |