fix:按照shadcn_ui对着demo_shadcn对齐
This commit is contained in:
@@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
|
||||
|
||||
import 'yanting_text.dart';
|
||||
import 'yanting_tokens.dart';
|
||||
import 'wise_tokens.dart';
|
||||
|
||||
ThemeData buildAppTheme() {
|
||||
final scheme = ColorScheme.fromSeed(
|
||||
@@ -29,13 +28,14 @@ ThemeData buildAppTheme() {
|
||||
elevation: 0,
|
||||
centerTitle: false,
|
||||
titleTextStyle: YantingText.sectionTitle,
|
||||
surfaceTintColor: Colors.transparent,
|
||||
),
|
||||
cardTheme: const CardThemeData(
|
||||
color: YantingColors.card,
|
||||
elevation: 0,
|
||||
margin: EdgeInsets.zero,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(WiseRadius.md)),
|
||||
borderRadius: BorderRadius.all(Radius.circular(YantingRadius.xl)),
|
||||
side: BorderSide(color: YantingColors.border),
|
||||
),
|
||||
),
|
||||
@@ -64,6 +64,16 @@ ThemeData buildAppTheme() {
|
||||
borderSide: const BorderSide(color: YantingColors.foreground),
|
||||
),
|
||||
),
|
||||
snackBarTheme: SnackBarThemeData(
|
||||
backgroundColor: YantingColors.foreground,
|
||||
contentTextStyle: YantingText.body.copyWith(
|
||||
color: YantingColors.background,
|
||||
),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(YantingRadius.md),
|
||||
),
|
||||
),
|
||||
navigationBarTheme: NavigationBarThemeData(
|
||||
backgroundColor: YantingColors.background,
|
||||
indicatorColor: Colors.transparent,
|
||||
|
||||
@@ -1,2 +1,5 @@
|
||||
export 'app_theme.dart';
|
||||
export 'yanting_shad_theme.dart';
|
||||
export 'yanting_text.dart';
|
||||
export 'yanting_tokens.dart';
|
||||
export 'wise_tokens.dart';
|
||||
|
||||
@@ -0,0 +1,130 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:google_fonts/google_fonts.dart';
|
||||
import 'package:shadcn_ui/shadcn_ui.dart';
|
||||
|
||||
import 'yanting_text.dart';
|
||||
import 'yanting_tokens.dart';
|
||||
|
||||
const _lightShadColors = ShadColorScheme(
|
||||
background: YantingColors.background,
|
||||
foreground: YantingColors.foreground,
|
||||
card: YantingColors.card,
|
||||
cardForeground: YantingColors.foreground,
|
||||
popover: YantingColors.card,
|
||||
popoverForeground: YantingColors.foreground,
|
||||
primary: YantingColors.primary,
|
||||
primaryForeground: YantingColors.primaryForeground,
|
||||
secondary: YantingColors.secondary,
|
||||
secondaryForeground: YantingColors.secondaryForeground,
|
||||
muted: YantingColors.muted,
|
||||
mutedForeground: YantingColors.mutedForeground,
|
||||
accent: YantingColors.brandSoft,
|
||||
accentForeground: YantingColors.primaryForeground,
|
||||
destructive: YantingColors.destructive,
|
||||
destructiveForeground: YantingColors.background,
|
||||
border: YantingColors.border,
|
||||
input: YantingColors.input,
|
||||
ring: YantingColors.primary,
|
||||
selection: YantingColors.foreground,
|
||||
custom: {
|
||||
'brandSoft': YantingColors.brandSoft,
|
||||
'brandSoftBorder': YantingColors.brandSoftBorder,
|
||||
'link': YantingColors.link,
|
||||
'chart2': YantingColors.chart2,
|
||||
'warning': YantingColors.warning,
|
||||
},
|
||||
);
|
||||
|
||||
const _darkShadColors = ShadColorScheme(
|
||||
background: Color(0xFF0F0F0F),
|
||||
foreground: Color(0xFFF0F0F0),
|
||||
card: Color(0xFF1A1A1A),
|
||||
cardForeground: Color(0xFFF0F0F0),
|
||||
popover: Color(0xFF1A1A1A),
|
||||
popoverForeground: Color(0xFFF0F0F0),
|
||||
primary: YantingColors.primary,
|
||||
primaryForeground: Color(0xFF0F1A00),
|
||||
secondary: Color(0xFF1F1F23),
|
||||
secondaryForeground: Color(0xFFF0F0F0),
|
||||
muted: Color(0xFF1A1A1A),
|
||||
mutedForeground: Color(0xFFA1A1AA),
|
||||
accent: Color(0xFF1C2B00),
|
||||
accentForeground: YantingColors.primary,
|
||||
destructive: YantingColors.destructive,
|
||||
destructiveForeground: YantingColors.background,
|
||||
border: Color(0xFF2A2A2A),
|
||||
input: Color(0xFF2A2A2A),
|
||||
ring: YantingColors.primary,
|
||||
selection: Color(0xFFF0F0F0),
|
||||
custom: {
|
||||
'brandSoft': Color(0xFF1C2B00),
|
||||
'brandSoftBorder': Color(0xFF304800),
|
||||
'link': YantingColors.link,
|
||||
'chart2': YantingColors.chart2,
|
||||
'warning': YantingColors.warning,
|
||||
},
|
||||
);
|
||||
|
||||
ShadThemeData buildYantingShadTheme() {
|
||||
return ShadThemeData(
|
||||
brightness: Brightness.light,
|
||||
colorScheme: _lightShadColors,
|
||||
radius: BorderRadius.circular(YantingRadius.base),
|
||||
cardTheme: ShadCardTheme(
|
||||
padding: const EdgeInsets.all(YantingSpacing.cardPadding),
|
||||
radius: BorderRadius.circular(YantingRadius.xl),
|
||||
border: ShadBorder.all(color: YantingColors.border),
|
||||
shadows: const [],
|
||||
),
|
||||
textTheme: ShadTextTheme(
|
||||
family: YantingText.fontFamily,
|
||||
h1Large: YantingText.appTitle,
|
||||
h1: YantingText.appTitle,
|
||||
h2: YantingText.sectionTitle,
|
||||
h3: YantingText.cardTitle,
|
||||
h4: YantingText.listTitle,
|
||||
p: YantingText.body,
|
||||
blockquote: YantingText.body,
|
||||
table: YantingText.meta,
|
||||
list: YantingText.body,
|
||||
lead: YantingText.sub,
|
||||
large: YantingText.cardTitle,
|
||||
small: YantingText.badge,
|
||||
muted: YantingText.meta,
|
||||
googleFontBuilder: GoogleFonts.dmSans,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
ShadThemeData buildYantingDarkShadTheme() {
|
||||
return ShadThemeData(
|
||||
brightness: Brightness.dark,
|
||||
colorScheme: _darkShadColors,
|
||||
radius: BorderRadius.circular(YantingRadius.base),
|
||||
cardTheme: ShadCardTheme(
|
||||
padding: const EdgeInsets.all(YantingSpacing.cardPadding),
|
||||
radius: BorderRadius.circular(YantingRadius.xl),
|
||||
border: ShadBorder.all(color: _darkShadColors.border),
|
||||
shadows: const [],
|
||||
),
|
||||
textTheme: ShadTextTheme(
|
||||
family: YantingText.fontFamily,
|
||||
h1Large: YantingText.appTitle.copyWith(color: _darkShadColors.foreground),
|
||||
h1: YantingText.appTitle.copyWith(color: _darkShadColors.foreground),
|
||||
h2: YantingText.sectionTitle.copyWith(color: _darkShadColors.foreground),
|
||||
h3: YantingText.cardTitle.copyWith(color: _darkShadColors.foreground),
|
||||
h4: YantingText.listTitle.copyWith(color: _darkShadColors.foreground),
|
||||
p: YantingText.body.copyWith(color: _darkShadColors.foreground),
|
||||
blockquote: YantingText.body.copyWith(
|
||||
color: _darkShadColors.mutedForeground,
|
||||
),
|
||||
table: YantingText.meta.copyWith(color: _darkShadColors.mutedForeground),
|
||||
list: YantingText.body.copyWith(color: _darkShadColors.foreground),
|
||||
lead: YantingText.sub.copyWith(color: _darkShadColors.mutedForeground),
|
||||
large: YantingText.cardTitle.copyWith(color: _darkShadColors.foreground),
|
||||
small: YantingText.badge.copyWith(color: _darkShadColors.mutedForeground),
|
||||
muted: YantingText.meta.copyWith(color: _darkShadColors.mutedForeground),
|
||||
googleFontBuilder: GoogleFonts.dmSans,
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -2,20 +2,20 @@ import 'package:flutter/material.dart';
|
||||
|
||||
abstract final class YantingColors {
|
||||
static const background = Color(0xFFFFFFFF);
|
||||
static const foreground = Color(0xFF171717);
|
||||
static const foreground = Color(0xFF1A1A1A);
|
||||
static const card = Color(0xFFFFFFFF);
|
||||
static const primary = Color(0xFFA3E635);
|
||||
static const primaryForeground = Color(0xFF3F6212);
|
||||
static const primary = Color(0xFF95E300);
|
||||
static const primaryForeground = Color(0xFF365314);
|
||||
static const secondary = Color(0xFFF4F4F5);
|
||||
static const secondaryForeground = Color(0xFF27272A);
|
||||
static const muted = Color(0xFFF5F5F5);
|
||||
static const mutedForeground = Color(0xFF737373);
|
||||
static const muted = Color(0xFFF7F7F7);
|
||||
static const mutedForeground = Color(0xFF71717A);
|
||||
static const border = Color(0xFFE5E5E5);
|
||||
static const input = Color(0xFFE5E5E5);
|
||||
static const destructive = Color(0xFFEF4444);
|
||||
static const warning = Color(0xFF9A6A00);
|
||||
static const warning = Color(0xFF9A6500);
|
||||
static const chart2 = Color(0xFF84CC16);
|
||||
static const brandSoft = Color(0xFFEEFBD8);
|
||||
static const brandSoft = Color(0xFFECFCCB);
|
||||
static const brandSoftBorder = Color(0xFFD6F5A8);
|
||||
static const link = Color(0xFF2563EB);
|
||||
static const canvas = background;
|
||||
|
||||
Reference in New Issue
Block a user