update
This commit is contained in:
10
lib/pages/destination/destination_binding.dart
Normal file
10
lib/pages/destination/destination_binding.dart
Normal 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());
|
||||
}
|
||||
}
|
||||
46
lib/pages/destination/destination_controller.dart
Normal file
46
lib/pages/destination/destination_controller.dart
Normal 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();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
124
lib/pages/destination/destination_page.dart
Normal file
124
lib/pages/destination/destination_page.dart
Normal 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"),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/routes/app_pages.dart';
|
||||
|
||||
class DrawerPage extends StatelessWidget {
|
||||
const DrawerPage({ Key? key }) : super(key: key);
|
||||
@ -22,7 +23,9 @@ class DrawerPage extends StatelessWidget {
|
||||
ListTile(
|
||||
leading: const Icon(Icons.login),
|
||||
title: Text("login".tr),
|
||||
onTap: (){},
|
||||
onTap: (){
|
||||
Get.toNamed(AppPages.LANDING);
|
||||
},
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password),
|
||||
|
||||
@ -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());
|
||||
// }
|
||||
// }
|
||||
@ -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);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// }
|
||||
|
||||
|
||||
|
||||
// }
|
||||
@ -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,),
|
||||
// )
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
11
lib/pages/index/index_binding.dart
Normal file
11
lib/pages/index/index_binding.dart
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
import 'package:flutter_map/plugin_api.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:rogapp/pages/index/index_controller.dart';
|
||||
|
||||
class IndexBinding extends Bindings {
|
||||
@override
|
||||
void dependencies() {
|
||||
Get.put<IndexController>(IndexController());
|
||||
}
|
||||
}
|
||||
302
lib/pages/index/index_controller.dart
Normal file
302
lib/pages/index/index_controller.dart
Normal file
@ -0,0 +1,302 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_map/flutter_map.dart';
|
||||
import 'package:geojson/geojson.dart';
|
||||
import 'package:get/get.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/perfecture_service.dart';
|
||||
|
||||
class IndexController 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;
|
||||
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;
|
||||
|
||||
var mode = 0.obs;
|
||||
|
||||
|
||||
String dropdownValue = "9";
|
||||
String subDropdownValue = "-1";
|
||||
|
||||
void toggleMode(){
|
||||
if(mode==0){
|
||||
mode += 1;
|
||||
}
|
||||
else{
|
||||
mode -= 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");
|
||||
});
|
||||
}
|
||||
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){
|
||||
subPerfs.clear();
|
||||
dynamic initVal = {'id':'-1', 'adm2_ja':'----'};
|
||||
PerfectureService.loadSubPerfectures(perf).then((value){
|
||||
value!.add(initVal);
|
||||
subPerfs.add(value);
|
||||
subDropdownValue = getSubInitialVal();
|
||||
});
|
||||
}
|
||||
|
||||
String getSubInitialVal(){
|
||||
int min = 0;
|
||||
if(subPerfs.length > 0){
|
||||
min = int.parse(subPerfs[0][0]['id'].toString());
|
||||
for(var sub in subPerfs[0]){
|
||||
int x = int.parse(sub['id'].toString()); // as int;
|
||||
if(x < min){
|
||||
min = x;
|
||||
}
|
||||
}
|
||||
}
|
||||
return min.toString();
|
||||
}
|
||||
|
||||
void loadLocationforPerf(String perf, MapController mapController) async {
|
||||
locations.clear();
|
||||
LocationService.loadLocationsFor(perf, currentCat[0]).then((value){
|
||||
locations.add(value!);
|
||||
mapController.fitBounds(currentBound[0]);
|
||||
});
|
||||
}
|
||||
|
||||
void loadLocationforSubPerf(String subperf, MapController mapController) async {
|
||||
locations.clear();
|
||||
LocationService.loadLocationsSubFor(subperf, currentCat[0]).then((value){
|
||||
locations.add(value!);
|
||||
});
|
||||
}
|
||||
|
||||
void setBound(LatLngBounds bounds){
|
||||
currentBound.clear();
|
||||
currentBound.add(bounds);
|
||||
}
|
||||
|
||||
void zoomtoMainPerf(String id){
|
||||
|
||||
PerfectureService.getMainPerfExt(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);
|
||||
setBound(bound);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void zoomtoSubPerf(String id){
|
||||
|
||||
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);
|
||||
setBound(bound);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
void populateForPerf(String perf, MapController mapController){
|
||||
loadSubPerfFor(perf);
|
||||
loadLocationforPerf(perf, mapController);
|
||||
zoomtoMainPerf(perf);
|
||||
}
|
||||
|
||||
void populateForSubPerf(String subperf, MapController mapController){
|
||||
subDropdownValue = subperf;
|
||||
loadLocationforSubPerf(subperf, mapController);
|
||||
zoomtoSubPerf(subperf);
|
||||
}
|
||||
|
||||
|
||||
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 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){
|
||||
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);
|
||||
getAction();
|
||||
}
|
||||
else{
|
||||
currentFeature.add(locations[0].collection[i + 1] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
getAction();
|
||||
}
|
||||
else{
|
||||
currentFeature.add(locations[0].collection[i - 1] as GeoJsonFeature);
|
||||
getAction();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
95
lib/pages/index/index_page.dart
Normal file
95
lib/pages/index/index_page.dart
Normal file
@ -0,0 +1,95 @@
|
||||
import 'dart:ui';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.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/cat_widget.dart';
|
||||
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>();
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
drawer: const DrawerPage(),
|
||||
appBar: AppBar(
|
||||
title: Text("app_title".tr),
|
||||
actions: [
|
||||
ElevatedButton(onPressed: (){}, child: CatWidget(indexController: indexController,)),
|
||||
//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: (){
|
||||
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,
|
||||
body: SafeArea(
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
alignment: Alignment.centerLeft,
|
||||
height: 50.0,
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
BreadCrumbWidget(),
|
||||
Container(width: 24.0,),
|
||||
Obx(()=>
|
||||
indexController.currentCat.isNotEmpty ? Text(indexController.currentCat[0].toString()): Text("")
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Obx(() =>
|
||||
indexController.mode == 0 ?
|
||||
MapWidget() :
|
||||
ListWidget(),
|
||||
)
|
||||
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
91
lib/pages/landing/landing_page.dart
Normal file
91
lib/pages/landing/landing_page.dart
Normal 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,
|
||||
|
||||
),),
|
||||
),
|
||||
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
170
lib/pages/login/login_page.dart
Normal file
170
lib/pages/login/login_page.dart
Normal 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,)
|
||||
],
|
||||
);
|
||||
}
|
||||
@ -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());
|
||||
// }
|
||||
// }
|
||||
@ -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),
|
||||
// ],
|
||||
// )
|
||||
// ],
|
||||
// )
|
||||
// ),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
// ),
|
||||
// );
|
||||
// }
|
||||
// }
|
||||
|
||||
163
lib/pages/register/register_page.dart
Normal file
163
lib/pages/register/register_page.dart
Normal 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,)
|
||||
|
||||
],
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user