This commit is contained in:
Mohamed Nouffer
2022-05-12 02:17:08 +05:30
parent 9d253fc5e2
commit 80a976baa0
37 changed files with 1159 additions and 592 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 325 KiB

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart'; import 'package:google_fonts/google_fonts.dart';
import 'package:rogapp/index/index_binding.dart'; import 'package:rogapp/pages/index/index_binding.dart';
import 'package:rogapp/routes/app_pages.dart'; import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/utils/string_values.dart'; import 'package:rogapp/utils/string_values.dart';

View File

@ -0,0 +1,10 @@
import 'package:get/get.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
class DestinationBinding extends Bindings {
@override
void dependencies() {
Get.put<DestinationController>(DestinationController());
}
}

View File

@ -0,0 +1,46 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/destination_service.dart';
class DestinationController extends GetxController {
List<dynamic> destinations = <dynamic>[].obs;
final IndexController indexController = Get.find<IndexController>();
@override
void onInit() {
PopulateDestinations();
super.onInit();
}
void PopulateDestinations(){
if(indexController.currentUser.isNotEmpty){
int user_id = indexController.currentUser[0]["user"]["id"] as int;
//print(user_id);
DestinationService.getDestinations(user_id).then((value){
destinations.clear();
destinations = value;
//var val = value[2]["location"]["id"];
//print("-----current destinations ----- ${val}");
});
}
else{
Get.toNamed(AppPages.LOGIN);
}
}
void makeOrder(BuildContext context, int action_id, int order, String dir){
DestinationService.updateOrder(action_id, order, dir).then((value){
//print("----action value----${value}");
PopulateDestinations();
});
}
}

View File

@ -0,0 +1,124 @@
import 'dart:developer';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
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:timeline_tile/timeline_tile.dart';
class DestinationPage extends StatefulWidget {
DestinationPage({ Key? key }) : super(key: key);
@override
State<DestinationPage> createState() => _DestinationPageState();
}
class _DestinationPageState extends State<DestinationPage> {
final DestinationController destinationController = Get.find<DestinationController>();
final IndexController indexController = Get.find<IndexController>();
final List<int> _items = List<int>.generate(50, (int index) => index);
Image getImage(int index){
if(destinationController.destinations[index]["location"]["properties"]["photos"] == null || destinationController.destinations[index]["location"]["properties"]["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
return Image(image: NetworkImage(destinationController.destinations[index]["location"]["properties"]["photos"]));
}
}
@override
Widget build(BuildContext context) {
final ColorScheme colorScheme = Theme.of(context).colorScheme;
final Color oddItemColor = colorScheme.primary.withOpacity(0.05);
final Color evenItemColor = colorScheme.primary.withOpacity(0.15);
return Scaffold(
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: (){
if(indexController.currentUser.isNotEmpty){
Get.toNamed(AppPages.TRAVEL);
}
else{
Get.toNamed(AppPages.LOGIN);
}
}),),
],
),
),
floatingActionButton: FloatingActionButton(
onPressed: (){
indexController.toggleMode();
if(indexController.currentCat.isNotEmpty){
print("###############");
print(indexController.currentCat[0].toString());
}
},
tooltip: 'Increment',
child: const Icon(Icons.document_scanner),
elevation: 4.0,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
appBar:AppBar(
title: Text("Iternery"),
),
body:Obx(() =>
ReorderableListView.builder(
itemCount: destinationController.destinations.length,
onReorder: (int oldIndex, int newIndex){
int action_id = destinationController.destinations[oldIndex]["id"] as int;
//print(action_id);
if(oldIndex > newIndex){
destinationController.makeOrder(context, action_id, newIndex, "up");
}
else if(oldIndex < newIndex){
destinationController.makeOrder(context, action_id, newIndex, "down");
}
},
itemBuilder: (BuildContext context, int index) {
return TimelineTile(
alignment: TimelineAlign.manual,
lineXY: 0.2,
isFirst: index == 0 ? true : false,
indicatorStyle: IndicatorStyle(
color: Colors.red //index == 0 ? (Colors.red)! : (Colors.grey[400])!
),
key: Key(index.toString()),
endChild: Card(
child: Container(
constraints: const BoxConstraints(
minHeight: 80,
),
child: ListTile(
leading: getImage(index),
title: Text(destinationController.destinations[index]["location"]["properties"]["location_name"]),
subtitle: Text(destinationController.destinations[index]["location"]["properties"]["category"]),
),
),
),
startChild: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text("12:30"),
Text("01:20"),
],
),
);
}
)
)
);
}
}

View File

@ -1,6 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/routes/app_pages.dart';
class DrawerPage extends StatelessWidget { class DrawerPage extends StatelessWidget {
const DrawerPage({ Key? key }) : super(key: key); const DrawerPage({ Key? key }) : super(key: key);
@ -22,7 +23,9 @@ class DrawerPage extends StatelessWidget {
ListTile( ListTile(
leading: const Icon(Icons.login), leading: const Icon(Icons.login),
title: Text("login".tr), title: Text("login".tr),
onTap: (){}, onTap: (){
Get.toNamed(AppPages.LANDING);
},
), ),
ListTile( ListTile(
leading: const Icon(Icons.password), leading: const Icon(Icons.password),

View File

@ -1,13 +0,0 @@
// import 'package:flutter_map/flutter_map.dart';
// import 'package:get/get_core/src/get_main.dart';
// import 'package:get/get_instance/src/bindings_interface.dart';
// import 'package:get/get_instance/src/extension_instance.dart';
// import 'package:rogapp/pages/home/home_controller.dart';
// class HomeBinding extends Bindings {
// @override
// void dependencies() {
// Get.put<HomeController>(HomeController());
// }
// }

View File

@ -1,199 +0,0 @@
// import 'package:flutter_map/plugin_api.dart';
// import 'package:geojson/geojson.dart';
// import 'package:get/get.dart';
// import 'package:latlong2/latlong.dart';
// import 'package:meta/meta.dart';
// import 'package:rogapp/pages/map/map_page.dart';
// import 'package:rogapp/services/location_service.dart';
// import 'package:rogapp/services/perfecture_service.dart';
// class HomeController extends GetxController {
// List<GeoJsonFeatureCollection> locations = <GeoJsonFeatureCollection>[].obs;
// List<GeoJsonFeature> currentFeature = <GeoJsonFeature>[].obs;
// List<dynamic> perfectures = <dynamic>[].obs;
// List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
// List<dynamic> subPerfs = <dynamic>[].obs;
// String SubDropdownValue = "-1";
// @override
// void onInit() {
// super.onInit();
// if(locations.length == 0){
// LocationService.loadLocations().then((value){
// locations.add(value!);
// //print(value);
// });
// }
// if(perfectures.length == 0){
// PerfectureService.loadPerfectures().then((value){
// perfectures.add(value);
// loadSubPerfFor("9");
// });
// }
// }
// void getBoundFromLatLng(List<LatLng> list) {
// double? x0, x1, y0, y1;
// for (LatLng latLng in list) {
// if (x0 == null) {
// x0 = x1 = latLng.latitude;
// y0 = y1 = latLng.longitude;
// } else {
// if (latLng.latitude > x1!) x1 = latLng.latitude;
// if (latLng.latitude < x0) x0 = latLng.latitude;
// if (latLng.longitude > y1!) y1 = latLng.longitude;
// if (latLng.longitude < y0!) y0 = latLng.longitude;
// }
// }
// currentBound.clear();
// if(x0 != null && x1 != null && y0 != null && y1 != null ){
// currentBound.add(LatLngBounds(LatLng(x1, y1), LatLng(x0, y0)));
// }
// }
// void setBounds(){
// List<LatLng> lts = [];
// if(locations.length > 0){
// for(GeoJsonFeature i in locations[0].collection){
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
// LatLng lt = LatLng(p.geoSerie!.geoPoints[0].latitude , p.geoSerie!.geoPoints[0].longitude) ;
// lts.add(lt);
// }
// }
// else{
// LatLng lt = LatLng(37.15319600454702, 139.58765950528198);
// lts.add(lt);
// }
// getBoundFromLatLng(lts);
// }
// void zoomtoMainPerf(String id, MapController mapController){
// PerfectureService.getMainPerfExt(id).then((value){
// print(value);
// LatLng lat1 = LatLng(value![1], value[0]);
// LatLng lat2 = LatLng(value[3], value[2]);
// LatLngBounds bound = LatLngBounds(lat1, lat2);
// mapController.fitBounds(bound);
// });
// }
// void zoomtoSubPerf(String id, MapController mapController){
// PerfectureService.getSubExt(id).then((value){
// LatLng lat1 = LatLng(value![1], value[0]);
// LatLng lat2 = LatLng(value[3], value[2]);
// LatLngBounds bound = LatLngBounds(lat1, lat2);
// mapController.fitBounds(bound);
// });
// }
// void loadLocationforPerf(String perf, MapController mapController) async {
// locations.clear();
// LocationService.loadLocationsFor(perf).then((value){
// locations.add(value!);
// setBounds();
// mapController.fitBounds(currentBound[0]);
// });
// }
// void loadLocationforSubPerf(String subperf, MapController mapController) async {
// locations.clear();
// LocationService.loadLocationsSubFor(subperf).then((value){
// locations.add(value!);
// //setBounds();
// //mapController!.fitBounds(currentBound[0]);
// });
// }
// void loadSubPerfFor(String perf){
// subPerfs.clear();
// dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
// PerfectureService.loadSubPerfectures(perf).then((value){
// value!.add(initVal);
// subPerfs.add(value);
// SubDropdownValue = getSubInitialVal();
// //print(subPerfs[0]);
// });
// }
// String getSubInitialVal(){
// int min = 0;
// if(subPerfs.length > 0){
// min = subPerfs[0][0]['id'] as int;
// for(var sub in subPerfs[0]){
// int x = int.parse(sub['id'].toString()); // as int;
// if(x < min){
// min = x;
// }
// }
// }
// return min.toString();
// }
// GeoJsonFeature? getFeatureForLatLong(double lat, double long){
// if(locations.length > 0){
// for(GeoJsonFeature i in locations[0].collection){
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
// if(p.geoSerie!.geoPoints[0].latitude == lat && p.geoSerie!.geoPoints[0].longitude == long){
// return i;
// }
// }
// }
// }
// void makeNext(GeoJsonFeature fs){
// GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
// for(int i=0; i<= locations[0].collection.length - 1; i++){
// GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
// if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
// if(currentFeature.length > 0){
// currentFeature.clear();
// }
// if(i >= locations[0].collection.length - 1 ){
// currentFeature.add(locations[0].collection[0] as GeoJsonFeature);
// }
// else{
// currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature);
// }
// }
// }
// }
// void makePrevious(GeoJsonFeature fs){
// GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
// for(int i=0; i<= locations[0].collection.length - 1; i++){
// GeoJsonMultiPoint p = locations[0].collection[i].geometry as GeoJsonMultiPoint;
// if(p.geoSerie!.geoPoints[0].latitude == pt.geometry!.geoSerie!.geoPoints[0].latitude && p.geoSerie!.geoPoints[0].longitude == pt.geometry!.geoSerie!.geoPoints[0].longitude ){
// if(currentFeature.length > 0){
// currentFeature.clear();
// }
// if(i == 0 ){
// currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature);
// }
// else{
// currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature);
// }
// }
// }
// }
// }

View File

@ -1,129 +0,0 @@
// import 'dart:ui';
// import 'package:flutter/material.dart';
// import 'package:flutter_map/plugin_api.dart';
// import 'package:geojson/geojson.dart';
// import 'package:get/get.dart';
// import 'package:rogapp/pages/drawer/drawer_page.dart';
// import 'package:rogapp/pages/home/home_controller.dart';
// import 'package:rogapp/routes/app_pages.dart';
// import 'package:rogapp/services/perfecture_service.dart';
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
// import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
// import 'package:rogapp/widgets/perfecture_widget.dart';
// class HomePage extends GetView<HomeController> {
// final HomeController homeController = Get.find<HomeController>();
// MapController mapController = Get.arguments[0];
// void changeCurrentFeature(GeoJsonFeature fs){
// if(homeController.currentFeature.length > 0){
// homeController.currentFeature.clear();
// }
// homeController.currentFeature.add(fs);
// }
// Image getImage(int index){
// if(homeController.locations[0].collection[index].properties!["photos"] == null || homeController.locations[0].collection[index].properties!["photos"] == ""){
// return Image(image: AssetImage('assets/images/empty_image.png'));
// }
// else{
// return Image(image: NetworkImage(homeController.locations[0].collection[index].properties!["photos"]));
// }
// }
// Widget getBreadCurms(){
// return Obx(() =>
// homeController.perfectures.length > 0 ?
// BreadCrumb.builder(
// itemCount: homeController.perfectures.length,
// builder: (index) {
// return BreadCrumbItem(
// content: PerfectureWidget(homeController: homeController, mapController: mapController) //Text('Item$index')
// );
// },
// divider: Icon(Icons.chevron_right),
// ) :
// Container(width: 0, height: 0,),
// );
// }
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// drawer: DrawerPage(),
// appBar: AppBar(
// title: Text("app_title".tr),
// centerTitle: true,
// actions: [
// IconButton(
// icon: const Icon(Icons.map),
// onPressed: (){
// //print(homeController.locations.length);
// },
// )
// ],
// ),
// floatingActionButton: new FloatingActionButton(
// onPressed: (){
// Get.toNamed(AppPages.MAP);
// },
// tooltip: 'Increment',
// child: new Icon(Icons.document_scanner),
// elevation: 4.0,
// ),
// bottomNavigationBar: BottomAppBar(
// child: new Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Expanded(child: IconButton(icon: Icon(Icons.camera_enhance), onPressed: (){},),),
// Expanded(child: new Text('')),
// Expanded(child: IconButton(icon: Icon(Icons.travel_explore), onPressed: (){}),),
// ],
// ),
// ),
// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
// body:Column(
// children: [
// Padding(
// padding: const EdgeInsets.symmetric(horizontal: 8.0),
// child: Container(
// alignment: Alignment.centerLeft,
// height: 50.0,
// child: getBreadCurms(),
// ),
// ),
// Expanded(
// child: Obx(() =>
// homeController.locations.length > 0 ?
// ListView.builder(
// itemCount: homeController.locations[0].collection.length,
// shrinkWrap: true,
// itemBuilder: (_, index){
// return Card(
// child: ListTile(
// onTap: (){
// GeoJsonFeature gf = homeController.locations[0].collection[index];
// changeCurrentFeature(gf);
// showModalBottomSheet(
// isScrollControlled: true,
// context: context,
// builder: (context) => BottomSheetWidget(),
// );
// },
// leading: getImage(index),
// title: Text(homeController.locations[0].collection[index].properties!['location_name'].toString()),
// subtitle: Text(homeController.locations[0].collection[index].properties!['category']),
// ),
// );
// },
// ) : Container(width: 0, height: 0,),
// )
// )
// ],
// )
// );
// }
// }

View File

@ -1,7 +1,7 @@
import 'package:flutter_map/plugin_api.dart'; import 'package:flutter_map/plugin_api.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
class IndexBinding extends Bindings { class IndexBinding extends Bindings {
@override @override

View File

@ -1,9 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/services/action_service.dart';
import 'package:rogapp/services/auth_service.dart';
import 'package:rogapp/services/cat_service.dart';
import 'package:rogapp/services/location_service.dart'; import 'package:rogapp/services/location_service.dart';
import 'package:rogapp/services/perfecture_service.dart'; import 'package:rogapp/services/perfecture_service.dart';
@ -13,11 +16,22 @@ class IndexController extends GetxController {
List<dynamic> perfectures = <dynamic>[].obs; List<dynamic> perfectures = <dynamic>[].obs;
List<LatLngBounds> currentBound = <LatLngBounds>[].obs; List<LatLngBounds> currentBound = <LatLngBounds>[].obs;
List<dynamic> subPerfs = <dynamic>[].obs; List<dynamic> subPerfs = <dynamic>[].obs;
List<dynamic> cats = <dynamic>[].obs;
List<String> currentCat = <String>[].obs;
List<Map<String, dynamic>> currentUser = <Map<String, dynamic>>[].obs;
List<dynamic> currentAction = <dynamic>[].obs;
var is_loading = false.obs;
MapController? mapController; MapController? mapController;
var mode = 0.obs; var mode = 0.obs;
String dropdownValue = "9";
String subDropdownValue = "-1"; String subDropdownValue = "-1";
void toggleMode(){ void toggleMode(){
@ -45,6 +59,78 @@ class IndexController extends GetxController {
loadSubPerfFor("9"); loadSubPerfFor("9");
}); });
} }
loadCats();
}
void login(String email, String password, BuildContext context){
AuthService.login(email, password).then((value){
if(value.isNotEmpty){
currentUser.clear();
currentUser.add(value);
is_loading.value = false;
Navigator.pop(context);
if(currentFeature.isNotEmpty){
getAction();
}
Get.toNamed(AppPages.INITIAL);
}else{
is_loading.value = false;
Get.snackbar("Failed", "User login failed, please try again.");
}
});
}
void register(String email, String password, BuildContext context){
AuthService.register(email, password).then((value){
if(value.isNotEmpty){
currentUser.clear();
currentUser.add(value);
is_loading.value = false;
Navigator.pop(context);
Get.toNamed(AppPages.INITIAL);
}else{
is_loading.value = false;
Get.snackbar("Failed", "User registration failed, please try again.");
}
});
}
void makeAction(BuildContext context){
int user_id = currentUser[0]["user"]["id"] as int;
int location_id = currentFeature[0].properties!["location_id"] as int;
bool wanttogo = currentAction[0][0]["wanttogo"];
bool like = currentAction[0][0]["like"];
bool checkin = currentAction[0][0]["checkin"];
print("----userid----${user_id}");
if(user_id > 0){
ActionService.makeAction(user_id, location_id, wanttogo, like, checkin).then((value){
print("----action value----${value}");
});
}
}
void loadCats(){
dynamic initVal = {'category':'---'};
CatService.loadCats().then((value) {
//value!.add(initVal);
print("###########");
print(value);
cats.add(value);
});
}
void refreshLocationForCat(){
if(subDropdownValue == "-1"){
LocationService.loadLocationsFor(dropdownValue, currentCat[0]);
print("loading main------");
}
else{
LocationService.loadLocationsSubFor(subDropdownValue, currentCat[0]);
print("loading sub------");
}
} }
void loadSubPerfFor(String perf){ void loadSubPerfFor(String perf){
@ -73,7 +159,7 @@ class IndexController extends GetxController {
void loadLocationforPerf(String perf, MapController mapController) async { void loadLocationforPerf(String perf, MapController mapController) async {
locations.clear(); locations.clear();
LocationService.loadLocationsFor(perf).then((value){ LocationService.loadLocationsFor(perf, currentCat[0]).then((value){
locations.add(value!); locations.add(value!);
mapController.fitBounds(currentBound[0]); mapController.fitBounds(currentBound[0]);
}); });
@ -81,7 +167,7 @@ class IndexController extends GetxController {
void loadLocationforSubPerf(String subperf, MapController mapController) async { void loadLocationforSubPerf(String subperf, MapController mapController) async {
locations.clear(); locations.clear();
LocationService.loadLocationsSubFor(subperf).then((value){ LocationService.loadLocationsSubFor(subperf, currentCat[0]).then((value){
locations.add(value!); locations.add(value!);
}); });
} }
@ -140,6 +226,28 @@ class IndexController extends GetxController {
} }
} }
void getAction(){
//print(currentUser[0]["user"]["id"]);
//print(currentFeature[0].properties!["location_id"]);
if(currentUser.length == 0){
return;
}
int user_id = currentUser[0]["user"]["id"] as int;
int location_id = currentFeature[0].properties!["location_id"] as int;
ActionService.userAction(user_id, location_id).then((value){
print("------${value}");
if(value != null && value.length > 0){
currentAction.clear();
currentAction.add(value);
print("------${currentAction[0]}");
}else{
List<dynamic> initval = [{"user": user_id, "location": location_id, "wanttogo": false, "like": false, "checkin": false}];
currentAction.clear();
currentAction.add(initval);
}
});
}
void makeNext(GeoJsonFeature fs){ void makeNext(GeoJsonFeature fs){
GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>; GeoJsonFeature<GeoJsonMultiPoint> pt = fs as GeoJsonFeature<GeoJsonMultiPoint>;
@ -153,9 +261,11 @@ class IndexController extends GetxController {
} }
if(i >= locations[0].collection.length - 1 ){ if(i >= locations[0].collection.length - 1 ){
currentFeature.add(locations[0].collection[0] as GeoJsonFeature); currentFeature.add(locations[0].collection[0] as GeoJsonFeature);
getAction();
} }
else{ else{
currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature); currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature);
getAction();
} }
} }
} }
@ -175,9 +285,11 @@ class IndexController extends GetxController {
} }
if(i == 0 ){ if(i == 0 ){
currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature); currentFeature.add(locations[0].collection[locations[0].collection.length -1] as GeoJsonFeature);
getAction();
} }
else{ else{
currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature); currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature);
getAction();
} }
} }
} }

View File

@ -2,9 +2,11 @@ import 'dart:ui';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/index/index_controller.dart';
import 'package:rogapp/pages/drawer/drawer_page.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/widgets/bread_crum_widget.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/list_widget.dart';
import 'package:rogapp/widgets/map_widget.dart'; import 'package:rogapp/widgets/map_widget.dart';
@ -20,10 +22,8 @@ class IndexPage extends GetView<IndexController> {
appBar: AppBar( appBar: AppBar(
title: Text("app_title".tr), title: Text("app_title".tr),
actions: [ actions: [
IconButton( ElevatedButton(onPressed: (){}, child: CatWidget(indexController: indexController,)),
icon: const Icon(Icons.map), //CatWidget(indexController: indexController,),
onPressed: () => {},
)
], ],
), ),
bottomNavigationBar: BottomAppBar( bottomNavigationBar: BottomAppBar(
@ -32,13 +32,25 @@ class IndexPage extends GetView<IndexController> {
children: <Widget>[ children: <Widget>[
Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),), Expanded(child: IconButton(icon: const Icon(Icons.camera_enhance), onPressed: (){},),),
const Expanded(child: Text('')), const Expanded(child: Text('')),
Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){}),), Expanded(child: IconButton(icon: const Icon(Icons.travel_explore), onPressed: (){
if(indexController.currentUser.isNotEmpty){
Get.toNamed(AppPages.TRAVEL);
}
else{
Get.toNamed(AppPages.LOGIN);
}
}),),
], ],
), ),
), ),
floatingActionButton: FloatingActionButton( floatingActionButton: FloatingActionButton(
onPressed: (){ onPressed: (){
indexController.toggleMode(); indexController.toggleMode();
if(indexController.currentCat.isNotEmpty){
print("###############");
print(indexController.currentCat[0].toString());
}
}, },
tooltip: 'Increment', tooltip: 'Increment',
child: const Icon(Icons.document_scanner), child: const Icon(Icons.document_scanner),
@ -54,7 +66,16 @@ class IndexPage extends GetView<IndexController> {
height: 50.0, height: 50.0,
child: SingleChildScrollView( child: SingleChildScrollView(
scrollDirection: Axis.horizontal, scrollDirection: Axis.horizontal,
child: BreadCrumbWidget(), child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
BreadCrumbWidget(),
Container(width: 24.0,),
Obx(()=>
indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text("")
),
],
),
), ),
), ),
Expanded( Expanded(

View File

@ -0,0 +1,91 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/routes/app_pages.dart';
class LandingPage extends StatefulWidget {
const LandingPage({ Key? key }) : super(key: key);
@override
State<LandingPage> createState() => _LandingPageState();
}
class _LandingPageState extends State<LandingPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"こんにちは!",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
),
SizedBox(height: 30,),
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
textAlign: TextAlign.center,
style: TextStyle(
color: Colors.grey[700],
fontSize: 15
),
),
Container(
height: MediaQuery.of(context).size.height/3,
decoration: BoxDecoration(
image:DecorationImage(image: AssetImage('assets/gradient_japanese_temple.jpg'))
),
),
SizedBox(height: 20.0,),
MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
color: Colors.indigoAccent[400],
shape: RoundedRectangleBorder(
side: BorderSide(
color: Colors.black,
),
borderRadius: BorderRadius.circular(40)
),
child: Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
),
SizedBox(height: 15.0,),
MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
Get.toNamed(AppPages.REGISTER);
},
color: Colors.redAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("サインアップ",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,
),),
),
],
)
],
),
),
),
);
}
}

View File

@ -0,0 +1,170 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
class LoginPage extends StatelessWidget {
final IndexController indexController = Get.find<IndexController>();
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
brightness: Brightness.light,
backgroundColor: Colors.white,
leading:
IconButton( onPressed: (){
Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
),
body: Container(
height: MediaQuery.of(context).size.height,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Column(
children: [
Column(
children: [
Text ("ログイン", style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
),),
SizedBox(height: 20,),
Text("お帰りなさい !資格情報を使用してログインします",style: TextStyle(
fontSize: 15,
color: Colors.grey[700],
),),
SizedBox(height: 30,)
],
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 40
),
child: Column(
children: [
makeInput(label: "Eメール", controller: emailController),
makeInput(label: "パスワード", controller: passwordController, obsureText: true),
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
border: Border(
bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black),
left: BorderSide(color: Colors.black)
)
),
child: Obx((() =>
indexController.is_loading == true ? MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
},
color: Colors.grey[400],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: CircularProgressIndicator(),
) :
MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
if(emailController.text.isEmpty || passwordController.text.isEmpty){
Get.snackbar("No values", "Email and password required");
return;
}
indexController.is_loading.value = true;
indexController.login(emailController.text, passwordController.text, context);
},
color: Colors.indigoAccent[400],
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
)
),
),
)
),
SizedBox(height: 20,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Text("アカウントをお持ちではありませんか?", style: TextStyle(
overflow: TextOverflow.ellipsis,
),),
),
TextButton(
onPressed: (){
Get.toNamed(AppPages.REGISTER);
},
child: Text("サインアップ",style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18
),),
),
],
)
],
),
],
),
),
);
}
}
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,style:TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: Colors.black87
),),
SizedBox(height: 5,),
TextField(
controller: controller,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: (Colors.grey[400])!,
),
),
border: OutlineInputBorder(
borderSide: BorderSide(color: (Colors.grey[400])!
),
),
),
),
SizedBox(height: 30.0,)
],
);
}

View File

@ -1,14 +0,0 @@
// import 'package:flutter_map/flutter_map.dart';
// import 'package:get/get_core/src/get_main.dart';
// import 'package:get/get_instance/src/bindings_interface.dart';
// import 'package:get/get_instance/src/extension_instance.dart';
// import 'package:rogapp/pages/home/home_controller.dart';
// class MapBinding extends Bindings {
// @override
// void dependencies() {
// Get.put<HomeController>(HomeController());
// Get.put<MapController>(MapController());
// }
// }

View File

@ -1,181 +0,0 @@
// import 'package:flutter/material.dart';
// import 'package:flutter/rendering.dart';
// import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
// import 'package:flutter_map/plugin_api.dart';
// import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
// import 'package:geojson/geojson.dart';
// import 'package:get/get.dart';
// import 'package:get/get_state_manager/get_state_manager.dart';
// import 'package:latlong2/latlong.dart';
// import 'package:rogapp/pages/drawer/drawer_page.dart';
// import 'package:rogapp/pages/home/home_controller.dart';
// import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.dart';
// import 'package:rogapp/routes/app_pages.dart';
// import 'package:rogapp/widgets/base_layer_widget.dart';
// import 'package:rogapp/widgets/bottom_sheet_widget.dart';
// import 'package:rogapp/widgets/perfecture_widget.dart';
// class MapPage extends GetView<HomeController> {
// MapPage({ Key? key }) : super(key: key);
// final HomeController homeController = Get.find<HomeController>();
// final MapController mapController = MapController();
// Widget getBreadCurms(){
// return Obx(() =>
// homeController.perfectures.length > 0 ?
// BreadCrumb.builder(
// itemCount: homeController.perfectures.length,
// builder: (index) {
// return BreadCrumbItem(
// content: PerfectureWidget(homeController: homeController, mapController: mapController) //Text('Item$index')
// );
// },
// divider: Icon(Icons.chevron_right),
// ) :
// Container(width: 0, height: 0,),
// );
// }
// @override
// Widget build(BuildContext context) {
// final PopupController _popupController = PopupController();
// return Scaffold(
// drawer: DrawerPage(),
// appBar: AppBar(
// title: Text("app_title".tr),
// actions: [
// IconButton(
// icon: const Icon(Icons.map),
// onPressed: () => {print("action")},
// )
// ],
// ),
// bottomNavigationBar: BottomAppBar(
// child: new Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: <Widget>[
// Expanded(child: IconButton(icon: Icon(Icons.camera_enhance), onPressed: (){},),),
// Expanded(child: new Text('')),
// Expanded(child: IconButton(icon: Icon(Icons.travel_explore), onPressed: (){}),),
// ],
// ),
// ),
// floatingActionButton: new FloatingActionButton(
// onPressed: (){
// Get.toNamed(AppPages.INITIAL, arguments: [mapController]);
// },
// tooltip: 'Increment',
// child: new Icon(Icons.document_scanner),
// elevation: 4.0,
// ),
// floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
// body: SafeArea(
// child: Column(
// children: [
// Container(
// padding: EdgeInsets.symmetric(horizontal: 16.0),
// alignment: Alignment.centerLeft,
// height: 50.0,
// child: SingleChildScrollView(
// scrollDirection: Axis.horizontal,
// child:
// getBreadCurms(),
// ),
// ),
// Expanded(
// child: Obx(() =>
// Stack(
// children: [
// FlutterMap(
// mapController: mapController,
// options: MapOptions(
// //center: LatLng(37.15319600454702, 139.58765950528198),
// bounds: homeController.currentBound.length > 0 ? homeController.currentBound[0]: LatLngBounds.fromPoints([LatLng(37.15319600454702, 139.58765950528198)]),
// zoom: 6,
// maxZoom: 20,
// plugins: [
// MarkerClusterPlugin(),
// ],
// onTap: (_, __) =>
// _popupController
// .hideAllPopups(), // Hide popup when the map is tapped.
// ),
// children: [
// BaseLayer(),
// LocationMarkerLayerWidget(),
// homeController.locations.length > 0 ?
// MarkerClusterLayerWidget(
// options: MarkerClusterLayerOptions(
// spiderfyCircleRadius: 80,
// spiderfySpiralDistanceMultiplier: 2,
// circleSpiralSwitchover: 12,
// maxClusterRadius: 20,
// rotate: true,
// onMarkerTap: (marker){
// GeoJsonFeature? fs = homeController.getFeatureForLatLong(marker.point.latitude, marker.point.longitude);
// print(fs);
// if(fs != null){
// if(homeController.currentFeature.length > 0) {
// homeController.currentFeature.clear();
// }
// homeController.currentFeature.add(fs);
// showModalBottomSheet(context: context, isScrollControlled: true,
// builder:((context) => BottomSheetWidget())
// );
// }
// },
// size: Size(40, 40),
// anchor: AnchorPos.align(AnchorAlign.center),
// fitBoundsOptions: const FitBoundsOptions(
// padding: EdgeInsets.all(50),
// maxZoom: 265,
// ),
// markers:homeController.locations[0].collection.map((i) {
// GeoJsonMultiPoint p = i.geometry as GeoJsonMultiPoint;
// return Marker(
// anchorPos: AnchorPos.align(AnchorAlign.center),
// height: 70.0,
// width: 70.0,
// point: LatLng(p.geoSerie!.geoPoints[0].latitude, p.geoSerie!.geoPoints[0].longitude),
// builder: (ctx) => Icon(Icons.pin_drop),
// );
// }).toList(),
// builder: (context, markers) {
// return Container(
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(20.0),
// color: Colors.blue),
// child: Center(
// child: Text(
// markers.length.toString(),
// style: TextStyle(color: Colors.white),
// ),
// ),
// );
// },
// ),
// ): Container(height:0,width: 0),
// ],
// )
// ],
// )
// ),
// ),
// ],
// ),
// ),
// );
// }
// }

View File

@ -0,0 +1,163 @@
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
class RegisterPage extends StatelessWidget {
final IndexController indexController = Get.find<IndexController>();
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
TextEditingController confirmPasswordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false,
backgroundColor: Colors.white,
appBar: AppBar(
elevation: 0,
brightness: Brightness.light,
backgroundColor: Colors.white,
leading:
IconButton( onPressed: (){
Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
),
body: SafeArea(
child: SingleChildScrollView(
child: Container(
height: MediaQuery.of(context).size.height,
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text ("サインアップ", style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
),),
SizedBox(height: 20,),
Text("アカウントを作成し、無料です",style: TextStyle(
fontSize: 15,
color: Colors.grey[700],
),),
SizedBox(height: 30,)
],
),
Padding(
padding: EdgeInsets.symmetric(
horizontal: 40
),
child: Column(
children: [
makeInput(label: "Eメール", controller: emailController),
makeInput(label: "パスワード", controller: passwordController,obsureText: true),
makeInput(label: "パスワードを認証する", controller: confirmPasswordController,obsureText: true)
],
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
border: Border(
bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black),
left: BorderSide(color: Colors.black)
)
),
child: MaterialButton(
minWidth: double.infinity,
height:60,
onPressed: (){
if(passwordController.text != confirmPasswordController.text){
Get.snackbar("No match", "Passwords does not match");
}
if(emailController.text.isEmpty || passwordController.text.isEmpty){
Get.snackbar("No values", "Email and password required");
return;
}
indexController.is_loading.value = true;
indexController.register(emailController.text, passwordController.text, context);
},
color: Colors.redAccent,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("サインアップ",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,
),),
),
),
),
SizedBox(height: 20,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(child: Text("すでにアカウントをお持ちですか?")),
TextButton(
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
child: Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18
),),
),
],
)
],
),
],
),
),
),
),
);
}
}
Widget makeInput({label, required TextEditingController controller, obsureText = false}){
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,style:TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: Colors.black87
),),
SizedBox(height: 5,),
TextField(
controller: controller,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: (Colors.grey[400])!,
),
),
border: OutlineInputBorder(
borderSide: BorderSide(color: (Colors.grey[400])!
),
),
),
),
SizedBox(height: 30,)
],
);
}

View File

@ -1,6 +1,11 @@
import 'package:get/get_navigation/src/routes/get_route.dart'; import 'package:get/get_navigation/src/routes/get_route.dart';
import 'package:rogapp/index/index_binding.dart'; import 'package:rogapp/pages/destination/destination_binding.dart';
import 'package:rogapp/index/index_page.dart'; import 'package:rogapp/pages/destination/destination_page.dart';
import 'package:rogapp/pages/index/index_binding.dart';
import 'package:rogapp/pages/index/index_page.dart';
import 'package:rogapp/pages/landing/landing_page.dart';
import 'package:rogapp/pages/login/login_page.dart';
import 'package:rogapp/pages/register/register_page.dart';
import 'package:rogapp/spa/spa_binding.dart'; import 'package:rogapp/spa/spa_binding.dart';
import 'package:rogapp/spa/spa_page.dart'; import 'package:rogapp/spa/spa_page.dart';
@ -12,6 +17,10 @@ class AppPages {
static const INITIAL = Routes.INDEX; static const INITIAL = Routes.INDEX;
// ignore: constant_identifier_names // ignore: constant_identifier_names
static const SPA = Routes.SPA; static const SPA = Routes.SPA;
static const LANDING = Routes.LANDING;
static const LOGIN = Routes.LOGIN;
static const REGISTER = Routes.REGISTER;
static const TRAVEL = Routes.TRAVEL;
static final routes = [ static final routes = [
// GetPage( // GetPage(
@ -33,6 +42,26 @@ class AppPages {
name: Routes.SPA, name: Routes.SPA,
page: () => const SpaPage(), page: () => const SpaPage(),
binding: SpaBinding(), binding: SpaBinding(),
),
GetPage(
name: Routes.LANDING,
page: () => LandingPage(),
//binding: SpaBinding(),
),
GetPage(
name: Routes.LOGIN,
page: () => LoginPage(),
//binding: SpaBinding(),
),
GetPage(
name: Routes.REGISTER,
page: () => RegisterPage(),
//binding: SpaBinding(),
),
GetPage(
name: Routes.TRAVEL,
page: () => DestinationPage(),
binding: DestinationBinding(),
) )
]; ];
} }

View File

@ -8,4 +8,8 @@ abstract class Routes {
static const INDEX = '/'; static const INDEX = '/';
// ignore: constant_identifier_names // ignore: constant_identifier_names
static const SPA = '/spa'; static const SPA = '/spa';
static const LANDING = '/landing';
static const LOGIN = '/login';
static const REGISTER = '/register';
static const TRAVEL = '/travel';
} }

View File

@ -0,0 +1,43 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
class ActionService{
static Future<Map<String, dynamic>> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async {
Map<String, dynamic> cats = {};
String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
}
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
static Future<List<dynamic>?> userAction(int user_id, int location_id) async {
List<dynamic> cats = [];
String url = 'http://localhost:8100/api/useraction/?user_id=${user_id}&location_id=${location_id}';
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
}

View File

@ -0,0 +1,53 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
class AuthService{
static Future<Map<String, dynamic>> login(String email, String password) async {
Map<String, dynamic> cats = {};
String url = 'http://localhost:8100/api/login/';
final http.Response response = await http.post(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(<String, String>{
'email': email,
'password': password
}),
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
static Future<Map<String, dynamic>> register(String email, String password) async {
Map<String, dynamic> cats = {};
String url = 'http://localhost:8100/api/register/';
final http.Response response = await http.post(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(<String, String>{
'email': email,
'password': password
}),
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
}

View File

@ -0,0 +1,28 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
class CatService{
static Future<List<dynamic>?> loadCats() async {
List<dynamic> cats = [];
String url = 'http://localhost:8100/api/cats/';
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
}

View File

@ -0,0 +1,41 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
class DestinationService{
static Future<List<dynamic>> getDestinations(int user_id) async {
List<dynamic> cats = [];
String url = "http://localhost:8100/api/destinations/?user_id=${user_id}";
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
}
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
static Future<int> updateOrder(int action_id, int order, String dir) async {
int cats = 0;
String url = "http://localhost:8100/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
}
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
return cats;
}
}

View File

@ -7,7 +7,7 @@ class LocationLineService{
final geo = GeoJson(); final geo = GeoJson();
GeoJsonFeature? fs; GeoJsonFeature? fs;
String url = 'http://container.intranet.sumasen.net:8100/api/location_line/'; String url = 'http://localhost:8100/api/location_line/';
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -7,7 +7,7 @@ class LocationPolygonervice{
final geo = GeoJson(); final geo = GeoJson();
GeoJsonFeature? fs; GeoJsonFeature? fs;
String url = 'http://container.intranet.sumasen.net:8100/api/location_polygon/'; String url = 'http://localhost:8100/api/location_polygon/';
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -6,7 +6,7 @@ import 'package:http/http.dart' as http;
class LocationService{ class LocationService{
static Future<GeoJsonFeatureCollection?> loadLocations() async { static Future<GeoJsonFeatureCollection?> loadLocations() async {
String url = 'http://container.intranet.sumasen.net:8100/api/location/'; String url = 'http://localhost:8100/api/location/';
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -20,8 +20,15 @@ class LocationService{
return null; return null;
} }
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture) async { static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
String url = 'http://container.intranet.sumasen.net:8100/api/inperf/?perf=' + perfecture; String url = "";
if(cat.isNotEmpty){
url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
}
else{
url = 'http://localhost:8100/api/inperf/?perf=' + perfecture;
}
//String url = 'http://localhost:8100/api/inperf/?perf=' + perfecture + '&cat=' + cat;
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -37,8 +44,14 @@ class LocationService{
} }
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture) async { static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
String url = 'http://container.intranet.sumasen.net:8100/api/insubperf?subperf=' + subperfecture; String url = "";
if(cat.isNotEmpty){
url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
}
else{
url = 'http://localhost:8100/api/insubperf?subperf=' + subperfecture;
}
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -6,7 +6,7 @@ class PerfectureService{
static Future<List<dynamic>?> loadPerfectures() async { static Future<List<dynamic>?> loadPerfectures() async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String url = 'http://container.intranet.sumasen.net:8100/api/perf_main/'; String url = 'http://localhost:8100/api/perf_main/';
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -22,7 +22,7 @@ class PerfectureService{
static Future<List<dynamic>?> loadSubPerfectures(String sub) async { static Future<List<dynamic>?> loadSubPerfectures(String sub) async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String url = 'http://container.intranet.sumasen.net:8100/api/subperfinmain/?perf=' + sub; String url = 'http://localhost:8100/api/subperfinmain/?perf=' + sub;
//String url = 'http://container.intranet.sumasen.net:8100/api/insubperf/?perf=' + sub; //String url = 'http://container.intranet.sumasen.net:8100/api/insubperf/?perf=' + sub;
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
@ -40,7 +40,7 @@ class PerfectureService{
static Future<List<dynamic>?> getMainPerfExt(String id) async { static Future<List<dynamic>?> getMainPerfExt(String id) async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String url = 'http://container.intranet.sumasen.net:8100/api/mainperfext/?perf=' + id; String url = 'http://localhost:8100/api/mainperfext/?perf=' + id;
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',
@ -57,7 +57,7 @@ class PerfectureService{
static Future<List<dynamic>?> getSubExt(String id) async { static Future<List<dynamic>?> getSubExt(String id) async {
List<dynamic> perfs = []; List<dynamic> perfs = [];
String url = 'http://container.intranet.sumasen.net:8100/api/perfext/?sub_perf=' + id; String url = 'http://localhost:8100/api/perfext/?sub_perf=' + id;
final response = await http.get(Uri.parse(url), final response = await http.get(Uri.parse(url),
headers: <String, String>{ headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8', 'Content-Type': 'application/json; charset=UTF-8',

View File

@ -35,6 +35,8 @@ class StringValues extends Translations{
'telephone':'電話', 'telephone':'電話',
'how_nice':'いいね', 'how_nice':'いいね',
'want_to_go': '行きたい', 'want_to_go': '行きたい',
'like': 'お気に入り',
'checkin': 'チェックイン',
'schedule_point': '予定地点', 'schedule_point': '予定地点',
'login': 'ログインする', 'login': 'ログインする',
'change_password': 'パスワード変更', 'change_password': 'パスワード変更',

View File

@ -1,7 +1,10 @@
import 'dart:io';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher.dart';
class BottomSheetWidget extends StatelessWidget { class BottomSheetWidget extends StatelessWidget {
@ -22,20 +25,6 @@ class BottomSheetWidget extends StatelessWidget {
if (!await launch(url)) throw 'Could not launch $url'; if (!await launch(url)) throw 'Could not launch $url';
} }
// Widget getAttrib(String name){
// print("calling ...");
// if(homeController.currentFeature[0].properties!["phone"] == null || homeController.currentFeature[0].properties!["phone"] == ""){
// return Container(height: 0, width: 0,);
// }
// else {
// return Obx(() =>
// Text(homeController.currentFeature[0].properties!["phone"] ?? '',
// style: TextStyle(color: Colors.blue,),
// overflow: TextOverflow.ellipsis,)
// );
// }
// }
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return SingleChildScrollView( return SingleChildScrollView(
@ -213,22 +202,125 @@ class BottomSheetWidget extends StatelessWidget {
], ],
), ),
SizedBox(height: 20.0,), SizedBox(height: 20.0,),
Obx(() =>
indexController.currentAction.isNotEmpty ?
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceAround, mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [ children: [
indexController.currentAction[0][0]["wanttogo"] == false ?
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["wanttogo"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Text("want_to_go".tr)
) :
ElevatedButton( ElevatedButton(
onPressed: (){}, onPressed: (){
child: Text("schedule_point".tr) if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["wanttogo"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: IconButton(
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "want_to_go".tr,), onPressed: () {
},
)
), ),
indexController.currentAction[0][0]["like"] == false ?
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["like"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Text("like".tr)
) :
ElevatedButton( ElevatedButton(
onPressed: (){}, onPressed: (){
child: Text("schedule_point".tr) if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["like"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: IconButton(
icon: Icon(Icons.favorite, color: Colors.red, semanticLabel: "like".tr,), onPressed: () {
},
)
), ),
indexController.currentAction[0][0]["checkin"] == false ?
ElevatedButton(
onPressed: (){
if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["checkin"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Text("checkin".tr)
) :
ElevatedButton( ElevatedButton(
onPressed: (){}, onPressed: (){
child: Text("schedule_point".tr) if(indexController.currentAction.isNotEmpty){
print(indexController.currentAction[0]);
indexController.currentAction[0][0]["checkin"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Icon(
Icons.favorite, color: Colors.red)
,
) )
], ],
): Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
child: Flexible(child: Text("その他のオプションについてはログインしてください")))
],
),
), ),
Row( Row(
children: [ children: [

View File

@ -1,8 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:flutter_breadcrumb/flutter_breadcrumb.dart'; import 'package:flutter_breadcrumb/flutter_breadcrumb.dart';
import 'package:rogapp/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/perfecture_widget.dart'; import 'package:rogapp/widgets/perfecture_widget.dart';
class BreadCrumbWidget extends StatelessWidget { class BreadCrumbWidget extends StatelessWidget {

View File

@ -0,0 +1,49 @@
import 'package:flutter/material.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/location_service.dart';
class CatWidget extends StatefulWidget {
CatWidget({ Key? key, required this.indexController, }) : super(key: key);
IndexController indexController;
@override
State<CatWidget> createState() => _CatWidgetState();
}
class _CatWidgetState extends State<CatWidget> {
String defaultValue = "---";
@override
Widget build(BuildContext context) {
return
PopupMenuButton(
onSelected: (value) {
widget.indexController.currentCat.clear();
widget.indexController.currentCat.add(value.toString());
widget.indexController.refreshLocationForCat();
setState(() {
print(value);
defaultValue = value.toString();
});
},
itemBuilder: (BuildContext context){
List<PopupMenuItem> itms = <PopupMenuItem>[];
for(dynamic d in widget.indexController.cats[0]){
PopupMenuItem itm = PopupMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
itms.add(itm);
}
return itms;
}
);
}
}
// widget.indexController.cats.map((e) =>
// PopupMenuItem(
// value: defaultValue,
// child: Text(e[0]['category'].toString()),
// )
// ).toList(),

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart'; import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart'; import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class ListWidget extends StatelessWidget { class ListWidget extends StatelessWidget {

View File

@ -6,7 +6,7 @@ import 'package:geojson/geojson.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart'; import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:latlong2/latlong.dart'; import 'package:latlong2/latlong.dart';
import 'package:rogapp/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/base_layer_widget.dart'; import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart'; import 'package:rogapp/widgets/bottom_sheet_widget.dart';
@ -57,6 +57,7 @@ class MapWidget extends StatelessWidget {
indexController.currentFeature.clear(); indexController.currentFeature.clear();
} }
indexController.currentFeature.add(fs); indexController.currentFeature.add(fs);
indexController.getAction();
showModalBottomSheet(context: context, isScrollControlled: true, showModalBottomSheet(context: context, isScrollControlled: true,
builder:((context) => BottomSheetWidget()) builder:((context) => BottomSheetWidget())

View File

@ -1,7 +1,7 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart'; import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:rogapp/index/index_controller.dart'; import 'package:rogapp/pages/index/index_controller.dart';
class PerfectureWidget extends StatefulWidget { class PerfectureWidget extends StatefulWidget {
@ -18,7 +18,7 @@ class PerfectureWidget extends StatefulWidget {
} }
class _PerfectureWidgetState extends State<PerfectureWidget> { class _PerfectureWidgetState extends State<PerfectureWidget> {
String dropdownValue = "9";
List<DropdownMenuItem<String>> getDropdownItems() { List<DropdownMenuItem<String>> getDropdownItems() {
List<DropdownMenuItem<String>> dropDownItems = []; List<DropdownMenuItem<String>> dropDownItems = [];
@ -58,7 +58,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
Row( Row(
children: [ children: [
DropdownButton<String>( DropdownButton<String>(
value: dropdownValue, value: widget.indexController.dropdownValue,
icon: const Icon(Icons.arrow_downward), icon: const Icon(Icons.arrow_downward),
elevation: 16, elevation: 16,
style: const TextStyle(color: Colors.deepPurple), style: const TextStyle(color: Colors.deepPurple),
@ -69,7 +69,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
onChanged: (String? newValue) { onChanged: (String? newValue) {
//setState(() { //setState(() {
if(newValue != null){ if(newValue != null){
dropdownValue = newValue; widget.indexController.dropdownValue = newValue;
widget.indexController.populateForPerf(newValue, widget.mapController); widget.indexController.populateForPerf(newValue, widget.mapController);
} }
//}); //});

View File

@ -574,6 +574,13 @@ packages:
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "0.4.8" version: "0.4.8"
timeline_tile:
dependency: "direct main"
description:
name: timeline_tile
url: "https://pub.dartlang.org"
source: hosted
version: "2.0.0"
transparent_image: transparent_image:
dependency: "direct main" dependency: "direct main"
description: description:

View File

@ -60,6 +60,7 @@ dependencies:
geojson: ^1.0.0 geojson: ^1.0.0
url_launcher: ^6.0.20 url_launcher: ^6.0.20
flutter_breadcrumb: ^1.0.1 flutter_breadcrumb: ^1.0.1
timeline_tile: ^2.0.0
dev_dependencies: dev_dependencies:
@ -87,6 +88,7 @@ flutter:
# To add assets to your application, add an assets section, like this: # To add assets to your application, add an assets section, like this:
assets: assets:
- assets/images/empty_image.png - assets/images/empty_image.png
- assets/gradient_japanese_temple.jpg
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see