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) {
var grade = gradeSystem ? index + 1 : 14 - index + 1;
bool isThis(int e) => e == grade;
return ListTile(
tileColor: grade.isEven ? Colors.transparent : Colors.transparent.withAlpha(50),
title: Center(
child: Row(
children: [
IconButton(
onPressed: () {
setState(() {
if(!grades.any(isThis)) return;
grades.removeAt(grades.indexWhere(isThis));
});
},
icon: const Icon(Icons.remove),
color: Theme.of(context).colorScheme.onSurface,
),
Text(getGradeDisplay(grade)),
IconButton(
onPressed: () {
setState(() {
grades.add(grade);
});
},
icon: const Icon(Icons.add),
color: Theme.of(context).colorScheme.onSurface,
),
],
return Material(
child: ListTile(
tileColor: grade.isEven ? Colors.transparent : Colors.transparent.withAlpha(50),
title: Center(
child: Row(
children: [
IconButton(
onPressed: () {
setState(() {
if(!grades.any(isThis)) return;
grades.removeAt(grades.indexWhere(isThis));
});
},
icon: const Icon(Icons.remove),
color: Theme.of(context).colorScheme.onSurface,
),
Text(getGradeDisplay(grade)),
IconButton(
onPressed: () {
setState(() {
grades.add(grade);
});
},
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,