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

149 lines
5.9 KiB
Dart
Raw Normal View History

2022-04-17 11:45:21 +05:30
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
2022-07-10 23:50:43 +05:30
import 'package:rogapp/model/destination.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-05-18 19:09:26 +05:30
import 'package:rogapp/services/maxtrix_service.dart';
2022-07-10 23:50:43 +05:30
import 'package:rogapp/utils/database_helper.dart';
2022-04-17 11:45:21 +05:30
import 'package:rogapp/widgets/bread_crum_widget.dart';
2022-05-12 02:17:08 +05:30
import 'package:rogapp/widgets/cat_widget.dart';
2022-04-17 11:45:21 +05:30
import 'package:rogapp/widgets/list_widget.dart';
import 'package:rogapp/widgets/map_widget.dart';
2022-05-24 20:43:41 +05:30
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
2022-04-17 11:45:21 +05:30
class IndexPage extends GetView<IndexController> {
IndexPage({Key? key}) : super(key: key);
final IndexController indexController = Get.find<IndexController>();
@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(
drawer: const DrawerPage(),
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back_ios),
onPressed: (){
indexController.switchPage(AppPages.TRAVEL);
},
),
//automaticallyImplyLeading: false,
title: Text("Add locations"),
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.center,
children: <Widget>[
Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),),
const Expanded(child: Text('')),
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
2022-07-20 20:55:54 +05:30
indexController.switchPage(AppPages.TRAVEL);
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(
onPressed: (){
indexController.toggleMode();
if(indexController.currentCat.isNotEmpty){
print(indexController.currentCat[0].toString());
}
},
tooltip: 'Increment',
child: const Icon(Icons.document_scanner),
elevation: 4.0,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
body: SafeArea(
child: Column(
children: [
Container(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
alignment: Alignment.centerLeft,
height: 50.0,
child: SingleChildScrollView(
scrollDirection: Axis.horizontal,
2022-07-22 23:13:44 +05:30
child:Row(
mainAxisAlignment: MainAxisAlignment.start,
2022-07-22 19:36:04 +05:30
children: [
2022-07-22 23:13:44 +05:30
TextButton(child:Text("Main Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SEARCH);},),
TextButton(child:Text("Sub Pef >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SEARCH);},),
TextButton(child:Text("Cities >", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SEARCH);},),
TextButton(child:Text("Categories", style: TextStyle(fontSize:16.0, fontWeight: FontWeight.bold),), onPressed: (){Get.toNamed(AppPages.SEARCH);},),
2022-07-22 19:36:04 +05:30
],
)
2022-07-20 20:55:54 +05:30
),
2022-07-22 23:13:44 +05:30
// 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,)
// ],
// )
// ],
// )
// ),
// ),
2022-07-20 20:55:54 +05:30
),
2022-07-22 19:36:04 +05:30
Expanded(
2022-07-09 22:51:34 +05:30
child: Obx(() =>
2022-07-22 19:36:04 +05:30
indexController.mode == 0 ?
MapWidget() :
ListWidget(),
2022-07-09 22:51:34 +05:30
)
2022-07-22 19:36:04 +05:30
2022-04-17 11:45:21 +05:30
)
2022-07-22 19:36:04 +05:30
],
),
2022-04-17 11:45:21 +05:30
),
),
);
}
}