mirror of
https://github.com/Iconica-Development/flutter_availability.git
synced 2025-05-19 05:03:44 +02:00
feat: add secondary button builder
This commit is contained in:
parent
9ba32016b8
commit
25186412ba
2 changed files with 35 additions and 0 deletions
|
@ -14,6 +14,7 @@ class AvailabilityOptions {
|
|||
this.translations = const AvailabilityTranslations.empty(),
|
||||
this.baseScreenBuilder = DefaultBaseScreen.builder,
|
||||
this.primaryButtonBuilder = DefaultPrimaryButton.builder,
|
||||
this.secondaryButtonBuilder = DefaultSecondaryButton.builder,
|
||||
this.textButtonBuilder = DefaultTextButton.builder,
|
||||
this.spacing = const AvailabilitySpacing(),
|
||||
this.textStyles = const AvailabilityTextStyles(),
|
||||
|
@ -39,6 +40,9 @@ class AvailabilityOptions {
|
|||
/// A way to provide your own primary button implementation
|
||||
final ButtonBuilder primaryButtonBuilder;
|
||||
|
||||
/// A way to provide your own secondary button implementation
|
||||
final ButtonBuilder secondaryButtonBuilder;
|
||||
|
||||
/// A way to provide your own text button implementation
|
||||
final ButtonBuilder textButtonBuilder;
|
||||
|
||||
|
|
|
@ -33,6 +33,37 @@ class DefaultPrimaryButton extends StatelessWidget {
|
|||
FilledButton(onPressed: onPressed, child: child);
|
||||
}
|
||||
|
||||
/// a secondary button with a an outlined border
|
||||
class DefaultSecondaryButton extends StatelessWidget {
|
||||
///
|
||||
const DefaultSecondaryButton({
|
||||
required this.child,
|
||||
required this.onPressed,
|
||||
super.key,
|
||||
});
|
||||
|
||||
///
|
||||
static Widget builder(
|
||||
BuildContext context,
|
||||
FutureOr<void> Function()? onPressed,
|
||||
Widget child,
|
||||
) =>
|
||||
DefaultSecondaryButton(
|
||||
onPressed: onPressed,
|
||||
child: child,
|
||||
);
|
||||
|
||||
///
|
||||
final Widget child;
|
||||
|
||||
///
|
||||
final FutureOr<void> Function()? onPressed;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) =>
|
||||
OutlinedButton(onPressed: onPressed, child: child);
|
||||
}
|
||||
|
||||
///
|
||||
class DefaultTextButton extends StatelessWidget {
|
||||
///
|
||||
|
|
Loading…
Reference in a new issue