54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rasadyar_core/core.dart';
|
|
import 'package:rasadyar_inspection/inspection.dart';
|
|
|
|
import 'logic.dart';
|
|
|
|
class ModulesPage extends GetView<ModulesLogic> {
|
|
const ModulesPage({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
appBar: AppBar(
|
|
title: Text('انتخاب سامانه', style: AppFonts.yekan18.copyWith(color: Colors.white)),
|
|
centerTitle: true,
|
|
backgroundColor: AppColor.blueNormal,
|
|
),
|
|
body: GridView.builder(
|
|
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 20),
|
|
|
|
itemBuilder: (context, index) {
|
|
final module = controller.moduleList[index];
|
|
return CardIcon(
|
|
title: module.title,
|
|
icon: module.icon,
|
|
onTap: () {
|
|
controller.selectedIndex.value = index;
|
|
controller.saveModule(module.module);
|
|
|
|
// Navigate to the appropriate route based on the selected module
|
|
switch (module.module) {
|
|
case Module.inspection:
|
|
Get.toNamed(InspectionRoutes.init);
|
|
break;
|
|
case Module.liveStocks:
|
|
case Module.chicken:
|
|
Get.toNamed(InspectionRoutes.init);
|
|
break;
|
|
}
|
|
},
|
|
);
|
|
},
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
crossAxisCount: 3,
|
|
mainAxisSpacing: 10,
|
|
crossAxisSpacing: 10,
|
|
),
|
|
physics: BouncingScrollPhysics(),
|
|
itemCount: controller.moduleList.length,
|
|
),
|
|
);
|
|
}
|
|
}
|