115 lines
3.7 KiB
Dart
115 lines
3.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:rasadyar_chicken/data/common/fa_user_role.dart';
|
|
import 'package:rasadyar_chicken/presentation/widget/base_page/view.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 BasePage(
|
|
hasSearch: true,
|
|
hasBack: false,
|
|
isBase: true,
|
|
routes: ['انتخاب نقش'],
|
|
widgets: [
|
|
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.saveSelectedRole(route);
|
|
Get.offAllNamed(route);
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}, controller.roles),
|
|
],
|
|
);
|
|
|
|
/* return Scaffold(
|
|
body: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Assets.rive.shapes.rive(fit: BoxFit.cover),
|
|
Positioned.fill(
|
|
child: BackdropFilter(
|
|
filter: ImageFilter.blur(sigmaX: 20, sigmaY: 20),
|
|
child: Container(color: Colors.white.withValues(alpha: 0.2)),
|
|
),
|
|
),
|
|
Container(
|
|
height: 400.h,
|
|
padding: EdgeInsets.symmetric(horizontal: 16.w),
|
|
child: Card(
|
|
child: Column(
|
|
children: [
|
|
SizedBox(height: 12.h),
|
|
Text(
|
|
'انتخاب نقش',
|
|
style: AppFonts.yekan20Bold.copyWith(color: AppColor.textColor),
|
|
),
|
|
ObxValue((data) {
|
|
return Expanded(
|
|
child: GridView.builder(
|
|
physics: BouncingScrollPhysics(),
|
|
gridDelegate: SliverGridDelegateWithMaxCrossAxisExtent(
|
|
maxCrossAxisExtent: 250,
|
|
mainAxisSpacing: 12,
|
|
crossAxisSpacing: 12,
|
|
childAspectRatio: 1.5,
|
|
),
|
|
itemCount: data.length,
|
|
hitTestBehavior: HitTestBehavior.opaque,
|
|
itemBuilder: (BuildContext context, int index) {
|
|
return roleCard(title: getFaUserRole(data[index]), onTap: () {});
|
|
},
|
|
),
|
|
);
|
|
}, controller.roles),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);*/
|
|
}
|
|
|
|
Widget roleCard({required String title, Function()? onTap}) {
|
|
return Container(
|
|
width: 128.w,
|
|
height: 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)),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|