import 'dart:ui'; import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:rogapp/model/destination.dart'; import 'package:rogapp/pages/destination/destination_controller.dart'; import 'package:rogapp/pages/drawer/drawer_page.dart'; import 'package:rogapp/pages/index/index_controller.dart'; import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/services/maxtrix_service.dart'; import 'package:rogapp/utils/database_helper.dart'; import 'package:rogapp/widgets/bread_crum_widget.dart'; import 'package:rogapp/widgets/cat_widget.dart'; import 'package:rogapp/widgets/list_widget.dart'; import 'package:rogapp/widgets/map_widget.dart'; import 'package:flutter_polyline_points/flutter_polyline_points.dart'; class IndexPage extends GetView { IndexPage({Key? key}) : super(key: key); final IndexController indexController = Get.find(); final DestinationController destinationController = Get.find(); @override Widget build(BuildContext context) { return WillPopScope( onWillPop: () async { indexController.switchPage(AppPages.INITIAL); return false; }, child: Scaffold( //drawer: const DrawerPage(), appBar: AppBar( leading: IconButton( icon: Icon(Icons.arrow_back_ios), onPressed: (){ indexController.switchPage(AppPages.TRAVEL); }, ), //automaticallyImplyLeading: false, title: Text("add_location".tr), actions: [ InkWell( onTap: (){ Get.toNamed(AppPages.SEARCH); }, child: Container( height: 32, width: 75, decoration: BoxDecoration( color: Colors.blue, borderRadius: BorderRadius.circular(25), ), child: const Center(child: Icon(Icons.search),), ), ), //CatWidget(indexController: indexController,), ], ), bottomNavigationBar: BottomAppBar( child: Row( mainAxisAlignment: MainAxisAlignment.end, children: [ Padding( padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), child: InkWell( child: Obx(() => destinationController.is_gps_selected == true ? Padding( padding: const EdgeInsets.only(right: 10.0, top: 4.0, bottom: 4.0), child: InkWell( child: 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: Image(image: AssetImage('assets/images/route2_on.png'),width: 35, height: 35,), onTap: (){ indexController.switchPage(AppPages.TRAVEL); }, ), ) ) ), ), ], ), ), floatingActionButton: FloatingActionButton( onPressed: (){ indexController.toggleMode(); if(indexController.currentCat.isNotEmpty){ print(indexController.currentCat[0].toString()); } }, tooltip: 'Increment', child: Obx(() => indexController.mode == 0 ? Image(image: AssetImage('assets/images/list2.png')) : Image(image: AssetImage('assets/images/map.png')), ), elevation: 4.0, ), floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked, body: SafeArea( child: Column( children: [ // 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, // child: Obx(() => // Row( // mainAxisAlignment: MainAxisAlignment.spaceBetween, // children: [ // indexController.is_mapController_loaded.value == false ? // 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(); // // }, // // icon: Icon(Icons.cancel, color: Colors.red,) // // ) : // // Container(width: 0, height: 0,) // // ], // // ) // ], // ) // ), // ), // ), Expanded( child: Obx(() => indexController.mode == 0 ? MapWidget() : ListWidget(), ) ) ], ), ), ), ); } }