button method
Widget
button(
{ - dynamic component,
- required double parentWidth,
- dynamic componentList,
})
Implementation
Widget button(
{var component, required double parentWidth, var componentList}) {
return Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Container(
constraints: BoxConstraints(
minWidth:
(component["cssClass"] != null && component["cssClass"] != "")
? SwitchCase().componentWidthSC(
component["cssClass"],
{
"layout_1by8_col": parentWidth * 0.08,
"layout_1_col": parentWidth * 0.2,
"layout_2_col": parentWidth * 0.4,
"layout_3_col": parentWidth * 0.68,
"layout_4_col": parentWidth,
},
parentWidth * 0.2)
: parentWidth * 0.2, // minimum width
),
child: Opacity(
opacity: ((component["security"] != null &&
component["security"]["editable"] != null &&
component["security"]["editable"] == false) ||
FormUtilService().customMandatoryCheck(componentList))
? 0.65
: 1,
child: Row(
mainAxisSize: MainAxisSize.min,
children: [
MouseRegion(
cursor: ((component["security"] != null &&
component["security"]["editable"] != null &&
component["security"]["editable"] == false) ||
FormUtilService().customMandatoryCheck(componentList))
? SystemMouseCursors.forbidden
: SystemMouseCursors.click,
child: TextButton(
onPressed: () {},
style: ButtonStyle(
mouseCursor: MaterialStateProperty.all<MouseCursor>(
MouseCursor.defer),
backgroundColor: MaterialStateProperty.all<Color>(
Palette.buttonComponentColor),
shape: MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius:
BorderRadius.circular(componentBorderRadius),
)),
overlayColor:
MaterialStateProperty.all<Color>(Colors.transparent),
padding: MaterialStateProperty.all<EdgeInsetsGeometry>(
EdgeInsets.zero),
minimumSize:
MaterialStateProperty.all<Size>(const Size(0, 0)),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
alignment: Alignment.center),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: buttonHorizontalSpacing,
vertical: buttonVerticalSpacing),
child: Text(
((component["security"] != null &&
component["security"]["fieldLabel"] != null)
? (component["security"]["fieldLabel"])
.toUpperCase()
: component["name"].toUpperCase()),
style: buttonComponentTxtStyle),
),
),
),
],
),
),
),
);
}