{
    "url": "https://delaparra-services.nl/skills/flutter-theming",
    "locale": "en",
    "title": "Flutter Theming | DeLaParra Services",
    "description": "Use when creating, migrating or auditing a Material 3 theme in a Flutter app - assembling ColorScheme and ThemeData, theming a specific component, replacing a hardcoded colour with a theme token, or reviewing visual consistency. Triggers on any mention of colour, theme, dark mode, or \"this looks off-brand\" on a Flutter screen.",
    "alternates": {
        "en": "https://delaparra-services.nl/skills/flutter-theming",
        "nl": "https://delaparra-services.nl/nl/skills/flutter-theming"
    },
    "formats": {
        "csv": "https://delaparra-services.nl/skills/flutter-theming.csv",
        "md": "https://delaparra-services.nl/skills/flutter-theming.md",
        "json": "https://delaparra-services.nl/skills/flutter-theming.json",
        "zip": "https://delaparra-services.nl/skills/flutter-theming.zip",
        "pdf": "https://delaparra-services.nl/skills/flutter-theming.pdf"
    },
    "downloads": [
        {
            "url": "https://delaparra-services.nl/skills/flutter-theming.csv",
            "encodingFormat": "text/csv",
            "name": "flutter-theming.csv"
        },
        {
            "url": "https://delaparra-services.nl/skills/flutter-theming.json",
            "encodingFormat": "application/json",
            "name": "flutter-theming.json"
        },
        {
            "url": "https://delaparra-services.nl/skills/flutter-theming.md",
            "encodingFormat": "text/markdown",
            "name": "flutter-theming.md"
        },
        {
            "url": "https://delaparra-services.nl/skills/flutter-theming.pdf",
            "encodingFormat": "application/pdf",
            "name": "flutter-theming.pdf"
        },
        {
            "url": "https://delaparra-services.nl/skills/flutter-theming.zip",
            "encodingFormat": "application/zip",
            "name": "flutter-theming.zip"
        },
        {
            "url": "https://delaparra-services.nl/skills/flutter-theming/download",
            "encodingFormat": "application/zip",
            "name": "flutter-theming-files.zip"
        }
    ],
    "markdown": "# Flutter Theming\n\n \n\nUse when creating, migrating or auditing a Material 3 theme in a Flutter app - assembling ColorScheme and ThemeData, theming a specific component, replacing a hardcoded colour with a theme token, or reviewing visual consistency. Triggers on any mention of colour, theme, dark mode, or \"this looks off-brand\" on a Flutter screen.\n\n \n\n**Licence** MIT\n\n \n\n**Source** gabuldev/flutter-skills\n\n [Download zip](<https://delaparra-services.nl/skills/flutter-theming/download>)   \n\nYou are working on theming for a Flutter app. The patterns below assume a shared ` design_system/ ` package holding cross-app tokens (` DSColors `, ` DSSpacing `, ` DSRadius `, ` DSTypography `), with each app free to keep its own ` lib/theme/ ` for app-specific overrides.\n\n \n\nAlways prefer importing a token from the design system over duplicating the value in an app.\n\n  \n\n## Workflow: create\n\n \n\nScaffold a complete theme for the target app, taken from the request or the skill argument. **If it is not clear which app, ask before writing anything:** each one has its own theme directory and overwriting the wrong app is silent.\n\n \n\n### Theme Directory Structure\n\n \n\n```\n<app>/lib/shared/theme/\n├── app_theme.dart           ← ThemeData factory (light/dark)\n├── app_colors.dart          ← App-specific color overrides (imports DSColors)\n└── app_text_styles.dart     ← App-specific text style overrides (imports DSTypography)\n```\n\n \n\n### app\\_colors.dart\n\n \n\n```\nimport 'package:flutter/material.dart';\nimport 'package:design_system/design_system.dart';\n\n/// App-specific color aliases. Delegates to DSColors for shared tokens\n/// and defines overrides only when this app diverges from the design system.\nabstract final class AppColors {\n  // Re-export shared tokens for convenience\n  static const Color primary = DSColors.brandPrimary;\n  static const Color secondary = DSColors.brandSecondary;\n  static const Color error = DSColors.error;\n  static const Color success = DSColors.success;\n  static const Color warning = DSColors.warning;\n\n  // App-specific overrides\n  static const Color scaffoldBackground = Color(0xFFF8F9FA);\n  static const Color cardBackground = DSColors.neutral0;\n  static const Color divider = DSColors.neutral200;\n}\n```\n\n \n\n### app\\_text\\_styles.dart\n\n \n\n```\nimport 'package:flutter/material.dart';\nimport 'package:design_system/design_system.dart';\n\n/// App-specific text style overrides. Use DSTypography directly when possible.\nabstract final class AppTextStyles {\n  static TextStyle get pageTitle => DSTypography.headingH4;\n  static TextStyle get sectionTitle => DSTypography.headingH5;\n  static TextStyle get body => DSTypography.body14Regular;\n  static TextStyle get caption => DSTypography.caption;\n\n  // App-specific additions only\n  static TextStyle get price => DSTypography.price;\n}\n```\n\n \n\n### app\\_theme.dart (Material 3)\n\n \n\n```\nimport 'package:flutter/material.dart';\nimport 'package:design_system/design_system.dart';\nimport 'app_colors.dart';\n\nclass AppTheme {\n  static ThemeData light() {\n    final colorScheme = ColorScheme.fromSeed(\n      seedColor: AppColors.primary,\n      brightness: Brightness.light,\n    );\n\n    return ThemeData(\n      useMaterial3: true,\n      colorScheme: colorScheme,\n      fontFamily: 'Roboto',\n      scaffoldBackgroundColor: AppColors.scaffoldBackground,\n\n      // --- Component Themes (use *ThemeData suffix) ---\n      appBarTheme: AppBarThemeData(\n        backgroundColor: colorScheme.surface,\n        foregroundColor: colorScheme.onSurface,\n        elevation: 0,\n        centerTitle: false,\n      ),\n      cardTheme: CardThemeData(\n        elevation: 0,\n        shape: RoundedRectangleBorder(\n          borderRadius: DSRadius.lgBorderRadius,\n          side: BorderSide(color: AppColors.divider),\n        ),\n        color: AppColors.cardBackground,\n      ),\n      filledButtonTheme: FilledButtonThemeData(\n        style: FilledButton.styleFrom(\n          backgroundColor: AppColors.primary,\n          foregroundColor: DSColors.neutral0,\n          shape: RoundedRectangleBorder(\n            borderRadius: DSRadius.mdBorderRadius,\n          ),\n          minimumSize: const Size(double.infinity, 48),\n          textStyle: const TextStyle(\n            fontWeight: FontWeight.w600,\n            fontSize: 14,\n          ),\n        ),\n      ),\n      elevatedButtonTheme: ElevatedButtonThemeData(\n        style: ElevatedButton.styleFrom(\n          backgroundColor: AppColors.primary,\n          foregroundColor: DSColors.neutral0,\n          shape: RoundedRectangleBorder(\n            borderRadius: DSRadius.mdBorderRadius,\n          ),\n          minimumSize: const Size(double.infinity, 48),\n        ),\n      ),\n      outlinedButtonTheme: OutlinedButtonThemeData(\n        style: OutlinedButton.styleFrom(\n          foregroundColor: AppColors.primary,\n          side: BorderSide(color: AppColors.primary),\n          shape: RoundedRectangleBorder(\n            borderRadius: DSRadius.mdBorderRadius,\n          ),\n          minimumSize: const Size(double.infinity, 48),\n        ),\n      ),\n      textButtonTheme: TextButtonThemeData(\n        style: TextButton.styleFrom(\n          foregroundColor: AppColors.primary,\n        ),\n      ),\n      inputDecorationTheme: InputDecorationTheme(\n        border: OutlineInputBorder(\n          borderRadius: DSRadius.mdBorderRadius,\n        ),\n        contentPadding: const EdgeInsets.symmetric(\n          horizontal: DSSpacing.lg,\n          vertical: DSSpacing.md,\n        ),\n      ),\n      navigationBarTheme: NavigationBarThemeData(\n        indicatorColor: colorScheme.secondaryContainer,\n        labelTextStyle: WidgetStateProperty.resolveWith((states) {\n          if (states.contains(WidgetState.selected)) {\n            return DSTypography.label.copyWith(color: AppColors.primary);\n          }\n          return DSTypography.label;\n        }),\n      ),\n      dividerTheme: DividerThemeData(\n        color: AppColors.divider,\n        thickness: 1,\n        space: 0,\n      ),\n\n      // --- Typography ---\n      textTheme: const TextTheme(\n        displayLarge: DSTypography.headingH4,\n        headlineMedium: DSTypography.headingH5,\n        titleLarge: DSTypography.headingH6,\n        bodyLarge: DSTypography.body16Regular,\n        bodyMedium: DSTypography.body14Regular,\n        bodySmall: DSTypography.body12Regular,\n        labelSmall: DSTypography.label,\n      ),\n    );\n  }\n\n  static ThemeData dark() {\n    final colorScheme = ColorScheme.fromSeed(\n      seedColor: AppColors.primary,\n      brightness: Brightness.dark,\n    );\n\n    return ThemeData(\n      useMaterial3: true,\n      colorScheme: colorScheme,\n      fontFamily: 'Roboto',\n      // Mirror the light theme structure but with dark-appropriate values.\n      // Override specific component themes as needed.\n    );\n  }\n}\n```\n\n \n\n### Applying the Theme\n\n \n\nIn ` app_widget.dart `:\n\n \n\n```\nMaterialApp(\n  theme: AppTheme.light(),\n  darkTheme: AppTheme.dark(),\n  themeMode: ThemeMode.system,\n  // ...\n)\n```\n\n  \n\n## Workflow: migrate\n\n \n\nMigrate an existing app to Material 3 theming. Read the app's current ` app_widget.dart ` and any existing theme files first.\n\n \n\n### Migration Checklist\n\n \n\n1. **Enable Material 3**: Add ` useMaterial3: true ` to ` ThemeData ` \n1. **Replace ` primarySwatch `** with ` colorScheme: ColorScheme.fromSeed(seedColor: ...) ` \n1. **Apply deprecated replacements**:\n\n    Deprecated Replacement     ` accentColor ` ` colorScheme.secondary `   ` primaryColor ` (in ThemeData) ` colorScheme.primary `   ` AppBarTheme.color ` ` AppBarThemeData.backgroundColor `   ` AppBarTheme.brightness ` ` AppBarThemeData.systemOverlayStyle `   ` BottomNavigationBar ` ` NavigationBar `   ` FlatButton ` ` TextButton `   ` RaisedButton ` ` ElevatedButton `   ` ButtonTheme ` ` TextButtonThemeData ` / ` ElevatedButtonThemeData ` / ` OutlinedButtonThemeData `   ` MaterialStateProperty ` ` WidgetStateProperty `   ` MaterialState ` ` WidgetState `    \n\n1. **Normalize component theme class names** (use ` *ThemeData ` suffix):\n\n    Old Name Correct Name     ` CardTheme(...) ` constructor in ThemeData ` CardThemeData(...) `   ` AppBarTheme(...) ` ` AppBarThemeData(...) `   ` IconTheme(...) ` in ThemeData ` IconThemeData(...) `   ` TabBarTheme(...) ` ` TabBarThemeData(...) `   ` DialogTheme(...) ` ` DialogThemeData(...) `   ` BottomSheetTheme(...) ` ` BottomSheetThemeData(...) `   ` TooltipTheme(...) ` ` TooltipThemeData(...) `    \n\n1. **Replace hardcoded colors** with ` DSColors ` or ` Theme.of(context).colorScheme ` references \n1. **Update typography** to Material 3 scale:\n\n    Old (Material 2) New (Material 3)     ` headline1 ` ` displayLarge `   ` headline2 ` ` displayMedium `   ` headline3 ` ` displaySmall `   ` headline4 ` ` headlineMedium `   ` headline5 ` ` headlineSmall `   ` headline6 ` ` titleLarge `   ` subtitle1 ` ` titleMedium `   ` subtitle2 ` ` titleSmall `   ` bodyText1 ` ` bodyLarge `   ` bodyText2 ` ` bodyMedium `   ` caption ` ` bodySmall `   ` button ` ` labelLarge `   ` overline ` ` labelSmall `    \n\n### Button Styling After Migration\n\n \n\n```\n// ElevatedButton with full styling\nElevatedButton(\n  style: ElevatedButton.styleFrom(\n    backgroundColor: AppColors.primary,\n    foregroundColor: Colors.white,\n    disabledBackgroundColor: DSColors.neutral200,\n    shape: RoundedRectangleBorder(\n      borderRadius: DSRadius.mdBorderRadius,\n    ),\n    padding: const EdgeInsets.symmetric(\n      horizontal: DSSpacing.xl,\n      vertical: DSSpacing.md,\n    ),\n  ),\n  onPressed: () {},\n  child: const Text('Action'),\n)\n\n// FilledButton (Material 3 preferred primary action)\nFilledButton(\n  onPressed: () {},\n  child: const Text('Primary Action'),\n)\n\n// FilledButton.tonal (secondary emphasis)\nFilledButton.tonal(\n  onPressed: () {},\n  child: const Text('Secondary Action'),\n)\n```\n\n \n\n### State-Dependent Styling\n\n \n\n```\n// Use WidgetStateProperty (NOT MaterialStateProperty) for state-dependent styles\nButtonStyle(\n  backgroundColor: WidgetStateProperty.resolveWith((states) {\n    if (states.contains(WidgetState.disabled)) return DSColors.neutral200;\n    if (states.contains(WidgetState.pressed)) return AppColors.primary.withValues(alpha: 0.8);\n    if (states.contains(WidgetState.hovered)) return AppColors.primary.withValues(alpha: 0.9);\n    return AppColors.primary;\n  }),\n  foregroundColor: WidgetStateProperty.resolveWith((states) {\n    if (states.contains(WidgetState.disabled)) return DSColors.neutral500;\n    return DSColors.neutral0;\n  }),\n  overlayColor: WidgetStateProperty.resolveWith((states) {\n    if (states.contains(WidgetState.pressed)) return Colors.white.withValues(alpha: 0.12);\n    if (states.contains(WidgetState.hovered)) return Colors.white.withValues(alpha: 0.08);\n    return null;\n  }),\n)\n\n// Shorthand for simple cases\nWidgetStateProperty.all(DSColors.neutral0)\n```\n\n  \n\n## Workflow: audit\n\n \n\nAudit theme consistency across apps and report issues.\n\n \n\n### Audit Steps\n\n \n\n1. Read every app's root widget (` app_widget.dart ` / ` main.dart `) \n1. Read all files under ` */lib/theme/ `, ` */lib/shared/theme/ ` \n1. Search for hardcoded ` Color(0x...) ` values in widget files (outside theme files) \n1. Search for deprecated APIs: ` accentColor `, ` primarySwatch `, ` FlatButton `, ` RaisedButton `, ` MaterialState ` \n1. Check that all apps import from ` design_system ` instead of duplicating token values \n1. Verify ` useMaterial3: true ` is set in all apps\n\n \n\n### Report Format\n\n \n\nProduce a markdown report with:\n\n \n\n```\n## Theme Audit\n\n### Material 3 Status\n- <app>: [enabled/disabled]   (one line per app)\n\n### Deprecated API Usage\n- [file:line] — description of deprecated usage and fix\n\n### Hardcoded Colors (should use DSColors/AppColors)\n- [file:line] — Color(0xFF...) → suggested token\n\n### Token Duplication\n- [file] duplicates [token] already in design_system\n\n### Recommendations\n1. ...\n```\n\n  \n\n## Instructions\n\n \n\n1. Always read the app's existing ` app_widget.dart ` and theme files before making changes \n1. Import shared tokens from ` design_system ` — never duplicate ` DSColors `, ` DSSpacing `, ` DSRadius `, or ` DSTypography ` values \n1. Use ` abstract final class ` for all token/color/style classes (cannot be instantiated) \n1. All token values must be ` static const ` \n1. Use ` ColorScheme.fromSeed() ` — never construct ` ColorScheme() ` manually unless overriding specific slots \n1. Use ` *ThemeData ` suffix for component themes (` CardThemeData `, ` AppBarThemeData `, etc.) \n1. Use ` WidgetStateProperty ` and ` WidgetState ` — never ` MaterialStateProperty ` or ` MaterialState ` \n1. Use ` .withValues(alpha: 0.5) ` — never ` .withOpacity(0.5) ` (deprecated) \n1. Prefer ` FilledButton ` for primary actions over ` ElevatedButton ` (Material 3 convention) \n1. Always set ` useMaterial3: true ` \n1. When the app already has an app-local ` <App>DesignTokens `-style class, migrate its values into the ` design_system ` package or into ` app_colors.dart ` / ` app_text_styles.dart ` — do not leave duplicate token files\n\n \n\n## Files\n\n \n\n- ` LICENSE ` \n- ` SKILL.md ` \n- ` SOURCE.md `\n\n \n\n## Related terms\n\n \n\n- [Flutter Theming](<https://delaparra-services.nl/knowledge-hub/flutter-theming>)\n\n \n\n## Related services\n\n \n\n- [App development](<https://delaparra-services.nl/services#service-02>)\n\n \n\n[Installing an agent skill in Claude Code, Codex, Cursor and Copilot](<https://delaparra-services.nl/manuals/een-skill-installeren-in-je-ai-assistent>)\n\n[HTML version](https://delaparra-services.nl/skills/flutter-theming)\n",
    "structured_data": {
        "@context": "https://schema.org",
        "@graph": [
            {
                "@type": "Organization",
                "@id": "https://delaparra-services.nl/#practice",
                "logo": "https://delaparra-services.nl/logo.png",
                "name": "DeLaParra Services",
                "legalName": "DeLaParra Services",
                "url": "https://delaparra-services.nl/",
                "description": "Bespoke software, web applications and mobile apps, developed in Laravel by a single developer in Groningen. Fixed price agreed in advance, full source code provided upon delivery.",
                "email": "info@delaparra-services.nl",
                "address": {
                    "@type": "PostalAddress",
                    "addressLocality": "Groningen",
                    "addressRegion": "Groningen",
                    "addressCountry": "NL"
                },
                "areaServed": "Groningen, the Netherlands",
                "knowsLanguage": [
                    "en",
                    "nl"
                ],
                "knowsAbout": [
                    "Web design and development",
                    "App development",
                    "Custom software and web applications",
                    "OpenSpec",
                    "AI code review",
                    "Your own coding agent"
                ],
                "founder": {
                    "@id": "https://delaparra-services.nl/#person"
                }
            },
            {
                "@type": "WebPage",
                "@id": "https://delaparra-services.nl/skills/flutter-theming#webpage",
                "url": "https://delaparra-services.nl/skills/flutter-theming",
                "name": "Flutter Theming | DeLaParra Services",
                "description": "Use when creating, migrating or auditing a Material 3 theme in a Flutter app - assembling ColorScheme and ThemeData, theming a specific component, replacing a hardcoded colour with a theme token, or reviewing visual consistency. Triggers on any mention of colour, theme, dark mode, or \"this looks off-brand\" on a Flutter screen.",
                "isPartOf": {
                    "@id": "https://delaparra-services.nl/#website"
                },
                "about": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "inLanguage": "en",
                "breadcrumb": {
                    "@id": "https://delaparra-services.nl/skills/flutter-theming#breadcrumb"
                }
            },
            {
                "@type": "BreadcrumbList",
                "@id": "https://delaparra-services.nl/skills/flutter-theming#breadcrumb",
                "itemListElement": [
                    {
                        "@type": "ListItem",
                        "position": 1,
                        "name": "Home",
                        "item": "https://delaparra-services.nl/"
                    },
                    {
                        "@type": "ListItem",
                        "position": 2,
                        "name": "Flutter Theming"
                    }
                ]
            },
            {
                "@type": "Person",
                "@id": "https://delaparra-services.nl/#person",
                "name": "Reinier de la Parra",
                "url": "https://delaparra-services.nl/about"
            },
            {
                "@type": "SoftwareSourceCode",
                "@id": "https://delaparra-services.nl/skills/flutter-theming#skill",
                "url": "https://delaparra-services.nl/skills/flutter-theming",
                "name": "Flutter Theming",
                "description": "Use when creating, migrating or auditing a Material 3 theme in a Flutter app - assembling ColorScheme and ThemeData, theming a specific component, replacing a hardcoded colour with a theme token, or reviewing visual consistency. Triggers on any mention of colour, theme, dark mode, or \"this looks off-brand\" on a Flutter screen.",
                "inLanguage": "en",
                "license": "https://spdx.org/licenses/MIT.html",
                "subjectOf": {
                    "@id": "https://delaparra-services.nl/skills/flutter-theming#dataset"
                }
            },
            {
                "@type": "Dataset",
                "@id": "https://delaparra-services.nl/skills/flutter-theming#dataset",
                "name": "Flutter Theming",
                "description": "Use when creating, migrating or auditing a Material 3 theme in a Flutter app - assembling ColorScheme and ThemeData, theming a specific component, replacing a hardcoded colour with a theme token, or reviewing visual consistency. Triggers on any mention of colour, theme, dark mode, or \"this looks off-brand\" on a Flutter screen.",
                "url": "https://delaparra-services.nl/skills/flutter-theming",
                "identifier": "https://delaparra-services.nl/skills/flutter-theming#dataset",
                "about": {
                    "@id": "https://delaparra-services.nl/skills/flutter-theming#skill"
                },
                "creditText": "gabuldev/flutter-skills",
                "publisher": {
                    "@id": "https://delaparra-services.nl/#practice"
                },
                "license": "https://spdx.org/licenses/MIT.html",
                "isAccessibleForFree": true,
                "inLanguage": "en",
                "dateModified": "2026-11-30T13:17:19+00:00",
                "isPartOf": {
                    "@type": "Dataset",
                    "@id": "https://delaparra-services.nl/knowledge-hub#skills",
                    "name": "Skills for AI coding assistants",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "includedInDataCatalog": {
                    "@type": "DataCatalog",
                    "@id": "https://delaparra-services.nl/knowledge-hub#catalog",
                    "name": "Knowledge hub data catalog",
                    "url": "https://delaparra-services.nl/knowledge-hub"
                },
                "distribution": [
                    {
                        "@type": "DataDownload",
                        "name": "flutter-theming.csv",
                        "encodingFormat": "text/csv",
                        "contentUrl": "https://delaparra-services.nl/skills/flutter-theming.csv",
                        "inLanguage": "en",
                        "dateModified": "2026-11-30T13:17:19+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "flutter-theming.json",
                        "encodingFormat": "application/json",
                        "contentUrl": "https://delaparra-services.nl/skills/flutter-theming.json",
                        "inLanguage": "en",
                        "dateModified": "2026-11-30T13:17:19+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "flutter-theming.md",
                        "encodingFormat": "text/markdown",
                        "contentUrl": "https://delaparra-services.nl/skills/flutter-theming.md",
                        "inLanguage": "en",
                        "dateModified": "2026-11-30T13:17:19+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "flutter-theming.pdf",
                        "encodingFormat": "application/pdf",
                        "contentUrl": "https://delaparra-services.nl/skills/flutter-theming.pdf",
                        "inLanguage": "en",
                        "dateModified": "2026-11-30T13:17:19+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "flutter-theming.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/skills/flutter-theming.zip",
                        "inLanguage": "en",
                        "dateModified": "2026-11-30T13:17:19+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    },
                    {
                        "@type": "DataDownload",
                        "name": "flutter-theming-files.zip",
                        "encodingFormat": "application/zip",
                        "contentUrl": "https://delaparra-services.nl/skills/flutter-theming/download",
                        "inLanguage": "en",
                        "dateModified": "2026-11-30T13:17:19+00:00",
                        "license": "https://spdx.org/licenses/MIT.html"
                    }
                ]
            }
        ]
    }
}