dart format
This commit is contained in:
@@ -19,7 +19,8 @@ class MarianumDatesView extends StatelessWidget {
|
||||
static List<_MonthGroup> _groupByMonth(List<MarianumDate> events) {
|
||||
final byMonth = <String, List<MarianumDate>>{};
|
||||
for (final e in events) {
|
||||
final key = '${e.start.year.toString().padLeft(4, '0')}-${e.start.month.toString().padLeft(2, '0')}';
|
||||
final key =
|
||||
'${e.start.year.toString().padLeft(4, '0')}-${e.start.month.toString().padLeft(2, '0')}';
|
||||
byMonth.putIfAbsent(key, () => []).add(e);
|
||||
}
|
||||
final keys = byMonth.keys.toList()..sort();
|
||||
@@ -31,7 +32,8 @@ class MarianumDatesView extends StatelessWidget {
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => BlocModule<MarianumDatesBloc, LoadableState<MarianumDatesState>>(
|
||||
Widget build(BuildContext context) =>
|
||||
BlocModule<MarianumDatesBloc, LoadableState<MarianumDatesState>>(
|
||||
create: (context) => MarianumDatesBloc(),
|
||||
autoRebuild: true,
|
||||
child: (context, bloc, state) => Scaffold(
|
||||
@@ -42,18 +44,26 @@ class MarianumDatesView extends StatelessWidget {
|
||||
initialValue: bloc.showPastEvents(),
|
||||
icon: const Icon(Icons.history),
|
||||
itemBuilder: (context) => [true, false]
|
||||
.map((e) => PopupMenuItem<bool>(
|
||||
value: e,
|
||||
enabled: e != bloc.showPastEvents(),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(e ? Icons.history_outlined : Icons.history_toggle_off_outlined,
|
||||
color: Theme.of(context).colorScheme.onSurface),
|
||||
const SizedBox(width: 15),
|
||||
Text(e ? 'Alle anzeigen' : 'Nur zukünftige anzeigen'),
|
||||
],
|
||||
),
|
||||
))
|
||||
.map(
|
||||
(e) => PopupMenuItem<bool>(
|
||||
value: e,
|
||||
enabled: e != bloc.showPastEvents(),
|
||||
child: Row(
|
||||
children: [
|
||||
Icon(
|
||||
e
|
||||
? Icons.history_outlined
|
||||
: Icons.history_toggle_off_outlined,
|
||||
color: Theme.of(context).colorScheme.onSurface,
|
||||
),
|
||||
const SizedBox(width: 15),
|
||||
Text(
|
||||
e ? 'Alle anzeigen' : 'Nur zukünftige anzeigen',
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
)
|
||||
.toList(),
|
||||
onSelected: (e) => bloc.add(SetPastEventsVisible(e)),
|
||||
),
|
||||
@@ -61,7 +71,10 @@ class MarianumDatesView extends StatelessWidget {
|
||||
icon: const Icon(Icons.search),
|
||||
onPressed: () {
|
||||
final events = bloc.getEvents() ?? const <MarianumDate>[];
|
||||
showSearch(context: context, delegate: SearchMarianumDates(events));
|
||||
showSearch(
|
||||
context: context,
|
||||
delegate: SearchMarianumDates(events),
|
||||
);
|
||||
},
|
||||
),
|
||||
],
|
||||
@@ -89,7 +102,8 @@ class MarianumDatesView extends StatelessWidget {
|
||||
),
|
||||
SliverList.builder(
|
||||
itemCount: group.events.length,
|
||||
itemBuilder: (_, i) => MarianumDateRow(event: group.events[i]),
|
||||
itemBuilder: (_, i) =>
|
||||
MarianumDateRow(event: group.events[i]),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user