Make the theme switcher icon change depending on the theme.

This commit is contained in:
Marco 2024-06-13 21:49:04 +02:00
parent 402de821a0
commit fb0dbef158
2 changed files with 13 additions and 7 deletions

View File

@ -1,6 +1,6 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="calodiary"
android:label="Calodiary"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity

View File

@ -41,12 +41,18 @@ class _PerDateWidgetState extends State<PerDateWidget> {
appBar: AppBar(
title: Text(formattedDate),
actions: [
IconButton(
icon: const Icon(Icons.lightbulb),
BlocBuilder<ThemeDataBloc, ThemeState>(builder: (context, state) {
var icon = const Icon(Icons.light_mode);
if (state.brightness == 'light') {
icon = const Icon(Icons.dark_mode);
}
return IconButton(
icon: icon,
onPressed: () {
context.read<ThemeDataBloc>().add(ThemeToggleEvent());
},
),
);
}),
],
),
drawer: const AppDrawer(),