Fixed tileColor being visible in overflow

This commit is contained in:
Elias Müller 2023-05-30 18:56:46 +02:00
parent abacef3d8a
commit 6a3ca7803c

View File

@ -108,35 +108,37 @@ class _GradeAverageState extends State<GradeAverage> {
itemBuilder: (context, index) { itemBuilder: (context, index) {
var grade = gradeSystem ? index + 1 : 14 - index + 1; var grade = gradeSystem ? index + 1 : 14 - index + 1;
bool isThis(int e) => e == grade; bool isThis(int e) => e == grade;
return ListTile( return Material(
tileColor: grade.isEven ? Colors.transparent : Colors.transparent.withAlpha(50), child: ListTile(
title: Center( tileColor: grade.isEven ? Colors.transparent : Colors.transparent.withAlpha(50),
child: Row( title: Center(
children: [ child: Row(
IconButton( children: [
onPressed: () { IconButton(
setState(() { onPressed: () {
if(!grades.any(isThis)) return; setState(() {
grades.removeAt(grades.indexWhere(isThis)); if(!grades.any(isThis)) return;
}); grades.removeAt(grades.indexWhere(isThis));
}, });
icon: const Icon(Icons.remove), },
color: Theme.of(context).colorScheme.onSurface, icon: const Icon(Icons.remove),
), color: Theme.of(context).colorScheme.onSurface,
Text(getGradeDisplay(grade)), ),
IconButton( Text(getGradeDisplay(grade)),
onPressed: () { IconButton(
setState(() { onPressed: () {
grades.add(grade); setState(() {
}); grades.add(grade);
}, });
icon: const Icon(Icons.add), },
color: Theme.of(context).colorScheme.onSurface, icon: const Icon(Icons.add),
), color: Theme.of(context).colorScheme.onSurface,
], ),
],
),
), ),
trailing: Text("Anzahl: ${grades.where(isThis).length}"),
), ),
trailing: Text("Anzahl: ${grades.where(isThis).length}"),
); );
}, },
itemCount: gradeSystem ? 6 : 15, itemCount: gradeSystem ? 6 : 15,