aves_mio1/lib/widgets/common/identity/buttons/outlined_button.dart
FabioMich66 19a982ede6
Some checks are pending
Quality check / Flutter analysis (push) Waiting to run
Quality check / CodeQL analysis (java-kotlin) (push) Waiting to run
first commit
2026-03-05 15:51:30 +01:00

43 lines
1.2 KiB
Dart

import 'package:flutter/material.dart';
class AvesOutlinedButton extends StatelessWidget {
final Widget? icon;
final String label;
final VoidCallback? onPressed;
const AvesOutlinedButton({
super.key,
this.icon,
required this.label,
required this.onPressed,
});
@override
Widget build(BuildContext context) {
final theme = Theme.of(context);
final foreground = WidgetStateProperty.resolveWith<Color>((states) {
return states.contains(WidgetState.disabled) ? theme.disabledColor : theme.colorScheme.onSurface;
});
final style = ButtonStyle(
foregroundColor: foreground,
iconColor: foreground,
side: WidgetStateProperty.resolveWith<BorderSide>((states) {
return BorderSide(
color: states.contains(WidgetState.disabled) ? theme.disabledColor : theme.colorScheme.primary,
);
}),
);
return icon != null
? OutlinedButton.icon(
onPressed: onPressed,
style: style,
icon: icon!,
label: Text(label),
)
: OutlinedButton(
onPressed: onPressed,
style: style,
child: Text(label),
);
}
}