mirror of
https://gitlab.com/veilid/veilidchat.git
synced 2025-07-23 22:51:00 -04:00
ui cleanup
This commit is contained in:
parent
d460a0388c
commit
77c68aa45f
57 changed files with 1158 additions and 914 deletions
|
@ -1,9 +1,6 @@
|
|||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'radix_generator.dart';
|
||||
import 'scale_theme/scale_color.dart';
|
||||
import 'scale_theme/scale_input_decorator_theme.dart';
|
||||
import 'scale_theme/scale_scheme.dart';
|
||||
import 'scale_theme/scale_theme.dart';
|
||||
|
||||
ScaleColor _contrastScaleColor(
|
||||
|
@ -29,6 +26,7 @@ ScaleColor _contrastScaleColor(
|
|||
primaryText: front,
|
||||
borderText: back,
|
||||
dialogBorder: front,
|
||||
dialogBorderText: back,
|
||||
calloutBackground: front,
|
||||
calloutText: back,
|
||||
);
|
||||
|
@ -246,7 +244,7 @@ ThemeData contrastGenerator({
|
|||
TextTheme? customTextTheme,
|
||||
}) {
|
||||
final textTheme = customTextTheme ?? makeRadixTextTheme(brightness);
|
||||
final scaleScheme = _contrastScaleScheme(
|
||||
final scheme = _contrastScaleScheme(
|
||||
brightness: brightness,
|
||||
primaryFront: primaryFront,
|
||||
primaryBack: primaryBack,
|
||||
|
@ -259,55 +257,51 @@ ThemeData contrastGenerator({
|
|||
errorFront: errorFront,
|
||||
errorBack: errorBack,
|
||||
);
|
||||
final colorScheme = scaleScheme.toColorScheme(
|
||||
brightness,
|
||||
);
|
||||
final scaleTheme = ScaleTheme(
|
||||
textTheme: textTheme, scheme: scaleScheme, config: scaleConfig);
|
||||
|
||||
final baseThemeData = ThemeData.from(
|
||||
colorScheme: colorScheme, textTheme: textTheme, useMaterial3: true);
|
||||
final scaleTheme =
|
||||
ScaleTheme(textTheme: textTheme, scheme: scheme, config: scaleConfig);
|
||||
|
||||
final baseThemeData = scaleTheme.toThemeData(brightness);
|
||||
|
||||
final elevatedButtonTheme = ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: scheme.primaryScale.elementBackground,
|
||||
foregroundColor: scheme.primaryScale.appText,
|
||||
disabledBackgroundColor:
|
||||
scheme.grayScale.elementBackground.withAlpha(0x7F),
|
||||
disabledForegroundColor: scheme.grayScale.appText.withAlpha(0x7F),
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: scheme.primaryScale.border),
|
||||
borderRadius:
|
||||
BorderRadius.circular(8 * scaleConfig.borderRadiusScale)))
|
||||
.copyWith(side: WidgetStateProperty.resolveWith((states) {
|
||||
if (states.contains(WidgetState.disabled)) {
|
||||
return BorderSide(color: scheme.grayScale.border.withAlpha(0x7F));
|
||||
} else if (states.contains(WidgetState.pressed)) {
|
||||
return BorderSide(
|
||||
color: scheme.primaryScale.border,
|
||||
strokeAlign: BorderSide.strokeAlignOutside);
|
||||
} else if (states.contains(WidgetState.hovered)) {
|
||||
return BorderSide(color: scheme.primaryScale.hoverBorder);
|
||||
} else if (states.contains(WidgetState.focused)) {
|
||||
return BorderSide(color: scheme.primaryScale.hoverBorder, width: 2);
|
||||
}
|
||||
return BorderSide(color: scheme.primaryScale.border);
|
||||
})));
|
||||
|
||||
final themeData = baseThemeData.copyWith(
|
||||
appBarTheme: baseThemeData.appBarTheme.copyWith(
|
||||
backgroundColor: scaleScheme.primaryScale.border,
|
||||
foregroundColor: scaleScheme.primaryScale.borderText),
|
||||
bottomSheetTheme: baseThemeData.bottomSheetTheme.copyWith(
|
||||
elevation: 0,
|
||||
modalElevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(16 * scaleConfig.borderRadiusScale),
|
||||
topRight:
|
||||
Radius.circular(16 * scaleConfig.borderRadiusScale)))),
|
||||
canvasColor: scaleScheme.primaryScale.subtleBackground,
|
||||
chipTheme: baseThemeData.chipTheme.copyWith(
|
||||
backgroundColor: scaleScheme.primaryScale.elementBackground,
|
||||
selectedColor: scaleScheme.primaryScale.activeElementBackground,
|
||||
surfaceTintColor: scaleScheme.primaryScale.hoverElementBackground,
|
||||
checkmarkColor: scaleScheme.primaryScale.border,
|
||||
side: BorderSide(color: scaleScheme.primaryScale.border)),
|
||||
elevatedButtonTheme: ElevatedButtonThemeData(
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: scaleScheme.primaryScale.elementBackground,
|
||||
foregroundColor: scaleScheme.primaryScale.appText,
|
||||
disabledBackgroundColor: scaleScheme.grayScale.elementBackground,
|
||||
disabledForegroundColor: scaleScheme.grayScale.appText,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(color: scaleScheme.primaryScale.border),
|
||||
borderRadius:
|
||||
BorderRadius.circular(8 * scaleConfig.borderRadiusScale))),
|
||||
),
|
||||
// chipTheme: baseThemeData.chipTheme.copyWith(
|
||||
// backgroundColor: scaleScheme.primaryScale.elementBackground,
|
||||
// selectedColor: scaleScheme.primaryScale.activeElementBackground,
|
||||
// surfaceTintColor: scaleScheme.primaryScale.hoverElementBackground,
|
||||
// checkmarkColor: scaleScheme.primaryScale.border,
|
||||
// side: BorderSide(color: scaleScheme.primaryScale.border)),
|
||||
elevatedButtonTheme: elevatedButtonTheme,
|
||||
textSelectionTheme: TextSelectionThemeData(
|
||||
cursorColor: scaleScheme.primaryScale.appText,
|
||||
selectionColor: scaleScheme.primaryScale.appText.withAlpha(0x7F),
|
||||
selectionHandleColor: scaleScheme.primaryScale.appText),
|
||||
inputDecorationTheme:
|
||||
ScaleInputDecoratorTheme(scaleScheme, scaleConfig, textTheme),
|
||||
extensions: <ThemeExtension<dynamic>>[
|
||||
scaleScheme,
|
||||
scaleConfig,
|
||||
scaleTheme
|
||||
]);
|
||||
cursorColor: scheme.primaryScale.appText,
|
||||
selectionColor: scheme.primaryScale.appText.withAlpha(0x7F),
|
||||
selectionHandleColor: scheme.primaryScale.appText),
|
||||
extensions: <ThemeExtension<dynamic>>[scheme, scaleConfig, scaleTheme]);
|
||||
|
||||
return themeData;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue