opt: 首页tab样式
This commit is contained in:
@ -357,25 +357,29 @@ class CustomChip extends StatelessWidget {
|
|||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final ColorScheme colorTheme = Theme.of(context).colorScheme;
|
final ColorScheme colorTheme = Theme.of(context).colorScheme;
|
||||||
final Color secondaryContainer = colorTheme.secondaryContainer;
|
final Color secondaryContainer = colorTheme.secondaryContainer;
|
||||||
|
final Color onPrimary = colorTheme.onPrimary;
|
||||||
|
final Color primary = colorTheme.primary;
|
||||||
final TextStyle chipTextStyle = selected
|
final TextStyle chipTextStyle = selected
|
||||||
? const TextStyle(fontWeight: FontWeight.bold, fontSize: 13)
|
? TextStyle(fontSize: 13, color: onPrimary)
|
||||||
: const TextStyle(fontSize: 13);
|
: TextStyle(fontSize: 13, color: colorTheme.onSecondaryContainer);
|
||||||
final ColorScheme colorScheme = Theme.of(context).colorScheme;
|
|
||||||
const VisualDensity visualDensity =
|
const VisualDensity visualDensity =
|
||||||
VisualDensity(horizontal: -4.0, vertical: -2.0);
|
VisualDensity(horizontal: -4.0, vertical: -2.0);
|
||||||
return InputChip(
|
return InputChip(
|
||||||
side: BorderSide(
|
side: BorderSide.none,
|
||||||
color: selected
|
|
||||||
? colorScheme.onSecondaryContainer.withOpacity(0.2)
|
|
||||||
: Colors.transparent,
|
|
||||||
),
|
|
||||||
backgroundColor: secondaryContainer,
|
backgroundColor: secondaryContainer,
|
||||||
selectedColor: secondaryContainer,
|
color: MaterialStateProperty.resolveWith((states) {
|
||||||
color: MaterialStateProperty.resolveWith<Color>(
|
if (states.contains(MaterialState.selected) ||
|
||||||
(Set<MaterialState> states) => secondaryContainer.withAlpha(200)),
|
states.contains(MaterialState.hovered)) {
|
||||||
padding: const EdgeInsets.fromLTRB(7, 1, 7, 1),
|
return primary;
|
||||||
|
}
|
||||||
|
return colorTheme.secondaryContainer;
|
||||||
|
}),
|
||||||
|
padding: const EdgeInsets.fromLTRB(6, 1, 6, 1),
|
||||||
label: Text(label, style: chipTextStyle),
|
label: Text(label, style: chipTextStyle),
|
||||||
onPressed: () => onTap(),
|
onPressed: () => onTap(),
|
||||||
|
shape: RoundedRectangleBorder(
|
||||||
|
borderRadius: BorderRadius.circular(6),
|
||||||
|
),
|
||||||
selected: selected,
|
selected: selected,
|
||||||
showCheckmark: false,
|
showCheckmark: false,
|
||||||
visualDensity: visualDensity,
|
visualDensity: visualDensity,
|
||||||
|
Reference in New Issue
Block a user