import 'package:flutter/material.dart'; import 'scale_scheme.dart'; import 'scale_theme.dart'; class ScaleTileTheme { ScaleTileTheme( {required this.textColor, required this.backgroundColor, required this.borderColor, required this.shapeBorder, required this.largeTextStyle, required this.smallTextStyle}); final Color textColor; final Color backgroundColor; final Color borderColor; final ShapeBorder shapeBorder; final TextStyle largeTextStyle; final TextStyle smallTextStyle; } extension ScaleTileThemeExt on ScaleTheme { ScaleTileTheme tileTheme( {bool disabled = false, bool selected = false, ScaleKind scaleKind = ScaleKind.primary}) { final tileColor = scheme.scale(!disabled ? scaleKind : ScaleKind.gray); final borderColor = selected ? tileColor.hoverBorder : tileColor.border; final backgroundColor = config.useVisualIndicators && !selected ? tileColor.borderText : borderColor; final textColor = config.useVisualIndicators && !selected ? borderColor : tileColor.borderText; final largeTextStyle = textTheme.labelMedium!.copyWith(color: textColor); final smallTextStyle = textTheme.labelSmall!.copyWith(color: textColor); final shapeBorder = RoundedRectangleBorder( side: config.useVisualIndicators ? BorderSide( width: 2, color: borderColor, ) : BorderSide.none, borderRadius: BorderRadius.circular(8 * config.borderRadiusScale)); return ScaleTileTheme( textColor: textColor, backgroundColor: backgroundColor, borderColor: borderColor, shapeBorder: shapeBorder, largeTextStyle: largeTextStyle, smallTextStyle: smallTextStyle, ); } }