added goal feature

This commit is contained in:
Mohamed Nouffer
2022-10-12 21:46:17 +05:30
parent 0470e1f27f
commit 8e30ee6ba7
29 changed files with 876 additions and 481 deletions

View File

@ -9,6 +9,7 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/bottom_sheet_controller.dart';
import 'package:url_launcher/url_launcher.dart';
@ -127,27 +128,21 @@ class BottomSheetNew extends GetView<BottomSheetController> {
child: Container(
alignment: Alignment.center,
child: Obx(() =>
Text(indexController.currentDestinationFeature[0].name!, style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
indexController.currentUser.length > 0 ?
Text("${TextUtils.getDisplayText(indexController.currentDestinationFeature[0].cp.toString())} : ${TextUtils.getDisplayText(indexController.currentDestinationFeature[0].checkin_point.toString())} : ${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
:
Text("${indexController.currentDestinationFeature[0].name!}", style: TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
)
),
),
),
// MaterialButton(
// onPressed: () {
// destinationController.makeNext(indexController.currentDestinationFeature[0]);
// },
// color: Colors.blue,
// textColor: Colors.white,
// child: Icon(
// Icons.arrow_forward_ios,
// size: 14,
// ),
// padding: EdgeInsets.all(16),
// shape: CircleBorder(),
// ),
],
),
),
@ -248,20 +243,6 @@ class BottomSheetNew extends GetView<BottomSheetController> {
),
),
),
// MaterialButton(
// onPressed: () {
// //print("----- next is ${indexController.currentFeature[0]} ------");
// indexController.makeNext(indexController.currentFeature[0]);
// },
// color: Colors.blue,
// textColor: Colors.white,
// child: Icon(
// Icons.arrow_forward_ios,
// size: 14,
// ),
// padding: EdgeInsets.all(16),
// shape: CircleBorder(),
// ),
],
),
),
@ -302,16 +283,6 @@ class BottomSheetNew extends GetView<BottomSheetController> {
],
),
),
// Expanded(
// child: Row(
// mainAxisAlignment: MainAxisAlignment.start,
// children: [
// Icon(Icons.thumb_up_alt_sharp, color: Colors.blue,),
// SizedBox(width: 10.0,),
// Text("Like"),
// ],
// ),
// ),
],
),
SizedBox(height: 8.0,),
@ -379,7 +350,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
],
),
),
Text('${indexController.currentFeature[0].properties!["cp"].toString()} - id: ${indexController.currentFeature[0].properties!["checkin_point"].toString()}'),
// Text('${TextUtils.getDisplayText(indexController.currentFeature[0].properties!["cp"].toString())} - id: ${TextUtils.getDisplayText(indexController.currentFeature[0].properties!["checkin_point"].toString())}'),
],
),
)
@ -391,6 +362,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
Future<Widget> wantToGo(BuildContext context)async {
bool _selected = false;
print('---target-- ${indexController.currentFeature[0].properties!["location_id"]}----');
for(Destination d in destinationController.destinations){
@ -413,15 +385,49 @@ class BottomSheetNew extends GetView<BottomSheetController> {
IconButton(
icon: Icon(Icons.pin_drop_sharp, size: 32, color: _selected == true ? Colors.amber : Colors.blue,),
onPressed: (){
if(_selected){return;}
if(_selected){
// show remove from destination
Get.defaultDialog(
title: "本当にこのポイントを通過順から外しますか?",
middleText: "場所は目的地リストから削除されます",
backgroundColor: Colors.blue.shade300,
titleStyle: TextStyle(color: Colors.white),
middleTextStyle: TextStyle(color: Colors.white),
textConfirm: "はい",
textCancel: "いいえ",
cancelTextColor: Colors.white,
confirmTextColor: Colors.blue,
buttonColor: Colors.white,
barrierDismissible: false,
radius: 10,
content: Column(
children: [
],
),
onConfirm: (){
int _id = indexController.currentFeature[0].properties!["location_id"];
Destination? d = destinationController.destinationById(_id);
print('--- des id is : ${d} -----');
if(d != null) {
//print('--- des id is : ${d.location_id} -----');
destinationController.deleteDestination(d);
Get.back();
Get.back();
Get.snackbar("追加した", "場所が削除されました");
}
}
);
return;
}
// show add to destination
Get.defaultDialog(
title: "この場所を登録してもよろしいですか",
middleText: "ロケーションがロガニング リストに追加されます",
backgroundColor: Colors.blue.shade300,
titleStyle: TextStyle(color: Colors.white),
middleTextStyle: TextStyle(color: Colors.white),
textConfirm: "確認",
textCancel: "キャンセル",
textConfirm: "はい",
textCancel: "いいえ",
cancelTextColor: Colors.white,
confirmTextColor: Colors.blue,
buttonColor: Colors.white,
@ -459,6 +465,7 @@ class BottomSheetNew extends GetView<BottomSheetController> {
);
destinationController.addDestinations(dest);
Get.back();
Get.back();
Get.snackbar("追加した", "場所が追加されました");
}
);
@ -581,13 +588,16 @@ class BottomSheetNew extends GetView<BottomSheetController> {
}
},
child: Text(text,
style: TextStyle(
color: Colors.blue,
),
overflow: TextOverflow.ellipsis,
maxLines: 5,
child: Container(
width: MediaQuery.of(context).size.width - 160,
child: Expanded(
child: Text(text,
style: TextStyle(
color: isurl ? Colors.blue : Colors.black,
),
),
),
),
),
],
);

View File

@ -1,5 +1,4 @@
import 'dart:ffi';
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';

View File

@ -205,7 +205,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
//CatWidget(indexController: widget.indexController,),
widget.indexController.cats.length > 0 ?
DropdownButton<String>(
value: widget.indexController.cateogory,
value: widget.indexController.getCatText(),
icon: const Icon(Icons.arrow_downward),
elevation: 16,
style: const TextStyle(color: Colors.deepPurple),
@ -238,123 +238,3 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
);
}
}
// class PerfectureWidget extends StatefulWidget {
// HomeController homeController;
// MapController mapController;
// PerfectureWidget({required this.homeController, required this.mapController});
// @override
// State<PerfectureWidget> createState() => _PerfectureWidgetState();
// }
// class _PerfectureWidgetState extends State<PerfectureWidget> {
// String dropdownValue = "9";
// List<DropdownMenuItem<String>> getDropdownItems() {
// List<DropdownMenuItem<String>> dropDownItems = [];
// for (Map<String, dynamic> currency in widget.homeController.perfectures[0]) {
// //print(currency["id"].toString());
// var newDropdown = DropdownMenuItem(
// child: Text(currency["adm1_ja"].toString()),
// value: currency["id"].toString(),
// );
// dropDownItems.add(newDropdown);
// }
// return dropDownItems;
// }
// List<DropdownMenuItem<String>> getSubDropdownItems() {
// List<DropdownMenuItem<String>> dropDownItems = [];
// if(widget.homeController.subPerfs.length > 0){
// for (Map<String, dynamic> currency in widget.homeController.subPerfs[0]) {
// var newDropdown = DropdownMenuItem(
// child: Text(currency["adm2_ja"].toString()),
// value: currency["id"].toString(),
// );
// dropDownItems.add(newDropdown);
// }
// }
// return dropDownItems;
// }
// @override
// void initState() {
// super.initState();
// widget.homeController.loadSubPerfFor("9");
// widget.homeController.zoomtoMainPerf("9", widget.mapController);
// }
// @override
// Widget build(BuildContext context) {
// return Obx(() =>
// Row(
// children: [
// DropdownButton<String>(
// value: dropdownValue,
// icon: const Icon(Icons.arrow_downward),
// elevation: 16,
// style: const TextStyle(color: Colors.deepPurple),
// underline: Container(
// height: 2,
// color: Colors.deepPurpleAccent,
// ),
// onChanged: (String? newValue) {
// //setState(() {
// if(newValue != null){
// dropdownValue = newValue;
// widget.homeController.loadLocationforPerf(newValue, widget.mapController);
// widget.homeController.loadSubPerfFor(newValue);
// //SubDropdownValue = widget.homeController.getSubInitialVal();
// //widget.mapController.fitBounds(widget.homeController.currentBound[0]);
// widget.homeController.zoomtoMainPerf(newValue, widget.mapController);
// }
// //});
// },
// items: getDropdownItems()
// ),
// widget.homeController.subPerfs.length > 0 ?
// DropdownButton<String>(
// value: widget.homeController.SubDropdownValue,
// icon: const Icon(Icons.arrow_downward),
// elevation: 16,
// style: const TextStyle(color: Colors.deepPurple),
// hint: Container(
// child: Text("select"),
// ),
// underline: Container(
// height: 2,
// color: Colors.deepPurpleAccent,
// ),
// onChanged: (String? newValue) {
// //setState(() {
// if(newValue != null){
// widget.homeController.loadLocationforSubPerf(newValue, widget.mapController);
// widget.homeController.SubDropdownValue = newValue;
// widget.homeController.zoomtoSubPerf(newValue, widget.mapController);
// }
// //});
// },
// items:
// getSubDropdownItems()
// ) :
// Text("")
// ],
// ),
// );
// }
// }