macosui / macos_ui

Flutter widgets and themes implementing the current macOS design language.
https://macosui.github.io/macos_ui/#/
MIT License
1.79k stars 174 forks source link

MacosThemeData should implement value equality #505

Closed craigdfoster closed 2 months ago

craigdfoster commented 5 months ago

The MacosThemeData class does not implement value equality as ThemeData from the Material package does.

This causes _InheritedMacosTheme.updateShouldNotify to return true on every widget tree rebuild if, for example, the light theme and dark theme are instantiated the way they are in the MacosUI sample project.

class _InheritedMacosTheme extends InheritedWidget {
  // ignore: use_super_parameters
  const _InheritedMacosTheme({
    Key? key,
    required this.theme,
    required super.child,
  }) : super(key: key);

  final MacosTheme theme;

  /// Will always return true when MacosThemeData objects are instantiated inline in MyApp example below
  @override
  bool updateShouldNotify(_InheritedMacosTheme old) =>
      theme.data != old.theme.data;
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);
  @override
  Widget build(BuildContext context) {
    return MacosApp(
      theme: MacosThemeData.light(),
      darkTheme: MacosThemeData.dark(),
      themeMode: ThemeMode.system,
    );
  }
}

Steps To Reproduce

See https://github.com/superlistapp/super_editor/issues/1568

Adrian-Samoticha commented 3 months ago

Alright, first of all, excuse the delay. All maintainers suffer from rather low bandwidth right now.

I’d like to notify you that I have received your issue and will try to allocate some time to address it.