txtArea method
Widget
txtArea(
{ - dynamic component,
- required double parentWidth,
})
Implementation
Widget txtArea({var component, required double parentWidth}) {
return SizedBox(
width: (component["cssClass"] != null && component["cssClass"] != "")
? SwitchCase().componentWidthSC(
component["cssClass"],
{
"layout_1by8_col": parentWidth * 0.1,
"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,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AltComponent().altComponentLabel(
component: component,
label: (component["displayLabel"] != null &&
component["displayLabel"] != "")
? component["displayLabel"]
: (component["security"] != null &&
component["security"]["fieldLabel"] != null &&
component["security"]["fieldLabel"] != "")
? component["security"]["fieldLabel"]
: component["label"]),
TextField(
style: componentTxtStyle,
minLines: (component["rows"] != null
? (component["rows"] * 6)
: 6), // any number you need (It works as the rows for the textarea)
keyboardType: TextInputType.multiline,
maxLines: null,
enabled: ((component["security"] != null &&
component["security"]["editable"] != null))
? (component["security"]["editable"])
: true,
decoration: InputDecoration(
contentPadding:
const EdgeInsets.symmetric(horizontal: 10, vertical: 7),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(componentBorderRadius),
borderSide:
const BorderSide(color: Palette.componentBorderColor)),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(componentBorderRadius),
borderSide:
const BorderSide(color: Palette.componentBorderColor)),
),
),
AltComponent().altComponentInstruction(component: component)
],
),
);
}