2023-01-07 21:23:59 +00:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:nextcloud_reminder/repeating_task.dart';
|
|
|
|
|
|
|
|
class ScrollTable extends StatefulWidget {
|
|
|
|
ScrollTable({super.key, required this.title});
|
|
|
|
|
|
|
|
// This class is the configuration for the state. It holds the values (in this
|
|
|
|
// case the title) provided by the parent (in this case the App widget) and
|
|
|
|
// used by the build method of the State. Fields in a Widget subclass are
|
|
|
|
// always marked "final".
|
|
|
|
|
|
|
|
final String title;
|
|
|
|
final _ScrollTableState _internalState = _ScrollTableState();
|
|
|
|
|
|
|
|
@override
|
|
|
|
State<ScrollTable> createState() => _internalState;
|
|
|
|
|
|
|
|
|
|
|
|
void addTask(RepeatingTask task) {
|
|
|
|
_internalState.addTask(task);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class _ScrollTableState extends State<ScrollTable> {
|
|
|
|
final List<RepeatingTask> _content = [];
|
|
|
|
|
|
|
|
addTask(RepeatingTask task) {
|
|
|
|
setState(() {
|
|
|
|
_content.add(task);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
List<Widget> _buildTitles() {
|
|
|
|
return List<Widget>.from(_content.map((RepeatingTask t) =>
|
|
|
|
Container(
|
|
|
|
alignment: Alignment.center,
|
|
|
|
width: 120.0,
|
|
|
|
height: 60.0,
|
|
|
|
color: Colors.white,
|
|
|
|
margin: const EdgeInsets.all(4.0),
|
2023-01-09 16:27:04 +00:00
|
|
|
child: Text(t.task.title, style: Theme
|
2023-01-07 21:23:59 +00:00
|
|
|
.of(context)
|
|
|
|
.textTheme
|
|
|
|
.labelMedium),
|
|
|
|
)));
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return SingleChildScrollView(
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: <Widget>[
|
|
|
|
Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: _buildTitles(),
|
|
|
|
),
|
|
|
|
Flexible(
|
|
|
|
child: SingleChildScrollView(
|
|
|
|
scrollDirection: Axis.horizontal,
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: _content,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|