jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.41k stars 1.63k forks source link

Get.forceAppUpdate() in 5.0.0-release-candidate-9.2.1 does not work #3231

Open CalmLuo opened 1 month ago

CalmLuo commented 1 month ago

When I change the theme using Get.forceAppUpdate(), the build is called, but the GetMaterialApp is not modified, it is the same theme data as before.

This is not valid in 5.0.0-release-candidate-9.2.1, but is valid in get 4.6.6

The code is as follows:

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    final c = AppController.to;
    debugPrint("MyApp: ${c.themeMode.value}, ${c.colorSelected.value}"); // Value has changed

    return GetMaterialApp(
      title: 'Calmonel',
      debugShowCheckedModeBanner: false,

      themeMode: c.themeMode.value,
      theme: ThemeData(
        brightness: Brightness.light,
        useMaterial3: c.useMaterial3.value,
        colorSchemeSeed: c.colorSelected.value.color,
        dividerTheme: const DividerThemeData(
          space: .0,
          indent: 16,
          thickness: .5,
          color: Color.fromRGBO(0, 0, 0, .1),
        ),
      ),
      darkTheme: ThemeData(
        brightness: Brightness.dark,
        useMaterial3: c.useMaterial3.value,
        colorSchemeSeed: c.colorSelected.value.color,
        dividerTheme: const DividerThemeData(
          space: .0,
          indent: 16,
          thickness: .5,
          color: Color.fromRGBO(255, 255, 255, .1),
        ),
      ),
     ...
}
ZhuJHua commented 1 month ago

just try Get.changeTheme