117 lines
3.3 KiB
Dart
117 lines
3.3 KiB
Dart
import 'package:eatvio_app/core/app_export.dart';
|
|
import 'package:eatvio_app/widgets/base_button.dart';
|
|
import 'package:flutter/material.dart';
|
|
|
|
class CustomOutlinedButton extends BaseButton {
|
|
CustomOutlinedButton({
|
|
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) {
|
|
if (alignment != null) {
|
|
return Align(
|
|
alignment: alignment ?? Alignment.center,
|
|
child: 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 ?? SizedBox.shrink(),
|
|
Text(
|
|
text,
|
|
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
|
|
),
|
|
rightIcon ?? SizedBox.shrink(),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
} else {
|
|
return 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 ?? SizedBox.shrink(),
|
|
Text(
|
|
text,
|
|
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
|
|
),
|
|
rightIcon ?? SizedBox.shrink(),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
/*_buildAppBarbuildOutlinedButtonWidget() {
|
|
return 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 ?? SizedBox.shrink(),
|
|
Text(
|
|
text,
|
|
style: buttonTextStyle ?? CustomTextStyles.titleSmallBold,
|
|
),
|
|
rightIcon ?? SizedBox.shrink(),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}*/
|
|
}
|