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"> <manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application <application
android:label="calodiary" android:label="Calodiary"
android:name="${applicationName}" android:name="${applicationName}"
android:icon="@mipmap/ic_launcher"> android:icon="@mipmap/ic_launcher">
<activity <activity

View File

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