dart format

This commit is contained in:
2026-05-08 20:12:40 +02:00
parent 9e139b5704
commit 3b8da1d3d6
295 changed files with 6404 additions and 4161 deletions
@@ -12,7 +12,7 @@ class GradeAveragesListView extends StatelessWidget {
var bloc = context.watch<GradeAveragesBloc>();
String getGradeDisplay(int grade) {
if(bloc.isMiddleSchool()) {
if (bloc.isMiddleSchool()) {
return 'Note $grade';
} else {
return "$grade Punkt${grade > 1 ? "e" : ""}";
@@ -25,7 +25,9 @@ class GradeAveragesListView extends StatelessWidget {
var grade = bloc.getGradeFromIndex(index);
return Material(
child: ListTile(
tileColor: grade.isEven ? Colors.transparent : Colors.transparent.withAlpha(50),
tileColor: grade.isEven
? Colors.transparent
: Colors.transparent.withAlpha(50),
title: Center(
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
@@ -39,7 +41,13 @@ class GradeAveragesListView extends StatelessWidget {
icon: const Icon(Icons.remove),
color: Theme.of(context).colorScheme.onSurface,
),
Text('${bloc.countOfGrade(grade)}', style: const TextStyle(fontSize: 15, fontWeight: FontWeight.bold)),
Text(
'${bloc.countOfGrade(grade)}',
style: const TextStyle(
fontSize: 15,
fontWeight: FontWeight.bold,
),
),
IconButton(
onPressed: () {
bloc.add(IncrementGrade(grade));
@@ -12,49 +12,56 @@ class GradeAveragesView extends StatelessWidget {
@override
Widget build(BuildContext context) => BlocProvider<GradeAveragesBloc>(
create: (context) => GradeAveragesBloc(),
child: BlocBuilder<GradeAveragesBloc, GradeAveragesState>(
builder: (context, state) {
var bloc = context.watch<GradeAveragesBloc>();
create: (context) => GradeAveragesBloc(),
child: BlocBuilder<GradeAveragesBloc, GradeAveragesState>(
builder: (context, state) {
var bloc = context.watch<GradeAveragesBloc>();
return Scaffold(
return Scaffold(
appBar: AppBar(
title: const Text('Notendurschnittsrechner'),
actions: [
Visibility(
visible: bloc.state.grades.isNotEmpty,
child: IconButton(
onPressed: () {
showDialog(
context: context,
builder: (context) => ConfirmDialog(
title: 'Zurücksetzen?',
content: 'Alle Einträge werden entfernt.',
confirmButton: 'Zurücksetzen',
onConfirm: () {
bloc.add(ResetAll());
},
),
);
},
icon: const Icon(Icons.delete_forever)),
onPressed: () {
showDialog(
context: context,
builder: (context) => ConfirmDialog(
title: 'Zurücksetzen?',
content: 'Alle Einträge werden entfernt.',
confirmButton: 'Zurücksetzen',
onConfirm: () {
bloc.add(ResetAll());
},
),
);
},
icon: const Icon(Icons.delete_forever),
),
),
PopupMenuButton<bool>(
initialValue: bloc.isMiddleSchool(),
icon: const Icon(Icons.more_horiz),
itemBuilder: (context) => [true, false].map((isMiddleSchool) => PopupMenuItem<bool>(
value: isMiddleSchool,
child: Row(
children: [
Icon(
isMiddleSchool ? Icons.calculate_outlined : Icons.school_outlined,
color: Theme.of(context).colorScheme.onSurface
itemBuilder: (context) => [true, false]
.map(
(isMiddleSchool) => PopupMenuItem<bool>(
value: isMiddleSchool,
child: Row(
children: [
Icon(
isMiddleSchool
? Icons.calculate_outlined
: Icons.school_outlined,
color: Theme.of(context).colorScheme.onSurface,
),
const SizedBox(width: 15),
Text(isMiddleSchool ? 'Realschule' : 'Oberstufe'),
],
),
),
const SizedBox(width: 15),
Text(isMiddleSchool ? 'Realschule' : 'Oberstufe'),
],
),
)).toList(),
)
.toList(),
onSelected: (isMiddleSchool) {
if (bloc.state.grades.isNotEmpty) {
showDialog(
@@ -62,9 +69,10 @@ class GradeAveragesView extends StatelessWidget {
builder: (context) => ConfirmDialog(
title: 'Notensystem wechseln',
content:
'Beim Wechsel des Notensystems werden alle Einträge zurückgesetzt.',
'Beim Wechsel des Notensystems werden alle Einträge zurückgesetzt.',
confirmButton: 'Fortfahren',
onConfirm: () => bloc.add(GradingSystemChanged(isMiddleSchool)),
onConfirm: () =>
bloc.add(GradingSystemChanged(isMiddleSchool)),
),
);
} else {
@@ -84,23 +92,34 @@ class GradeAveragesView extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('Ø', style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold)),
Text(
'Ø',
style: TextStyle(fontSize: 30, fontWeight: FontWeight.bold),
),
SizedBox(width: 5),
Text(bloc.average().toStringAsFixed(2), style: const TextStyle(fontSize: 30, fontWeight: FontWeight.bold))
Text(
bloc.average().toStringAsFixed(2),
style: const TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
),
),
],
),
const SizedBox(height: 10),
const Divider(),
const SizedBox(height: 10),
Text(bloc.isMiddleSchool() ? 'Wähle die Anzahl deiner jeweiligen Noten aus' : 'Wähle die Anzahl deiner jeweiligen Punkte aus'),
const SizedBox(height: 10),
const Expanded(
child: GradeAveragesListView()
Text(
bloc.isMiddleSchool()
? 'Wähle die Anzahl deiner jeweiligen Noten aus'
: 'Wähle die Anzahl deiner jeweiligen Punkte aus',
),
const SizedBox(height: 10),
const Expanded(child: GradeAveragesListView()),
],
),
);
},
),
);
},
),
);
}