Skip to content

Commit

Permalink
FIX: Add custom Color object toString that always works.
Browse files Browse the repository at this point in the history
  • Loading branch information
rydmike committed Nov 27, 2024
1 parent 9ee1a8a commit 6b81c2f
Show file tree
Hide file tree
Showing 3 changed files with 185 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:flutter/material.dart';

import '../../shared/const/app.dart';
import '../../shared/controllers/theme_controller.dart';
import '../../shared/utils/color_string.dart';
import '../theme/flex_theme_dark.dart';
import '../theme/flex_theme_light.dart';

Expand All @@ -21,104 +22,104 @@ String generateColorSchemeDartCode(
/// Requires Flutter 3.22.0 or later.
const ColorScheme lightColorScheme = ColorScheme(
brightness: ${lightScheme.brightness},
primary: ${lightScheme.primary},
onPrimary: ${lightScheme.onPrimary},
primaryContainer: ${lightScheme.primaryContainer},
onPrimaryContainer: ${lightScheme.onPrimaryContainer},
primaryFixed: ${lightScheme.primaryFixed},
primaryFixedDim: ${lightScheme.primaryFixedDim},
onPrimaryFixed: ${lightScheme.onPrimaryFixed},
onPrimaryFixedVariant: ${lightScheme.onPrimaryFixedVariant},
secondary: ${lightScheme.secondary},
onSecondary: ${lightScheme.onSecondary},
secondaryContainer: ${lightScheme.secondaryContainer},
onSecondaryContainer: ${lightScheme.onSecondaryContainer},
secondaryFixed: ${lightScheme.secondaryFixed},
secondaryFixedDim: ${lightScheme.secondaryFixedDim},
onSecondaryFixed: ${lightScheme.onSecondaryFixed},
onSecondaryFixedVariant: ${lightScheme.onSecondaryFixedVariant},
tertiary: ${lightScheme.tertiary},
onTertiary: ${lightScheme.onTertiary},
tertiaryContainer: ${lightScheme.tertiaryContainer},
onTertiaryContainer: ${lightScheme.onTertiaryContainer},
tertiaryFixed: ${lightScheme.tertiaryFixed},
tertiaryFixedDim: ${lightScheme.tertiaryFixedDim},
onTertiaryFixed: ${lightScheme.onTertiaryFixed},
onTertiaryFixedVariant: ${lightScheme.onTertiaryFixedVariant},
error: ${lightScheme.error},
onError: ${lightScheme.onError},
errorContainer: ${lightScheme.errorContainer},
onErrorContainer: ${lightScheme.onErrorContainer},
surface: ${lightScheme.surface},
onSurface: ${lightScheme.onSurface},
surfaceDim: ${lightScheme.surfaceDim},
surfaceBright: ${lightScheme.surfaceBright},
surfaceContainerLowest: ${lightScheme.surfaceContainerLowest},
surfaceContainerLow: ${lightScheme.surfaceContainerLow},
surfaceContainer: ${lightScheme.surfaceContainer},
surfaceContainerHigh: ${lightScheme.surfaceContainerHigh},
surfaceContainerHighest: ${lightScheme.surfaceContainerHighest},
onSurfaceVariant: ${lightScheme.onSurfaceVariant},
outline: ${lightScheme.outline},
outlineVariant: ${lightScheme.outlineVariant},
shadow: ${lightScheme.shadow},
scrim: ${lightScheme.scrim},
inverseSurface: ${lightScheme.inverseSurface},
onInverseSurface: ${lightScheme.onInverseSurface},
inversePrimary: ${lightScheme.inversePrimary},
surfaceTint: ${lightScheme.surfaceTint},
primary: ${lightScheme.primary.toColorString()},
onPrimary: ${lightScheme.onPrimary.toColorString()},
primaryContainer: ${lightScheme.primaryContainer.toColorString()},
onPrimaryContainer: ${lightScheme.onPrimaryContainer.toColorString()},
primaryFixed: ${lightScheme.primaryFixed.toColorString()},
primaryFixedDim: ${lightScheme.primaryFixedDim.toColorString()},
onPrimaryFixed: ${lightScheme.onPrimaryFixed.toColorString()},
onPrimaryFixedVariant: ${lightScheme.onPrimaryFixedVariant.toColorString()},
secondary: ${lightScheme.secondary.toColorString()},
onSecondary: ${lightScheme.onSecondary.toColorString()},
secondaryContainer: ${lightScheme.secondaryContainer.toColorString()},
onSecondaryContainer: ${lightScheme.onSecondaryContainer.toColorString()},
secondaryFixed: ${lightScheme.secondaryFixed.toColorString()},
secondaryFixedDim: ${lightScheme.secondaryFixedDim.toColorString()},
onSecondaryFixed: ${lightScheme.onSecondaryFixed.toColorString()},
onSecondaryFixedVariant: ${lightScheme.onSecondaryFixedVariant.toColorString()},
tertiary: ${lightScheme.tertiary.toColorString()},
onTertiary: ${lightScheme.onTertiary.toColorString()},
tertiaryContainer: ${lightScheme.tertiaryContainer.toColorString()},
onTertiaryContainer: ${lightScheme.onTertiaryContainer.toColorString()},
tertiaryFixed: ${lightScheme.tertiaryFixed.toColorString()},
tertiaryFixedDim: ${lightScheme.tertiaryFixedDim.toColorString()},
onTertiaryFixed: ${lightScheme.onTertiaryFixed.toColorString()},
onTertiaryFixedVariant: ${lightScheme.onTertiaryFixedVariant.toColorString()},
error: ${lightScheme.error.toColorString()},
onError: ${lightScheme.onError.toColorString()},
errorContainer: ${lightScheme.errorContainer.toColorString()},
onErrorContainer: ${lightScheme.onErrorContainer.toColorString()},
surface: ${lightScheme.surface.toColorString()},
onSurface: ${lightScheme.onSurface.toColorString()},
surfaceDim: ${lightScheme.surfaceDim.toColorString()},
surfaceBright: ${lightScheme.surfaceBright.toColorString()},
surfaceContainerLowest: ${lightScheme.surfaceContainerLowest.toColorString()},
surfaceContainerLow: ${lightScheme.surfaceContainerLow.toColorString()},
surfaceContainer: ${lightScheme.surfaceContainer.toColorString()},
surfaceContainerHigh: ${lightScheme.surfaceContainerHigh.toColorString()},
surfaceContainerHighest: ${lightScheme.surfaceContainerHighest.toColorString()},
onSurfaceVariant: ${lightScheme.onSurfaceVariant.toColorString()},
outline: ${lightScheme.outline.toColorString()},
outlineVariant: ${lightScheme.outlineVariant.toColorString()},
shadow: ${lightScheme.shadow.toColorString()},
scrim: ${lightScheme.scrim.toColorString()},
inverseSurface: ${lightScheme.inverseSurface.toColorString()},
onInverseSurface: ${lightScheme.onInverseSurface.toColorString()},
inversePrimary: ${lightScheme.inversePrimary.toColorString()},
surfaceTint: ${lightScheme.surfaceTint.toColorString()},
);
/// Dark [ColorScheme] made with FlexColorScheme v${App.version}.
/// Requires Flutter 3.22.0 or later.
const ColorScheme darkColorScheme = ColorScheme(
brightness: ${darkScheme.brightness},
primary: ${darkScheme.primary},
onPrimary: ${darkScheme.onPrimary},
primaryContainer: ${darkScheme.primaryContainer},
onPrimaryContainer: ${darkScheme.onPrimaryContainer},
primaryFixed: ${darkScheme.primaryFixed},
primaryFixedDim: ${darkScheme.primaryFixedDim},
onPrimaryFixed: ${darkScheme.onPrimaryFixed},
onPrimaryFixedVariant: ${darkScheme.onPrimaryFixedVariant},
secondary: ${darkScheme.secondary},
onSecondary: ${darkScheme.onSecondary},
secondaryContainer: ${darkScheme.secondaryContainer},
onSecondaryContainer: ${darkScheme.onSecondaryContainer},
secondaryFixed: ${darkScheme.secondaryFixed},
secondaryFixedDim: ${darkScheme.secondaryFixedDim},
onSecondaryFixed: ${darkScheme.onSecondaryFixed},
onSecondaryFixedVariant: ${darkScheme.onSecondaryFixedVariant},
tertiary: ${darkScheme.tertiary},
onTertiary: ${darkScheme.onTertiary},
tertiaryContainer: ${darkScheme.tertiaryContainer},
onTertiaryContainer: ${darkScheme.onTertiaryContainer},
tertiaryFixed: ${darkScheme.tertiaryFixed},
tertiaryFixedDim: ${darkScheme.tertiaryFixedDim},
onTertiaryFixed: ${darkScheme.onTertiaryFixed},
onTertiaryFixedVariant: ${darkScheme.onTertiaryFixedVariant},
error: ${darkScheme.error},
onError: ${darkScheme.onError},
errorContainer: ${darkScheme.errorContainer},
onErrorContainer: ${darkScheme.onErrorContainer},
surface: ${darkScheme.surface},
onSurface: ${darkScheme.onSurface},
surfaceDim: ${darkScheme.surfaceDim},
surfaceBright: ${darkScheme.surfaceBright},
surfaceContainerLowest: ${darkScheme.surfaceContainerLowest},
surfaceContainerLow: ${darkScheme.surfaceContainerLow},
surfaceContainer: ${darkScheme.surfaceContainer},
surfaceContainerHigh: ${darkScheme.surfaceContainerHigh},
surfaceContainerHighest: ${darkScheme.surfaceContainerHighest},
onSurfaceVariant: ${darkScheme.onSurfaceVariant},
outline: ${darkScheme.outline},
outlineVariant: ${darkScheme.outlineVariant},
shadow: ${darkScheme.shadow},
scrim: ${darkScheme.scrim},
inverseSurface: ${darkScheme.inverseSurface},
onInverseSurface: ${darkScheme.onInverseSurface},
inversePrimary: ${darkScheme.inversePrimary},
surfaceTint: ${darkScheme.surfaceTint},
primary: ${darkScheme.primary.toColorString()},
onPrimary: ${darkScheme.onPrimary.toColorString()},
primaryContainer: ${darkScheme.primaryContainer.toColorString()},
onPrimaryContainer: ${darkScheme.onPrimaryContainer.toColorString()},
primaryFixed: ${darkScheme.primaryFixed.toColorString()},
primaryFixedDim: ${darkScheme.primaryFixedDim.toColorString()},
onPrimaryFixed: ${darkScheme.onPrimaryFixed.toColorString()},
onPrimaryFixedVariant: ${darkScheme.onPrimaryFixedVariant.toColorString()},
secondary: ${darkScheme.secondary.toColorString()},
onSecondary: ${darkScheme.onSecondary.toColorString()},
secondaryContainer: ${darkScheme.secondaryContainer.toColorString()},
onSecondaryContainer: ${darkScheme.onSecondaryContainer.toColorString()},
secondaryFixed: ${darkScheme.secondaryFixed.toColorString()},
secondaryFixedDim: ${darkScheme.secondaryFixedDim.toColorString()},
onSecondaryFixed: ${darkScheme.onSecondaryFixed.toColorString()},
onSecondaryFixedVariant: ${darkScheme.onSecondaryFixedVariant.toColorString()},
tertiary: ${darkScheme.tertiary.toColorString()},
onTertiary: ${darkScheme.onTertiary.toColorString()},
tertiaryContainer: ${darkScheme.tertiaryContainer.toColorString()},
onTertiaryContainer: ${darkScheme.onTertiaryContainer.toColorString()},
tertiaryFixed: ${darkScheme.tertiaryFixed.toColorString()},
tertiaryFixedDim: ${darkScheme.tertiaryFixedDim.toColorString()},
onTertiaryFixed: ${darkScheme.onTertiaryFixed.toColorString()},
onTertiaryFixedVariant: ${darkScheme.onTertiaryFixedVariant.toColorString()},
error: ${darkScheme.error.toColorString()},
onError: ${darkScheme.onError.toColorString()},
errorContainer: ${darkScheme.errorContainer.toColorString()},
onErrorContainer: ${darkScheme.onErrorContainer.toColorString()},
surface: ${darkScheme.surface.toColorString()},
onSurface: ${darkScheme.onSurface.toColorString()},
surfaceDim: ${darkScheme.surfaceDim.toColorString()},
surfaceBright: ${darkScheme.surfaceBright.toColorString()},
surfaceContainerLowest: ${darkScheme.surfaceContainerLowest.toColorString()},
surfaceContainerLow: ${darkScheme.surfaceContainerLow.toColorString()},
surfaceContainer: ${darkScheme.surfaceContainer.toColorString()},
surfaceContainerHigh: ${darkScheme.surfaceContainerHigh.toColorString()},
surfaceContainerHighest: ${darkScheme.surfaceContainerHighest.toColorString()},
onSurfaceVariant: ${darkScheme.onSurfaceVariant.toColorString()},
outline: ${darkScheme.outline.toColorString()},
outlineVariant: ${darkScheme.outlineVariant.toColorString()},
shadow: ${darkScheme.shadow.toColorString()},
scrim: ${darkScheme.scrim.toColorString()},
inverseSurface: ${darkScheme.inverseSurface.toColorString()},
onInverseSurface: ${darkScheme.onInverseSurface.toColorString()},
inversePrimary: ${darkScheme.inversePrimary.toColorString()},
surfaceTint: ${darkScheme.surfaceTint.toColorString()},
);
''';
return code;
Expand Down
Loading

0 comments on commit 6b81c2f

Please sign in to comment.