feat : header action

This commit is contained in:
2025-04-20 08:53:15 +03:30
parent 3b693c7e60
commit e643a4844e
4 changed files with 117 additions and 5 deletions

View File

@@ -0,0 +1,36 @@
import 'package:get/get.dart';
import 'package:rasadyar_core/presentation/common/assets.dart';
class ActionLogic extends GetxController {
RxInt selectedIndex = 0.obs;
List<String> headersTitle = [
'کاربران',
'سوابق بازرسی من',
'آمار',
'خروج از سامانه'
];
List<String> headersIcons = [
Assets.vecProfileUserSvg,
Assets.vecCalendarSearchSvg,
Assets.vecDiagramSvg,
Assets.vecLogoutSvg,
];
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}
@override
void onClose() {
// TODO: implement onClose
super.onClose();
}
}

View File

@@ -0,0 +1,76 @@
import 'package:flutter/material.dart';
import 'package:rasadyar_core/core.dart';
import 'logic.dart';
class ActionPage extends GetView<ActionLogic> {
const ActionPage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: AppColor.bgLight,
body: SafeArea(
child: Column(
children: [
SizedBox(height: 20),
ObxValue((data) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: List.generate(4, (index) {
return headerWidget(
icon: controller.headersIcons[index],
title: controller.headersTitle[index],
onTap: () {
controller.selectedIndex.value = index;
},
isSelected: controller.selectedIndex.value == index,
);
}),
);
}, controller.selectedIndex),
],
),
),
);
}
Widget headerWidget({
required String icon,
required String title,
required VoidCallback onTap,
bool isSelected = false,
}) {
return GestureDetector(
onTap: onTap,
child: Column(
spacing: 8,
children: [
Container(
width: 48,
height: 48,
padding: EdgeInsets.all(8),
decoration: ShapeDecoration(
color: isSelected ? AppColor.blueLightActive : AppColor.blueLight,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: vecWidget(
icon,
width: 40,
height: 40,
color: AppColor.blueNormal,
),
),
Text(
title,
style: AppFonts.yekan12.copyWith(
color: isSelected ? AppColor.blueNormalActive : AppColor.blueNormal,
),
),
],
),
);
}
}

View File

@@ -1,19 +1,19 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:supervision/presentation/actions/view.dart';
import 'package:supervision/presentation/action/view.dart';
import 'package:supervision/presentation/filter/view.dart';
class RootLogic extends GetxController {
RxInt currentIndex = 0.obs;
List<Widget> pages = [
SupervisionFilterPage(),
ActionsPage(),
ActionPage(),
Placeholder(color: Colors.amber),
];
@override
void onReady() {
// TODO: implement onReady
super.onReady();
}

View File

@@ -1,5 +1,5 @@
import 'package:rasadyar_core/core.dart';
import 'package:supervision/presentation/actions/logic.dart';
import 'package:supervision/presentation/action/logic.dart';
import 'package:supervision/presentation/add_supervision/logic.dart';
import 'package:supervision/presentation/add_supervision/view.dart';
import 'package:supervision/presentation/display_information/logic.dart';
@@ -24,7 +24,7 @@ sealed class SupervisionPages {
Get.put(RootLogic());
Get.put(SupervisionFilterLogic());
Get.lazyPut(() => LocationDetailsLogic(), fenix: true);
Get.lazyPut(() => ActionsLogic(), fenix: true);
Get.lazyPut(() => ActionLogic(), fenix: true);
}),
),