further improved accessibility across the application and add tooltips to action buttons

This commit is contained in:
2026-07-15 19:29:40 +02:00
parent 478f0ff20b
commit e8c6ac1c65
13 changed files with 366 additions and 268 deletions
@@ -32,89 +32,90 @@ class MarianumDatesView extends StatelessWidget {
}
@override
Widget build(BuildContext context) =>
BlocModule<MarianumDatesBloc, LoadableState<MarianumDatesState>>(
create: (context) => MarianumDatesBloc(),
autoRebuild: true,
child: (context, bloc, state) => Scaffold(
appBar: AppBar(
title: const Text('Marianum Termine'),
actions: [
PopupMenuButton<bool>(
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',
),
],
),
),
)
.toList(),
onSelected: (e) => bloc.add(SetPastEventsVisible(e)),
),
IconButton(
tooltip: 'Suchen',
icon: const Icon(Icons.search),
onPressed: () {
final events = bloc.getEvents() ?? const <MarianumDate>[];
showSearch(
context: context,
delegate: SearchMarianumDates(events),
);
},
),
],
),
body: LoadableStateConsumer<MarianumDatesBloc, MarianumDatesState>(
child: (state, loading) {
final events = bloc.getEvents() ?? const <MarianumDate>[];
final groups = _groupByMonth(events);
if (groups.isEmpty) {
return const PlaceholderView(
icon: Icons.event_busy_outlined,
text: 'Keine Termine',
);
}
return CustomScrollView(
slivers: [
for (final group in groups)
SliverMainAxisGroup(
slivers: [
SliverPersistentHeader(
pinned: true,
delegate: MonthHeaderDelegate(label: group.label),
),
SliverList.builder(
itemCount: group.events.length,
itemBuilder: (_, i) =>
MarianumDateRow(event: group.events[i]),
Widget build(
BuildContext context,
) => BlocModule<MarianumDatesBloc, LoadableState<MarianumDatesState>>(
create: (context) => MarianumDatesBloc(),
autoRebuild: true,
child: (context, bloc, state) => Scaffold(
appBar: AppBar(
title: const Text('Marianum Termine'),
actions: [
PopupMenuButton<bool>(
tooltip:
'Vergangene Termine ${bloc.showPastEvents() ? 'ausblenden' : 'anzeigen'}',
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'),
],
),
const SliverToBoxAdapter(child: SizedBox(height: 24)),
],
),
)
.toList(),
onSelected: (e) => bloc.add(SetPastEventsVisible(e)),
),
IconButton(
tooltip: 'Suchen',
icon: const Icon(Icons.search),
onPressed: () {
final events = bloc.getEvents() ?? const <MarianumDate>[];
showSearch(
context: context,
delegate: SearchMarianumDates(events),
);
},
),
),
);
],
),
body: LoadableStateConsumer<MarianumDatesBloc, MarianumDatesState>(
child: (state, loading) {
final events = bloc.getEvents() ?? const <MarianumDate>[];
final groups = _groupByMonth(events);
if (groups.isEmpty) {
return const PlaceholderView(
icon: Icons.event_busy_outlined,
text: 'Keine Termine',
);
}
return CustomScrollView(
slivers: [
for (final group in groups)
SliverMainAxisGroup(
slivers: [
SliverPersistentHeader(
pinned: true,
delegate: MonthHeaderDelegate(label: group.label),
),
SliverList.builder(
itemCount: group.events.length,
itemBuilder: (_, i) =>
MarianumDateRow(event: group.events[i]),
),
],
),
const SliverToBoxAdapter(child: SizedBox(height: 24)),
],
);
},
),
),
);
}
class _MonthGroup {