Redesign grade average calculator
This commit is contained in:
parent
6a3ca7803c
commit
ba90556e69
@ -35,7 +35,8 @@ class _GradeAverageState extends State<GradeAverage> {
|
|||||||
IconButton(onPressed: () {
|
IconButton(onPressed: () {
|
||||||
showDialog(context: context, builder: (context) {
|
showDialog(context: context, builder: (context) {
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
title: const Text("Noten Zurücksetzen?"),
|
title: const Text("Zurücksetzen?"),
|
||||||
|
content: const Text("Alle Einträge werden entfernt."),
|
||||||
actions: [
|
actions: [
|
||||||
TextButton(onPressed: () {
|
TextButton(onPressed: () {
|
||||||
Navigator.of(context).pop();
|
Navigator.of(context).pop();
|
||||||
@ -103,6 +104,8 @@ class _GradeAverageState extends State<GradeAverage> {
|
|||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
const Divider(),
|
const Divider(),
|
||||||
const SizedBox(height: 10),
|
const SizedBox(height: 10),
|
||||||
|
Text(gradeSystem ? "Wähle unten die Anzahl deiner jewiligen Noten aus" : "Wähle unten die Anzahl deiner jeweiligen Punkte aus"),
|
||||||
|
const SizedBox(height: 10),
|
||||||
Expanded(
|
Expanded(
|
||||||
child: ListView.builder(
|
child: ListView.builder(
|
||||||
itemBuilder: (context, index) {
|
itemBuilder: (context, index) {
|
||||||
@ -113,7 +116,10 @@ class _GradeAverageState extends State<GradeAverage> {
|
|||||||
tileColor: grade.isEven ? Colors.transparent : Colors.transparent.withAlpha(50),
|
tileColor: grade.isEven ? Colors.transparent : Colors.transparent.withAlpha(50),
|
||||||
title: Center(
|
title: Center(
|
||||||
child: Row(
|
child: Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
children: [
|
children: [
|
||||||
|
Text(getGradeDisplay(grade)),
|
||||||
|
const SizedBox(width: 30),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -124,7 +130,7 @@ class _GradeAverageState extends State<GradeAverage> {
|
|||||||
icon: const Icon(Icons.remove),
|
icon: const Icon(Icons.remove),
|
||||||
color: Theme.of(context).colorScheme.onSurface,
|
color: Theme.of(context).colorScheme.onSurface,
|
||||||
),
|
),
|
||||||
Text(getGradeDisplay(grade)),
|
Text("${grades.where(isThis).length}", style: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
|
||||||
IconButton(
|
IconButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
setState(() {
|
setState(() {
|
||||||
@ -137,7 +143,20 @@ class _GradeAverageState extends State<GradeAverage> {
|
|||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
trailing: Text("Anzahl: ${grades.where(isThis).length}"),
|
trailing: Visibility(
|
||||||
|
maintainState: true,
|
||||||
|
maintainAnimation: true,
|
||||||
|
maintainSize: true,
|
||||||
|
visible: grades.any(isThis),
|
||||||
|
child: IconButton(
|
||||||
|
icon: const Icon(Icons.delete),
|
||||||
|
onPressed: () {
|
||||||
|
setState(() {
|
||||||
|
grades.removeWhere(isThis);
|
||||||
|
});
|
||||||
|
},
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user