excel method
Widget
excel(
{ - dynamic component,
- required double parentWidth,
})
Implementation
Widget excel({var component, required double parentWidth}) {
ExcelController controller = ExcelController();
return Obx(() {
if (component["dataFileName"] != null) {
controller.dataFile.value = component["dataFileName"];
}
return SizedBox(
width: (component["cssClass"] != null && component["cssClass"] != "")
? SwitchCase().componentWidthSC(
component["cssClass"],
{
"layout_1by8_col": Get.width * 0.1,
"layout_1_col": Get.width * 0.2,
"layout_2_col": Get.width * 0.4,
"layout_3_col": Get.width * 0.68,
"layout_4_col": Get.width,
},
parentWidth * 0.2)
: parentWidth * 0.2,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
AltComponent().altComponentLabel(
component: component,
label: (component["security"] != null &&
component["security"]["fieldLabel"] != null &&
component["security"]["fieldLabel"] != "")
? component["security"]["fieldLabel"]
: component["name"]),
Row(
children: [
TextButton(
onPressed: () {
controller.uploadFile();
},
style: TextButton.styleFrom(
padding: EdgeInsets.zero,
minimumSize: const Size(30, 30),
tapTargetSize: MaterialTapTargetSize.shrinkWrap,
alignment: Alignment.centerLeft),
child: Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(componentBorderRadius),
color: Palette.buttonComponentColor),
child: Padding(
padding: const EdgeInsets.symmetric(
horizontal: attachmentHorizontalSpacing,
vertical: attachmentVerticalSpacing),
child: Text(
(controller.dataFile.value != ""
? "Update file"
: "Upload File"),
style: attachmentButtonComponentTxtStyle),
),
),
),
controller.dataFile.value != ""
? Expanded(
child: Padding(
padding: const EdgeInsets.only(left: 8.0),
child: Text(
controller.dataFile.value,
overflow: TextOverflow.ellipsis,
style: excelFileStyle,
),
),
)
: const SizedBox()
],
),
AltComponent().altComponentInstruction(component: component)
],
),
);
});
}