94 lines
2.9 KiB
Dart
94 lines
2.9 KiB
Dart
import 'package:a1_aufgabenverwaltung/components/status_display.dart';
|
|
import 'package:a1_aufgabenverwaltung/components/table_row_element.dart';
|
|
import 'package:a1_aufgabenverwaltung/components/table_row_not_text_element.dart';
|
|
import 'package:a1_aufgabenverwaltung/components/user_icon_element.dart';
|
|
import 'package:a1_aufgabenverwaltung/main.dart';
|
|
import 'package:a1_aufgabenverwaltung/models/status.dart';
|
|
import 'package:a1_aufgabenverwaltung/models/todo.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class TableSingleRow extends StatelessWidget {
|
|
const TableSingleRow({super.key, required this.todo, required this.index, required this.backgroundColor});
|
|
|
|
final Todo todo;
|
|
final int index;
|
|
final Color backgroundColor;
|
|
|
|
static const Color primaryTextColor = Color(0xFFE2E8F0);
|
|
static const Color secondaryTextColor = Color(0xFF64748B);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final statusDisplay = switch (todo.status) {
|
|
Status.done => StatusDisplay.done(),
|
|
Status.ongoing => StatusDisplay.ongoing(),
|
|
Status.todo => StatusDisplay.todo()
|
|
};
|
|
|
|
final displayIndex = (index + 1).toString().padLeft(2, "0");
|
|
|
|
return ColoredBox(
|
|
color: backgroundColor,
|
|
child: Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 12),
|
|
child: Row(
|
|
spacing: 12,
|
|
children: [
|
|
TableRowElement(
|
|
width: Widths.numberWidth,
|
|
text: displayIndex,
|
|
paddingVertical: 5,
|
|
fontWeight: FontWeight(400),
|
|
textColor: secondaryTextColor,
|
|
fontSize: 11,
|
|
),
|
|
|
|
Expanded(
|
|
child: TableRowElement(
|
|
width: Widths.titleWidth,
|
|
text: todo.todoTitle,
|
|
paddingVertical: 4,
|
|
fontWeight: FontWeight(600),
|
|
fontSize: 12,
|
|
textColor: primaryTextColor,
|
|
),
|
|
),
|
|
|
|
Expanded(
|
|
child: TableRowNotTextElement(
|
|
width: Widths.statusWidth,
|
|
paddingVertical: 1.5,
|
|
child: statusDisplay
|
|
),
|
|
),
|
|
|
|
Expanded(
|
|
child: TableRowElement(
|
|
width: Widths.descriptionWidth,
|
|
text: todo.description,
|
|
paddingVertical: 5,
|
|
fontWeight: FontWeight(400),
|
|
fontSize: 11,
|
|
textColor: secondaryTextColor,
|
|
),
|
|
),
|
|
|
|
TableRowNotTextElement(
|
|
width: Widths.userInfoWidth,
|
|
paddingVertical: 0,
|
|
child: UserIconElement(
|
|
initials: todo.user.initials,
|
|
userColor: todo.user.userColor,
|
|
)
|
|
),
|
|
|
|
SizedBox(
|
|
width: Widths.rightSpaceWidth,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|