fix: continued product view

This commit is contained in:
2024-02-06 21:49:39 +07:00
16 changed files with 695 additions and 202 deletions

View File

@@ -58,78 +58,80 @@ class ButtonView extends StatelessWidget {
final widthPrefix =
this.widthPrefix ?? (heightWrapContent ? width! / 4.7 : _widthBtn / 16);
return Container(
margin: EdgeInsets.symmetric(vertical: marginVertical ?? 32.0),
width: width ?? _widthBtn,
height: heightWrapContent ? null : height ?? _heightBtn,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
disabledBackgroundColor: isOutlined ? Colors.white : color.surface,
padding: contentPadding,
backgroundColor: backgroundColor ??
(isOutlined
? Colors.white
: isSecondaryColor
? ColorPalette.grey
: ColorPalette.primary),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(sizeBorderRadius ?? 48),
side: isOutlined
? BorderSide(
color: borderColor ?? (disabled
? color.surface
: isSecondaryColor
? ColorPalette.greyBorder
: ColorPalette.primary),
)
: BorderSide.none,
return Center(
child: Container(
margin: EdgeInsets.symmetric(vertical: marginVertical ?? 24.0),
width: width ?? _widthBtn,
height: heightWrapContent ? null : height ?? _heightBtn,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
disabledBackgroundColor: isOutlined ? Colors.white : color.surface,
padding: contentPadding,
backgroundColor: backgroundColor ??
(isOutlined
? Colors.white
: isSecondaryColor
? ColorPalette.grey
: ColorPalette.primary),
elevation: 0,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(sizeBorderRadius ?? 48),
side: isOutlined
? BorderSide(
color: borderColor ?? (disabled
? color.surface
: isSecondaryColor
? ColorPalette.greyBorder
: ColorPalette.primary),
)
: BorderSide.none,
),
),
),
onPressed: disabled ? null : onPressed,
child: Row(
mainAxisAlignment: mainAxisAlignmentContent ??
(prefixIcon != null
? MainAxisAlignment.center
: suffixIcon != null
? MainAxisAlignment.end
: MainAxisAlignment.center),
children: [
if (prefixIcon != null) ...[
prefixIcon!,
SizedBox(width: widthPrefix),
] else
Container(),
Flexible(
child: Text(
name,
textAlign: textAlign,
maxLines: maxLines,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: textSize ?? 16,
fontWeight: textWeight,
color: textColor ??
(disabled && isOutlined
? color.primary
: disabled
? Colors.white
: isOutlined && isSecondaryColor
? ColorPalette.blackFont
: isOutlined
? color.primary
: isSecondaryColor
? Colors.white
: Colors.white),
onPressed: disabled ? null : onPressed,
child: Row(
mainAxisAlignment: mainAxisAlignmentContent ??
(prefixIcon != null
? MainAxisAlignment.center
: suffixIcon != null
? MainAxisAlignment.end
: MainAxisAlignment.center),
children: [
if (prefixIcon != null) ...[
prefixIcon!,
SizedBox(width: widthPrefix),
] else
Container(),
Flexible(
child: Text(
name,
textAlign: textAlign,
maxLines: maxLines,
overflow: TextOverflow.ellipsis,
style: TextStyle(
fontSize: textSize ?? 16,
fontWeight: textWeight,
color: textColor ??
(disabled && isOutlined
? color.primary
: disabled
? Colors.white
: isOutlined && isSecondaryColor
? ColorPalette.blackFont
: isOutlined
? color.primary
: isSecondaryColor
? Colors.white
: Colors.white),
),
),
),
),
if (suffixIcon != null) ...[
SizedBox(width: widthSuffix),
suffixIcon!
] else
Container()
],
if (suffixIcon != null) ...[
SizedBox(width: widthSuffix),
suffixIcon!
] else
Container()
],
),
),
),
);