Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MacosThemeData should implement value equality #505

Closed
craigdfoster opened this issue Feb 14, 2024 · 1 comment · Fixed by #509
Closed

MacosThemeData should implement value equality #505

craigdfoster opened this issue Feb 14, 2024 · 1 comment · Fixed by #509
Assignees
Labels
bug Something isn't working

Comments

@craigdfoster
Copy link

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 superlistapp/super_editor#1568

@craigdfoster craigdfoster added the bug Something isn't working label Feb 14, 2024
@Adrian-Samoticha
Copy link
Member

Adrian-Samoticha commented Apr 2, 2024

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.

@Adrian-Samoticha Adrian-Samoticha self-assigned this May 3, 2024
@Adrian-Samoticha Adrian-Samoticha mentioned this issue May 3, 2024
4 tasks
Adrian-Samoticha added a commit that referenced this issue May 3, 2024
* Update radio_button.dart

* Update CHANGELOG.md

* automatic changes

* install equatable

* make `MacosTypography` extend `Equatable`

* make `MacosThemeData` extend `Equatable`

* bump version to 2.0.6

* add changelog entry for version 2.0.6

* automatic changes

* organize imports

* automatic  changes

* migrate to `onKeyEvent` in three cases

* automatic changes

---------

Co-authored-by: Abbas Hussein <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants