feat : header action
This commit is contained in:
36
features/supervision/lib/presentation/action/logic.dart
Normal file
36
features/supervision/lib/presentation/action/logic.dart
Normal 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();
|
||||
}
|
||||
}
|
||||
76
features/supervision/lib/presentation/action/view.dart
Normal file
76
features/supervision/lib/presentation/action/view.dart
Normal 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,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}),
|
||||
),
|
||||
|
||||
|
||||
Reference in New Issue
Block a user