linkBaseStyle static method
ButtonStyle
linkBaseStyle({
- required MihrButtonSize size,
- required Color hoverDecorationColor,
- OutlinedBorder? shape,
Structural style for link-style buttons (no padding, underline on hover).
Implementation
static ButtonStyle linkBaseStyle({
required MihrButtonSize size,
required Color hoverDecorationColor,
OutlinedBorder? shape,
}) {
final effectiveShape = shape ??
const RoundedRectangleBorder(borderRadius: MihrRadius.borderXs);
final ts = TextStyle(
fontSize: size.fontSize,
fontWeight: FontWeight.w600,
);
return ButtonStyle(
padding: const WidgetStatePropertyAll(EdgeInsets.zero),
minimumSize: WidgetStatePropertyAll(
Size(0, size.linkHeight),
),
maximumSize: WidgetStatePropertyAll(
Size(double.infinity, size.linkHeight),
),
textStyle: WidgetStateProperty.resolveWith((states) {
if (states.contains(WidgetState.hovered) ||
states.contains(WidgetState.pressed)) {
return ts.copyWith(
decoration: TextDecoration.underline,
decorationColor: hoverDecorationColor,
);
}
return ts;
}),
iconSize: WidgetStatePropertyAll(size.iconSize),
shape: WidgetStatePropertyAll(effectiveShape),
elevation: const WidgetStatePropertyAll(0),
shadowColor: const WidgetStatePropertyAll(Colors.transparent),
overlayColor: const WidgetStatePropertyAll(Colors.transparent),
splashFactory: NoSplash.splashFactory,
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
animationDuration: const Duration(milliseconds: 100),
mouseCursor: WidgetStateProperty.resolveWith(
(s) => s.contains(WidgetState.disabled)
? SystemMouseCursors.basic
: SystemMouseCursors.click,
),
);
}