66 lines
1.8 KiB
Dart
66 lines
1.8 KiB
Dart
import 'package:a1_aufgabenverwaltung/components/footer_element.dart';
|
|
import 'package:a1_aufgabenverwaltung/models/todo.dart';
|
|
import 'package:a1_aufgabenverwaltung/models/status.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class Footer extends StatelessWidget {
|
|
const Footer({super.key, required this.todos});
|
|
|
|
final List<Todo> todos;
|
|
|
|
static const backgroundColor = Color(0xFF0F1117);
|
|
static const borderColor = Color(0xFF1E2D3D);
|
|
static const doneColor = Color(0xFF10B981);
|
|
static const ongoingColor = Color(0xFFF59E0B);
|
|
static const todoColor = Color(0xFF64748B);
|
|
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
var doneCounter = 0;
|
|
var ongoingCounter = 0;
|
|
var todoCounter = 0;
|
|
|
|
for (Todo todo in todos) {
|
|
switch (todo.status) {
|
|
case Status.done:
|
|
doneCounter = doneCounter + 1;
|
|
break;
|
|
case Status.ongoing:
|
|
ongoingCounter = ongoingCounter + 1;
|
|
break;
|
|
case Status.todo:
|
|
todoCounter = todoCounter + 1;
|
|
break;
|
|
}
|
|
}
|
|
|
|
String doneText = "✓ $doneCounter Erledigt";
|
|
String ongoingText = "◈ $ongoingCounter In Bearbeitung";
|
|
String todoText = "○ $todoCounter Nicht begonnen";
|
|
|
|
return Container(
|
|
height: 28,
|
|
decoration: BoxDecoration(
|
|
color: backgroundColor,
|
|
border: Border(
|
|
top: BorderSide(
|
|
color: borderColor,
|
|
width: 1,
|
|
)
|
|
)
|
|
),
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 6),
|
|
child: Row(
|
|
spacing: 16,
|
|
children: [
|
|
FooterElement(color: doneColor, text: doneText),
|
|
FooterElement(color: ongoingColor, text: ongoingText),
|
|
FooterElement(color: todoColor, text: todoText),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
} |