onInit method
Called immediately after the widget is allocated in memory. You might use this to initialize something for the controller.
Implementation
@override
void onInit() {
super.onInit();
initializeTabsJson();
final tabData = tabsJson[screen];
if (tabData != null && tabData.isNotEmpty) {
headerHeight.value =
tabData['section']['subHeader'] - tabData['section']['header'];
subHeaderHeight.value =
tabData['section']['body'] - tabData['section']['subHeader'];
bodyHeight.value =
tabData['section']['subBody'] - tabData['section']['body'];
subBodyHeight.value =
tabData['section']['footer'] - tabData['section']['subBody'];
footerHeight.value = 842.00 - tabData['section']['footer'];
_updateSectionPositionsOnly();
List<PrinterDesignerPackageListModel> restoredItems =
convertJsonStringPositions(jsonEncode(tabData));
items.value = restoredItems;
tableVisibleHeaders.value = convertJsonStringTableHeaders() ?? [];
} else {
id = null;
headerHeight.value = 155.0;
subHeaderHeight.value = 190.0;
bodyHeight.value = 185.0;
subBodyHeight.value = 170.0;
footerHeight.value = 142.0;
_updateSectionPositionsOnly();
items.value = [];
tableVisibleHeaders.value = [];
}
///=======================do not delete=======================
// headerHeight.value = 155.0;
// subHeaderHeight.value = 190.0;
// bodyHeight.value = 185.0;
// subBodyHeight.value = 170.0;
// footerHeight.value = 142.0;
// _updateSectionPositionsOnly();
// items.value = [
// PrinterDesignerPackageListModel(
// id: UniqueKey().toString(),
// value: 'Header Text',
// label: 'Header Text',
// type: 'Text',
// section: 'header',
// positionX: 0,
// positionY: 0,
// height: 30,
// width: 120,
// isSelected: false,
// ),
// PrinterDesignerPackageListModel(
// id: UniqueKey().toString(),
// value: '',
// label: 'Header Image',
// type: 'Image',
// section: 'header',
// imageUrl: 'https://images.unsplash.com/photo-1751795195789-8dab6693475d?w=500&auto=format&fit=crop&q=60&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxmZWF0dXJlZC1waG90b3MtZmVlZHwyfHx8ZW58MHx8fHx8',
// positionX: 0,
// positionY: 32,
// height: 92,
// width: 585,
// isSelected: false,
// ),
// PrinterDesignerPackageListModel(
// id: UniqueKey().toString(),
// value: 'Header Text',
// label: 'Header Text 2',
// type: 'Text',
// section: 'header',
// positionX: 0,
// positionY: 125,
// height: 30,
// width: 120,
// isSelected: false,
// ),
// ];
}