Files
rasadyar_application/packages/chicken/lib/presentation/pages/common/role/view.dart
mr.mojtaba e933d22f8f refactor : rename files and update routes for poultry actions
feat : poultry kill registration and poultry OrderList

** Made With Nima **
2025-09-16 15:47:35 +03:30

95 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:rasadyar_chicken/data/common/fa_user_role.dart';
import 'package:rasadyar_chicken/presentation/widget/app_bar.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class RolePage extends GetView<RoleLogic> {
const RolePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: chickenAppBar(
hasBack: false,
hasFilter: false,
hasSearch: false,
isBase: false,
),
body: Column(
children: [
Assets.images.selectRole.image(
height: 212.h,
width: Get.width.w,
fit: BoxFit.cover,
),
ObxValue((data) {
return Expanded(
child: GridView.builder(
physics: BouncingScrollPhysics(),
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 3,
mainAxisSpacing: 12.h,
crossAxisSpacing: 12.w,
childAspectRatio: 2,
),
itemCount: data.length,
hitTestBehavior: HitTestBehavior.opaque,
itemBuilder: (BuildContext context, int index) {
Map role = getFaUserRoleWithOnTap(data[index]);
return roleCard(
title: role.keys.first,
onTap: () async {
String route = role.values.first;
await controller.gService.saveRoute(
Module.chicken,
route,
);
await controller.gService.saveRole(
Module.chicken,
data[index],
);
Get.offAllNamed(route);
},
);
},
),
);
}, controller.roles),
],
),
);
}
}
Widget roleCard({
required String title,
Function()? onTap,
int? width,
int? height,
}) {
return Container(
width: width?.w ?? 128.w,
height: height?.h ?? 48.h,
margin: EdgeInsets.all(8.w),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(8.r),
border: Border.all(color: AppColor.blueNormal, width: 1.w),
),
child: InkWell(
onTap: onTap,
child: Center(
child: Text(
title,
style: AppFonts.yekan12Bold.copyWith(color: AppColor.blueNormal),
),
),
),
);
}