flutter-theming
Goal
Updates and manages Flutter application styling by migrating legacy Material 2 implementations to Material 3, normalizing component themes, updating deprecated button classes, and adapting UI idioms for cross-platform consistency. Assumes a Flutter environment using Dart.
Instructions
-
Analyze Current Theme State Review the existing Flutter codebase to identify legacy Material 2 components, deprecated button classes (
FlatButton,RaisedButton,OutlineButton), and outdated theme properties (e.g.,accentColor,colorinAppBarTheme). STOP AND ASK THE USER: "What is the primary seed color for the new Material 3 ColorScheme, and which target platforms (iOS, Android, Windows, macOS, Linux, Web) should be prioritized for platform idioms?" -
Decision Logic: Component Migration When encountering legacy widgets, use the following decision tree to determine the replacement:
- IF
BottomNavigationBar-> REPLACE WITHNavigationBar(usesNavigationDestination). - IF
Drawer-> REPLACE WITHNavigationDrawer(usesNavigationDrawerDestination). - IF
ToggleButtons-> REPLACE WITHSegmentedButton(usesButtonSegmentandSetfor selection). - IF
FlatButton-> REPLACE WITHTextButton. - IF
RaisedButton-> REPLACE WITHElevatedButton(orFilledButtonfor no elevation). - IF
OutlineButton-> REPLACE WITHOutlinedButton.
- IF
-
Implement App-Wide Material 3 Theme Define the global
ThemeDatausingColorScheme.fromSeed. EnsureuseMaterial3is implicitly or explicitly true. Remove all references to deprecated accent properties (accentColor,accentColorBrightness,accentTextTheme,accentIconTheme).