checkboxTheme static method

CheckboxThemeData checkboxTheme({
  1. required ColorScheme colorScheme,
  2. SchemeColor? baseSchemeColor,
  3. double? splashRadius,
  4. bool? unselectedIsColored,
  5. bool? useTintedInteraction,
  6. bool? useTintedDisable,
  7. bool? useMaterial3,
})

An opinionated CheckboxThemeData theme.

Requires a ColorScheme in colorScheme. The color scheme would typically be equal the color scheme also used to define the color scheme for your app theme.

The splashRadius is not used by FlexColorScheme sub-themes.

The named parameters are:

  • colorScheme Typically the same ColorScheme that is also used for your ThemeData.

  • baseSchemeColor Selects which color from the passed in colorScheme to use as the main color for the checkbox.

All colors in the color scheme are not good choices, but some work well.

If not defined, ColorScheme.primary will be used. This is more in-line with M3 design, but applied to M2 switch. The M3 color design specification for the secondary color, is a poor choice for toggles and switches, primary color works better.

  • splashRadius The splash radius of the circular Material ink response.

Defaults to kRadialReactionRadius = 20.

  • unselectedIsColored Defines if unselected Checkbox is also themed to be baseSchemeColor.

If false, it is grey like in Flutter SDK.

If undefined, defaults to false.

  • useTintedInteraction Defines if the theme uses tinted interaction effects.

If undefined, defaults to false.

  • useTintedDisable Defines if the theme uses tinted disabled color.

If undefined, defaults to false.

  • useMaterial3 A temporary flag used to disable Material-3 design and use legacy Material-2 design instead. Material-3 design is the default. Material-2 will be deprecated in Flutter.

If set to true, the theme will use Material3 default styles when properties are undefined, if false defaults will use FlexColorScheme's own opinionated default values.

The M2/M3 defaults will only be used for properties that are not defined, if defined they keep their defined values.

If undefined, defaults to true.

Implementation

static CheckboxThemeData checkboxTheme({
  /// Typically the same `ColorScheme` that is also used for your `ThemeData`.
  required final ColorScheme colorScheme,

  /// Selects which color from the passed in colorScheme to use as the main
  /// color for the checkbox.
  ///
  /// All colors in the color scheme are not good choices, but some work well.
  ///
  /// If not defined, [ColorScheme.primary] will be used. This is more in-line
  /// with M3 design, but applied to M2 switch. The M3 color design
  /// specification for the secondary color, is a poor choice for toggles and
  /// switches, primary color works better.
  final SchemeColor? baseSchemeColor,

  /// The splash radius of the circular Material ink response.
  ///
  /// Defaults to kRadialReactionRadius = 20.
  final double? splashRadius,

  /// Defines if unselected [Checkbox] is also themed to be [baseSchemeColor].
  ///
  /// If false, it is grey like in Flutter SDK.
  ///
  /// If undefined, defaults to false.
  final bool? unselectedIsColored,

  /// Defines if the theme uses tinted interaction effects.
  ///
  /// If undefined, defaults to false.
  final bool? useTintedInteraction,

  /// Defines if the theme uses tinted disabled color.
  ///
  /// If undefined, defaults to false.
  final bool? useTintedDisable,

  /// A temporary flag used to disable Material-3 design and use legacy
  /// Material-2 design instead. Material-3 design is the default.
  /// Material-2 will be deprecated in Flutter.
  ///
  /// If set to true, the theme will use Material3 default styles when
  /// properties are undefined, if false defaults will use FlexColorScheme's
  /// own opinionated default values.
  ///
  /// The M2/M3 defaults will only be used for properties that are not
  /// defined, if defined they keep their defined values.
  ///
  /// If undefined, defaults to true.
  final bool? useMaterial3,
}) =>
    _checkboxTheme(
      colorScheme: colorScheme,
      baseSchemeColor: baseSchemeColor,
      splashRadius: splashRadius,
      unselectedIsColored: unselectedIsColored,
      useTintedInteraction: useTintedInteraction,
      useTintedDisable: useTintedDisable,
      useMaterial3: useMaterial3,
    );