Files
rog_app/lib/pages/index/index_page.dart

178 lines
7.4 KiB
Dart
Raw Normal View History

2022-04-17 11:45:21 +05:30
import 'package:flutter/material.dart';
import 'package:get/get.dart';
2022-09-22 20:36:56 +05:30
import 'package:rogapp/pages/destination/destination_controller.dart';
2022-04-17 11:45:21 +05:30
import 'package:rogapp/pages/drawer/drawer_page.dart';
2022-05-12 02:17:08 +05:30
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
2022-04-17 11:45:21 +05:30
import 'package:rogapp/widgets/list_widget.dart';
import 'package:rogapp/widgets/map_widget.dart';
class IndexPage extends GetView<IndexController> {
IndexPage({Key? key}) : super(key: key);
final IndexController indexController = Get.find<IndexController>();
2023-09-03 23:37:41 +05:30
final DestinationController destinationController =
Get.find<DestinationController>();
2022-04-17 11:45:21 +05:30
@override
Widget build(BuildContext context) {
2022-07-22 19:36:04 +05:30
return WillPopScope(
onWillPop: () async {
indexController.switchPage(AppPages.INITIAL);
return false;
},
child: Scaffold(
2023-09-03 23:37:41 +05:30
drawer: DrawerPage(),
appBar: AppBar(
// leading: IconButton(
// icon: const Icon(Icons.arrow_back_ios),
// onPressed: (){
// indexController.switchPage(AppPages.TRAVEL);
// },
// ),
//automaticallyImplyLeading: false,
title: Text("add_location".tr),
actions: [
InkWell(
onTap: () {
Get.toNamed(AppPages.SEARCH);
2022-07-22 19:36:04 +05:30
},
2023-09-03 23:37:41 +05:30
child: Container(
height: 32,
width: 75,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(25),
2022-07-22 19:36:04 +05:30
),
2023-09-03 23:37:41 +05:30
child: const Center(
child: Icon(Icons.search),
),
),
),
IconButton(onPressed: () {
Get.toNamed(AppPages.HISTORY);
}, icon: const Icon(Icons.history))
//CatWidget(indexController: indexController,),
2022-07-22 19:36:04 +05:30
],
),
bottomNavigationBar: BottomAppBar(
child: Row(
2022-09-22 20:36:56 +05:30
mainAxisAlignment: MainAxisAlignment.end,
2022-07-22 19:36:04 +05:30
children: <Widget>[
2022-09-22 20:36:56 +05:30
Padding(
2023-09-03 23:37:41 +05:30
padding:
const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0),
2022-09-22 20:36:56 +05:30
child: InkWell(
2023-09-03 23:37:41 +05:30
child:
Obx(() => destinationController.is_gps_selected == true
? Padding(
padding: const EdgeInsets.only(
right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell(
child: const Image(
image: AssetImage(
'assets/images/route3_off.png'),
width: 35,
height: 35,
),
onTap: () {
indexController.switchPage(AppPages.TRAVEL);
},
),
)
: Padding(
padding: const EdgeInsets.only(
right: 10.0, top: 4.0, bottom: 4.0),
child: InkWell(
child: const Image(
image: AssetImage(
'assets/images/route2_on.png'),
width: 35,
height: 35,
),
onTap: () {
indexController.switchPage(AppPages.TRAVEL);
},
),
))),
2022-09-22 20:36:56 +05:30
),
2022-07-22 19:36:04 +05:30
],
2022-07-20 20:55:54 +05:30
),
2022-07-22 19:36:04 +05:30
),
floatingActionButton: FloatingActionButton(
2023-09-03 23:37:41 +05:30
onPressed: () {
2022-07-22 19:36:04 +05:30
indexController.toggleMode();
2023-09-03 23:37:41 +05:30
if (indexController.currentCat.isNotEmpty) {
print(indexController.currentCat[0].toString());
}
2022-07-22 19:36:04 +05:30
},
tooltip: 'Increment',
elevation: 4.0,
2023-09-03 23:37:41 +05:30
child: Obx(
() => indexController.mode == 0
? const Image(image: AssetImage('assets/images/list2.png'))
: const Image(image: AssetImage('assets/images/map.png')),
),
2022-07-22 19:36:04 +05:30
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
body: SafeArea(
child: Column(
children: [
2023-05-18 10:27:49 +05:30
// Container(
// padding: const EdgeInsets.symmetric(horizontal: 8.0),
// alignment: Alignment.centerLeft,
// height: 50.0,
// //child: SingleChildScrollView(
// // scrollDirection: Axis.horizontal,
// // child:Row(
// // mainAxisAlignment: MainAxisAlignment.start,
// // children: [
// // TextButton(child:Text("Main Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.MAINPERF);},),
// // TextButton(child:Text("Sub Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SUBPERF);},),
// // TextButton(child:Text("Cities >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.CITY);},),
// // TextButton(child:Text("Categories", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.CATEGORY);},),
// // ],
// // )
// // ),
// child: SingleChildScrollView(
// scrollDirection: Axis.horizontal,
2023-09-03 23:37:41 +05:30
// child: Obx(() =>
2023-05-18 10:27:49 +05:30
// Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
2023-09-03 23:37:41 +05:30
// indexController.is_mapController_loaded.value == false ?
2023-05-18 10:27:49 +05:30
// Center(child: CircularProgressIndicator())
// :
// BreadCrumbWidget(mapController: indexController.mapController),
// Container(width: 24.0,),
// // Row(
// // children: [
// // indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text(""),
// // indexController.currentCat.isNotEmpty ?
// // IconButton(
// // onPressed: (){
// // indexController.currentCat.clear();
// // indexController.loadLocationsBound();
2023-09-03 23:37:41 +05:30
// // },
2023-05-18 10:27:49 +05:30
// // icon: Icon(Icons.cancel, color: Colors.red,)
// // ) :
// // Container(width: 0, height: 0,)
// // ],
// // )
// ],
// )
// ),
// ),
// ),
2022-07-22 19:36:04 +05:30
Expanded(
2023-09-03 23:37:41 +05:30
child: Obx(
() => indexController.mode == 0 ? MapWidget() : ListWidget(),
))
2022-07-22 19:36:04 +05:30
],
),
2022-04-17 11:45:21 +05:30
),
),
);
}
2023-09-03 23:37:41 +05:30
}