mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-04-25 17:49:18 -04:00
60 lines
1.8 KiB
Dart
60 lines
1.8 KiB
Dart
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,
|
|
);
|
|
}
|
|
}
|