feat: actions and map page
This commit is contained in:
@@ -6,7 +6,7 @@ import 'package:rasadyar_livestock/presentation/page/profile/view.dart';
|
||||
|
||||
class RootLogic extends GetxController {
|
||||
List<Widget> pages = [ActionPage(), MapPage(), ProfilePage()];
|
||||
RxInt indexedPage = 1.obs;
|
||||
RxInt currentIndex = 1.obs;
|
||||
|
||||
@override
|
||||
void onReady() {
|
||||
@@ -19,4 +19,7 @@ class RootLogic extends GetxController {
|
||||
// TODO: implement onClose
|
||||
super.onClose();
|
||||
}
|
||||
|
||||
void changePage(int i) => currentIndex.value = i;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:rasadyar_core/core.dart';
|
||||
|
||||
import 'logic.dart';
|
||||
|
||||
class RootPage extends GetView<RootLogic> {
|
||||
@@ -7,14 +8,39 @@ class RootPage extends GetView<RootLogic> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
body: ObxValue((data) {
|
||||
return IndexedStack(
|
||||
return ObxValue((currentIndex) {
|
||||
return Scaffold(
|
||||
body: IndexedStack(
|
||||
children: controller.pages,
|
||||
index: data.value,
|
||||
index: currentIndex.value,
|
||||
sizing: StackFit.expand,
|
||||
);
|
||||
}, controller.indexedPage),
|
||||
);
|
||||
),
|
||||
|
||||
bottomNavigationBar: BottomNavigation1(
|
||||
items: [
|
||||
BottomNavigation1Item(
|
||||
icon: Assets.vec.filterSvg.path,
|
||||
label: 'درخواستها',
|
||||
isSelected: currentIndex.value == 0,
|
||||
onTap: () => controller.changePage(0),
|
||||
),
|
||||
|
||||
BottomNavigation1Item(
|
||||
icon: Assets.vec.mapSvg.path,
|
||||
label: 'نقشه',
|
||||
isSelected: currentIndex.value == 1,
|
||||
onTap: () => controller.changePage(1),
|
||||
),
|
||||
|
||||
BottomNavigation1Item(
|
||||
icon: Assets.vec.profileUserSvg.path,
|
||||
label: 'پروفایل',
|
||||
isSelected: currentIndex.value == 2,
|
||||
onTap: () => controller.changePage(2),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}, controller.currentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user