feat:更新颜色模块
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user