fix: rebuild application when setting the theme or font (#3139)

This commit is contained in:
Nathan.fooo 2023-08-08 09:08:24 +08:00 committed by GitHub
parent ef9596f4ab
commit 125bcbc9db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -22,7 +22,11 @@ class InitAppWidgetTask extends LaunchTask {
final widget = context.getIt<EntryPoint>().create(context.config);
final appearanceSetting =
await UserSettingsBackendService().getAppearanceSetting();
// If the passed-in context is not the same as the context of the
// application widget, the application widget will be rebuilt.
final app = ApplicationWidget(
key: ValueKey(context),
appearanceSetting: appearanceSetting,
child: widget,
);
@ -89,7 +93,6 @@ class ApplicationWidget extends StatelessWidget {
],
child: BlocBuilder<AppearanceSettingsCubit, AppearanceSettingsState>(
builder: (context, state) => MaterialApp(
key: UniqueKey(),
builder: overlayManagerBuilder(),
debugShowCheckedModeBanner: false,
theme: state.lightTheme,