feat:更新颜色模块

This commit is contained in:
2025-11-20 23:40:06 +08:00
parent 6ed9efe06d
commit 3ea162f33e
9 changed files with 798 additions and 785 deletions

View File

@@ -193,16 +193,18 @@ Widget buildToggleSwitch<T extends Enum>({
required List<String> labels,
required ValueChanged<T> onTabChanged,
}) {
final colors = Theme.of(context).colorScheme;
return ToggleSwitch(
minWidth: 90.0,
minHeight: 40.0,
initialLabelIndex: tabValues.indexOf(currentTab),
totalSwitches: tabValues.length,
labels: labels,
activeBgColor: [Theme.of(context).colorScheme.primary],
activeBgColor: [colors.primary],
activeFgColor: Colors.white,
inactiveBgColor: Colors.grey.shade200,
inactiveFgColor: Colors.grey.shade700,
inactiveBgColor: colors.surfaceContainer,
inactiveFgColor: colors.onSurface,
cornerRadius: 12.0,
customTextStyles: [TextStyle(fontSize: 12, fontWeight: FontWeight.w500)],
onToggle: (index) {
@@ -216,7 +218,7 @@ Widget buildToggleSwitch<T extends Enum>({
ButtonStyle buildSegmentStyle(ColorScheme colors) {
return ButtonStyle(
side: WidgetStateProperty.all<BorderSide>(
const BorderSide(color: Colors.transparent, width: 0),
BorderSide(color: colors.surface, width: 0),
),
iconColor: WidgetStateProperty.resolveWith<Color>(
(Set<WidgetState> states) {
@@ -232,7 +234,7 @@ ButtonStyle buildSegmentStyle(ColorScheme colors) {
if (states.contains(WidgetState.selected)) {
return colors.primary;
}
return Colors.grey.shade200;
return colors.surfaceContainer;
}),
foregroundColor: WidgetStateProperty.resolveWith<Color>((
Set<WidgetState> states,