Files
rasadyar_application/features/supervision/lib/presentation/actions/view.dart
mr.mojtaba d4ebefedba feat : action
add supervisons
2025-04-21 07:30:14 +03:30

210 lines
6.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'package:supervision/presentation/actions/logic.dart';
class ActionsPage extends GetView<ActionsLogic> {
const ActionsPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Column(
children: [
SizedBox(height: 10),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
cardActionWidget(
title: 'کاربران',
onPressed: () {
controller.currentIndex.value = 0;
},
icon: Assets.vecProfileUserSvg,
selected: data.value == 0,
),
cardActionWidget(
title: 'سوابق بازرسی من',
onPressed: () {
controller.currentIndex.value = 1;
},
icon: Assets.vecCalendarSearchSvg,
selected: data.value == 1,
),
cardActionWidget(
title: 'آمار',
onPressed: () {
controller.currentIndex.value = 2;
},
icon: Assets.vecDiagramSvg,
selected: data.value == 2,
),
cardActionWidget(
title: 'خروج از سامانه',
onPressed: () {
controller.currentIndex.value = 3;
},
icon: Assets.vecLogoutSvg,
selected: data.value == 3,
),
],
);
}, controller.currentIndex),
SizedBox(height: 20),
Expanded(
child: Column(
spacing: 13,
children: [
selectedLocationWidget(),
selectedLocationWidget(),
selectedLocationWidget(),
],
),
),
],
),
),
);
}
Widget selectedLocationWidget() {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 30),
child: Slidable(
key: Key('selectedLocationWidget'),
controller: controller.slidController.value,
endActionPane: ActionPane(
motion: StretchMotion(),
children: [
CustomSlidableAction(
onPressed: (context) {},
backgroundColor: AppColor.redNormal,
foregroundColor: AppColor.whiteLight,
padding: EdgeInsets.all(16),
borderRadius: BorderRadius.only(
bottomRight: Radius.circular(8),
topRight: Radius.circular(8),
),
child: vecWidget(Assets.vecTrashSvg, width: 24, height: 24),
),
],
),
child: GestureDetector(
onTap: () {},
child: Container(
height: 58,
alignment: AlignmentDirectional.center,
padding: EdgeInsets.symmetric(horizontal: 20),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(8),
border: Border.all(width: 1, color: AppColor.blackLightHover),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Column(
spacing: 4,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'داود خرم مهری پور',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'03295224154',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'باقی مانده',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'0 کیلوگرم',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
Column(
spacing: 4,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
'باقی مانده',
style: AppFonts.yekan10.copyWith(
color: AppColor.blueNormal,
),
),
Text(
'0 کیلوگرم',
style: AppFonts.yekan12.copyWith(
color: AppColor.darkGreyDarkHover,
),
),
],
),
],
),
),
),
),
);
}
}
Widget cardActionWidget({
required String title,
required VoidCallback onPressed,
required String icon,
bool selected = false,
}) {
return GestureDetector(
onTap: onPressed,
child: Column(
children: [
Container(
width: 48,
height: 48,
padding: EdgeInsets.all(4),
decoration: ShapeDecoration(
color: selected ? AppColor.blueLightActive : AppColor.blueLight,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: vecWidget(
icon,
width: 40,
height: 40,
color: selected ? AppColor.blueNormalActive : AppColor.blueNormal,
),
),
SizedBox(height: 2),
Text(
title,
style: AppFonts.yekan10.copyWith(
color: selected ? AppColor.blueNormal : AppColor.blueLightActive,
),
),
],
),
);
}