Make the theme switcher icon change depending on the theme.
This commit is contained in:
parent
402de821a0
commit
fb0dbef158
@ -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
|
||||
|
@ -41,12 +41,18 @@ class _PerDateWidgetState extends State<PerDateWidget> {
|
||||
appBar: AppBar(
|
||||
title: Text(formattedDate),
|
||||
actions: [
|
||||
IconButton(
|
||||
icon: const Icon(Icons.lightbulb),
|
||||
onPressed: () {
|
||||
context.read<ThemeDataBloc>().add(ThemeToggleEvent());
|
||||
},
|
||||
),
|
||||
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(),
|
||||
|
Loading…
Reference in New Issue
Block a user