forked from eatvio/eatvio_app
Some further logic fixes
This commit is contained in:
74
lib/widgets/next_step_button.dart
Normal file
74
lib/widgets/next_step_button.dart
Normal file
@@ -0,0 +1,74 @@
|
||||
import 'package:eatvio_app/core/app_export.dart';
|
||||
import 'package:eatvio_app/widgets/base_button.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class NextStepButton extends BaseButton {
|
||||
NextStepButton({
|
||||
Key? key,
|
||||
this.decoration,
|
||||
this.leftIcon,
|
||||
this.rightIcon,
|
||||
this.label,
|
||||
VoidCallback? onPressed,
|
||||
ButtonStyle? buttonStyle,
|
||||
TextStyle? buttonTextStyle,
|
||||
bool? isDisabled,
|
||||
Alignment? alignment,
|
||||
double? height,
|
||||
double? width,
|
||||
EdgeInsets? margin,
|
||||
required String text,
|
||||
}) : super(
|
||||
text: text,
|
||||
onPressed: onPressed,
|
||||
buttonStyle: buttonStyle,
|
||||
isDisabled: isDisabled,
|
||||
buttonTextStyle: buttonTextStyle,
|
||||
height: height,
|
||||
alignment: alignment,
|
||||
width: width,
|
||||
margin: margin,
|
||||
);
|
||||
|
||||
final BoxDecoration? decoration;
|
||||
|
||||
final Widget? leftIcon;
|
||||
|
||||
final Widget? rightIcon;
|
||||
|
||||
final Widget? label;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return alignment != null
|
||||
? Align(
|
||||
alignment: alignment ?? Alignment.center,
|
||||
child: buildOutlinedButtonWidget,
|
||||
)
|
||||
: buildOutlinedButtonWidget;
|
||||
}
|
||||
|
||||
Widget get buildOutlinedButtonWidget => Container(
|
||||
height: this.height ?? 30.v,
|
||||
width: this.width ?? double.maxFinite,
|
||||
margin: margin,
|
||||
decoration: decoration,
|
||||
child: OutlinedButton(
|
||||
style: buttonStyle,
|
||||
onPressed: isDisabled ?? false ? null : onPressed ?? () {},
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: [
|
||||
leftIcon ?? const SizedBox.shrink(),
|
||||
Text(
|
||||
text,
|
||||
style: buttonTextStyle ?? theme.textTheme.titleSmall,
|
||||
),
|
||||
rightIcon ?? const SizedBox.shrink(),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user