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 createState() => _internalState; void addTask(RepeatingTask task) { _internalState.addTask(task); } } class _ScrollTableState extends State { final List _content = []; addTask(RepeatingTask task) { setState(() { _content.add(task); }); } List _buildTitles() { return List.from(_content.map((RepeatingTask t) => Container( alignment: Alignment.center, width: 120.0, height: 60.0, color: Colors.white, margin: const EdgeInsets.all(4.0), child: Text(t.title, style: Theme .of(context) .textTheme .labelMedium), ))); } @override Widget build(BuildContext context) { return SingleChildScrollView( child: Row( crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: _buildTitles(), ), Flexible( child: SingleChildScrollView( scrollDirection: Axis.horizontal, child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: _content, ), ), ) ], ) ); } }