flutter-theming
Migrate Flutter apps from Material 2 to Material 3 with automated component and theme updates.
- Identifies and replaces deprecated Material 2 components (FlatButton, RaisedButton, BottomNavigationBar, Drawer) with their Material 3 equivalents using a decision tree
- Converts legacy theme properties to Material 3 ColorScheme and removes deprecated accent color references (accentColor, accentColorBrightness, etc.)
- Normalizes all component themes to use
*ThemeDataclasses and ensuresuseMaterial3: trueacross light and dark themes - Applies platform-specific UI idioms for scrollbars, text selection, and button ordering across iOS, Android, Windows, macOS, Linux, and Web
- Validates output to eliminate legacy button classes and enforce single-source-of-truth color derivation from ColorScheme
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).
More from flutter/skills
flutter-building-layouts
Builds Flutter layouts using the constraint system and layout widgets. Use when creating or refining the UI structure of a Flutter application.
10.6Kflutter-architecting-apps
Architects a Flutter application using the recommended layered approach (UI, Logic, Data). Use when structuring a new project or refactoring for scalability.
10.4Kflutter-animating-apps
Implements animated effects, transitions, and motion in a Flutter app. Use when adding visual feedback, shared element transitions, or physics-based animations.
9.6Kflutter-managing-state
Manages application and ephemeral state in a Flutter app. Use when sharing data between widgets or handling complex UI state transitions.
9.6Kflutter-theming-apps
Customizes the visual appearance of a Flutter app using the theming system. Use when defining global styles, colors, or typography for an application.
9.5Kflutter-implementing-navigation-and-routing
Handles routing, navigation, and deep linking in a Flutter application. Use when moving between screens or setting up URL-based navigation.
9.3K