29 lines
966 B
Dart
29 lines
966 B
Dart
import 'package:a1_aufgabenverwaltung/data/mock_todos.dart';
|
|
import 'package:a1_aufgabenverwaltung/models/todo.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:a1_aufgabenverwaltung/components/table_single_row.dart';
|
|
|
|
class Table extends StatelessWidget {
|
|
const Table({super.key, required this.todos});
|
|
|
|
final List<Todo> todos;
|
|
|
|
static const backgroundColorEven = Color(0xFF0F1117);
|
|
static const backgroundColorOdd = Color(0xFF131720);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return ColoredBox(
|
|
color: backgroundColorEven,
|
|
child: SingleChildScrollView(
|
|
child: Column(
|
|
children: List.generate(mockTodos.length, (index) {
|
|
final backgroundColor = index.isEven ? backgroundColorEven : backgroundColorOdd;
|
|
final todo = mockTodos[index];
|
|
return TableSingleRow(todo: todo, index: index, backgroundColor: backgroundColor,);
|
|
}),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |