update to 3.13

This commit is contained in:
Mohamed Nouffer
2023-09-03 23:37:41 +05:30
parent c41dde4c33
commit 56e9861c7a
60 changed files with 3111 additions and 2705 deletions

View File

@ -1,22 +1,20 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:get/get.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:rogapp/pages/index/index_binding.dart';
import 'package:rogapp/routes/app_pages.dart';
import 'package:rogapp/utils/string_values.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:path/path.dart' as p;
String? userToken;
void main() async {
WidgetsFlutterBinding.ensureInitialized();
FlutterMapTileCaching.initialise(await RootDirectory.normalCache);
await FlutterMapTileCaching.initialise();
final StoreDirectory instanceA = FMTC.instance('OpenStreetMap (A)');
await instanceA.manage.createAsync();
await instanceA.metadata.addAsync(
@ -32,9 +30,10 @@ void main() async {
value: 'cacheFirst',
);
runApp(MyApp());
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
// This widget is the root of your application.
@ -47,16 +46,16 @@ class MyApp extends StatelessWidget {
fallbackLocale: const Locale('en', 'US'),
title: 'ROGAINING',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
textTheme: GoogleFonts.muliTextTheme(),
colorScheme: ColorScheme.fromSeed(
seedColor: const Color.fromARGB(255, 4, 88, 161)),
useMaterial3: true,
),
debugShowCheckedModeBanner: false,
defaultTransition: Transition.cupertino,
opaqueRoute: Get.isOpaqueRouteDefault,
popGesture: Get.isPopGestureEnable,
transitionDuration: const Duration(milliseconds: 230),
initialBinding: IndexBinding(), //HomeBinding(),
initialBinding: IndexBinding(userToken), //HomeBinding(),
initialRoute: AppPages.PERMISSION,
getPages: AppPages.routes,
enableLog: true,

View File

@ -21,7 +21,7 @@ class CameraPage extends StatelessWidget {
return FileImage(destinationController.photos[0]);
}
else{
return AssetImage('assets/images/empty_image.png');
return const AssetImage('assets/images/empty_image.png');
}
}
@ -40,21 +40,21 @@ class CameraPage extends StatelessWidget {
destinationController.photos.isNotEmpty ?
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.red
backgroundColor: Colors.red
),
onPressed: (){
int user_id = indexController.currentUser[0]["user"]["id"];
int userId = indexController.currentUser[0]["user"]["id"];
//print("--- Pressed -----");
String _team = indexController.currentUser[0]["user"]['team_name'];
String team = indexController.currentUser[0]["user"]['team_name'];
//print("--- _team : ${_team}-----");
String _event_code = indexController.currentUser[0]["user"]["event_code"];
String eventCode = indexController.currentUser[0]["user"]["event_code"];
//print("--- _event_code : ${_event_code}-----");
String _token = indexController.currentUser[0]["token"];
String token = indexController.currentUser[0]["token"];
//print("--- _token : ${_token}-----");
DateTime now = DateTime.now();
String formattedDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(now);
ExternalService().makeGoal(user_id, _token, _team, destinationController.photos[0].path, formattedDate, _event_code).then((value){
ExternalService().makeGoal(userId, token, team, destinationController.photos[0].path, formattedDate, eventCode).then((value){
print("---called ext api ${value['status']} ------");
if(value['status'] == 'OK'){
Get.back();
@ -84,14 +84,14 @@ class CameraPage extends StatelessWidget {
onPressed: (){
destinationController.openCamera(context);
},
child: destinationController.photos.length > 0 ? Text("再撮影") : Text("撮影")
child: destinationController.photos.isNotEmpty ? const Text("再撮影") : const Text("撮影")
)
),
Obx(() =>
destinationController.photos.isNotEmpty ?
ElevatedButton(
style: ElevatedButton.styleFrom(
primary: Colors.red
backgroundColor: Colors.red
),
onPressed: (){
print("##### current destination ${indexController.currentDestinationFeature[0].sub_loc_id} #######");
@ -115,7 +115,7 @@ class CameraPage extends StatelessWidget {
// }
// });
},
child: Text("チェックイン")
child: const Text("チェックイン")
):
Container()
)
@ -145,7 +145,7 @@ class CameraPage extends StatelessWidget {
onPressed: (){
Navigator.of(context).pop();
destinationController.skip_10s = true;
timer = Timer.periodic(Duration(seconds: 10), (Timer t){
timer = Timer.periodic(const Duration(seconds: 10), (Timer t){
destinationController.skip_10s = false;
});
},
@ -154,13 +154,13 @@ class CameraPage extends StatelessWidget {
)
:
AppBar(
title: Text("チェックポイント"),
title: const Text("チェックポイント"),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.spaceAround,
children: [
Padding(
padding: EdgeInsets.all(8.0),
padding: const EdgeInsets.all(8.0),
child: Center(
child: Obx(() =>
Container(
@ -205,14 +205,14 @@ class StartRogaining extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("You have not started rogaining yet.".tr, style: TextStyle(fontSize: 24)),
SizedBox(height: 40.0,),
Text("You have not started rogaining yet.".tr, style: const TextStyle(fontSize: 24)),
const SizedBox(height: 40.0,),
ElevatedButton(
onPressed: (){
Get.back();
destinationController.skip_gps = false;
},
child: Text("Back"),
child: const Text("Back"),
),
],
),
@ -238,14 +238,14 @@ class NotAtGoal extends StatelessWidget {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("You have not reached the goal yet.".tr, style: TextStyle(fontSize: 24)),
SizedBox(height: 40.0,),
Text("You have not reached the goal yet.".tr, style: const TextStyle(fontSize: 24)),
const SizedBox(height: 40.0,),
ElevatedButton(
onPressed: (){
Get.back();
destinationController.skip_gps = false;
},
child: Text("Back"),
child: const Text("Back"),
),
],
),

View File

@ -1,7 +1,6 @@
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 ChangePasswordPage extends StatelessWidget {
ChangePasswordPage({Key? key}) : super(key: key);
@ -23,10 +22,10 @@ class ChangePasswordPage extends StatelessWidget {
leading:
IconButton( onPressed: (){
Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
),
body:
Container(
SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
@ -37,13 +36,13 @@ class ChangePasswordPage extends StatelessWidget {
Column(
children: [
Container(
child: Text("change_password".tr, style: TextStyle(fontSize: 24.0),),
child: Text("change_password".tr, style: const TextStyle(fontSize: 24.0),),
),
SizedBox(height: 30,),
const SizedBox(height: 30,),
],
),
Padding(
padding: EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric(
horizontal: 40
),
child: Column(
@ -54,9 +53,9 @@ class ChangePasswordPage extends StatelessWidget {
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3,left: 3),
padding: const EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
),
@ -71,7 +70,7 @@ class ChangePasswordPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: CircularProgressIndicator(),
child: const CircularProgressIndicator(),
) :
Column(
children: [
@ -83,9 +82,9 @@ class ChangePasswordPage extends StatelessWidget {
Get.snackbar(
"no_values".tr,
"values_required".tr,
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
@ -99,12 +98,12 @@ class ChangePasswordPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("ログイン",style: TextStyle(
child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
),
SizedBox(height: 10.0,),
const SizedBox(height: 10.0,),
],
)
@ -112,8 +111,8 @@ class ChangePasswordPage extends StatelessWidget {
),
)
),
SizedBox(height: 20,),
Row(
const SizedBox(height: 20,),
const Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
@ -132,17 +131,17 @@ class ChangePasswordPage extends StatelessWidget {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,style:TextStyle(
Text(label,style:const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: Colors.black87
),),
SizedBox(height: 5,),
const SizedBox(height: 5,),
TextField(
controller: controller,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: (Colors.grey[400])!,
@ -154,7 +153,7 @@ class ChangePasswordPage extends StatelessWidget {
),
),
),
SizedBox(height: 30.0,)
const SizedBox(height: 30.0,)
],
);
}

View File

@ -1,6 +1,5 @@
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

File diff suppressed because it is too large Load Diff

View File

@ -1,20 +1,14 @@
import 'dart:developer';
import 'dart:io';
import 'package:camera_camera/camera_camera.dart';
import 'package:flutter/material.dart';
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:latlong2/latlong.dart';
import 'package:rogapp/pages/camera/camera_page.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/destination_map/destination_map_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/services/external_service.dart';
import 'package:rogapp/widgets/destination_widget.dart';
import 'package:timeline_tile/timeline_tile.dart';
class DestnationPage extends StatelessWidget {
DestnationPage({Key? key}) : super(key: key);
@ -33,12 +27,12 @@ class DestnationPage extends StatelessWidget {
}
Position position = await Geolocator.getCurrentPosition(
desiredAccuracy: LocationAccuracy.high);
indexController.rogMapController?.move(LatLng(position.latitude, position.longitude), 14);
indexController.rogMapController.move(LatLng(position.latitude, position.longitude), 14);
}
Image getImage(int index){
if(destinationController.destinations[index].photos == null || destinationController.destinations[index].photos == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
return Image(image: NetworkImage(destinationController.destinations[index].photos!));
@ -48,13 +42,13 @@ class DestnationPage extends StatelessWidget {
Widget getRoutingImage(int route){
switch (route) {
case 0:
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
return const Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
case 1:
return Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,);
return const Image(image: AssetImage('assets/images/p4_8_car.png'), width: 35.0,);
case 2:
return Image(image: AssetImage('assets/images/p4_10_train.png'), width: 35.0,);
return const Image(image: AssetImage('assets/images/p4_10_train.png'), width: 35.0,);
default:
return Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
return const Image(image: AssetImage('assets/images/p4_9_man.png'), width: 35.0,);
}
}
@ -69,6 +63,7 @@ class DestnationPage extends StatelessWidget {
return false;
},
child: Scaffold(
drawer: DrawerPage(),
bottomNavigationBar: BottomAppBar(
child: Row(
@ -85,12 +80,12 @@ class DestnationPage extends StatelessWidget {
children: [
Padding(
padding: const EdgeInsets.only(top:30.0, bottom: 30),
child: Center(child: Text("select_travel_mode".tr, style: TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
child: Center(child: Text("select_travel_mode".tr, style: const TextStyle(fontSize: 22.0, color:Colors.red, fontWeight:FontWeight.bold),),),
),
ListTile(
selected: destinationController.travelMode == 0 ? true : false,
selectedTileColor: Colors.amber.shade200,
leading: Image(image: AssetImage('assets/images/p4_9_man.png'),),
leading: const Image(image: AssetImage('assets/images/p4_9_man.png'),),
title: Text("walking".tr),
onTap:(){
destinationController.travelMode.value = 0;
@ -101,7 +96,7 @@ class DestnationPage extends StatelessWidget {
ListTile(
selected: destinationController.travelMode == 1 ? true : false,
selectedTileColor: Colors.amber.shade200,
leading: Image(image: AssetImage('assets/images/p4_8_car.png'),),
leading: const Image(image: AssetImage('assets/images/p4_8_car.png'),),
title: Text("driving".tr),
onTap:(){
destinationController.travelMode.value = 1;
@ -147,13 +142,13 @@ class DestnationPage extends StatelessWidget {
indexController.toggleDestinationMode();
},
tooltip: 'Increment',
elevation: 4.0,
child: Obx(() =>
indexController.desination_mode == 1 ?
Image(image: AssetImage('assets/images/list2.png'))
const Image(image: AssetImage('assets/images/list2.png'))
:
Image(image: AssetImage('assets/images/map.png'))
const Image(image: AssetImage('assets/images/map.png'))
),
elevation: 4.0,
),
floatingActionButtonLocation: FloatingActionButtonLocation.centerDocked,
appBar:AppBar(
@ -170,12 +165,12 @@ class DestnationPage extends StatelessWidget {
destinationController.is_at_goal == true ?
IconButton(
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
icon: Icon(Icons.assistant_photo),
icon: const Icon(Icons.assistant_photo),
)
:
IconButton(
onPressed:(){Get.toNamed(AppPages.CAMERA_PAGE);},
icon: Icon(Icons.accessibility),
icon: const Icon(Icons.accessibility),
),
),
// Obx(() =>
@ -185,9 +180,6 @@ class DestnationPage extends StatelessWidget {
ToggleButtons(
disabledColor: Colors.grey.shade200,
selectedColor: Colors.red,
children: <Widget>[
Icon(Icons.explore, size: 35.0,
)],
onPressed: (int index) {
destinationController.is_gps_selected.value = !destinationController.is_gps_selected.value;
if(destinationController.is_gps_selected.value){
@ -197,6 +189,9 @@ class DestnationPage extends StatelessWidget {
}
},
isSelected: [destinationController.is_gps_selected.value],
children: const <Widget>[
Icon(Icons.explore, size: 35.0,
)],
),
),
// IconButton(onPressed: (){

View File

@ -5,21 +5,15 @@ import 'package:flutter/material.dart';
import 'package:flutter_map/plugin_api.dart';
import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
import 'package:flutter_map_marker_popup/flutter_map_marker_popup.dart';
import 'package:flutter_map_tile_caching/flutter_map_tile_caching.dart';
import 'package:flutter_polyline_points/flutter_polyline_points.dart';
import 'package:geojson/geojson.dart';
import 'package:geolocator/geolocator.dart';
import 'package:get/get.dart';
import 'package:latlong2/latlong.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/services/destination_service.dart';
import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
import 'package:rogapp/widgets/bread_crum_widget.dart';
class DestinationMapPage extends StatelessWidget {
@ -46,7 +40,7 @@ class DestinationMapPage extends StatelessWidget {
int index = -1;
for (int i = 0; i < destinationController.destinations.length; i++) {
Destination d = destinationController.destinations[i];
print("^^^^ ${d} ^^^^");
print("^^^^ $d ^^^^");
Marker m = Marker(
point: LatLng(d.lat!, d.lon!),
anchorPos: AnchorPos.align(AnchorAlign.center),
@ -55,21 +49,19 @@ class DestinationMapPage extends StatelessWidget {
return InkWell(
onTap: (){
print("-- Destination is --- ${d.name} ------");
if(d != null){
if(indexController.currentDestinationFeature.length > 0) {
indexController.currentDestinationFeature.clear();
}
indexController.currentDestinationFeature.add(d);
//indexController.getAction();
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
print("---- set skip gps to false -----");
destinationController.skip_gps = false;
});
if(indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear();
}
},
indexController.currentDestinationFeature.add(d);
//indexController.getAction();
showModalBottomSheet(context: Get.context!, isScrollControlled: true,
builder:((context) => BottomSheetNew())
).whenComplete((){
print("---- set skip gps to false -----");
destinationController.skip_gps = false;
});
},
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -79,19 +71,19 @@ class DestinationMapPage extends StatelessWidget {
decoration: BoxDecoration(
color: Colors.red,
shape: BoxShape.circle,
border: new Border.all(
border: Border.all(
color: Colors.white,
width: d.checkin_radious != null ? d.checkin_radious! : 1,
),
),
child: new Center(
child: new Text(
child: Center(
child: Text(
(i + 1).toString(),
style: TextStyle(color: Colors.white),
style: const TextStyle(color: Colors.white),
),
),
),
Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
Container( color: Colors.yellow, child: Text(TextUtils.getDisplayText(d), style: const TextStyle(fontSize: 15.0, fontWeight: FontWeight.bold, overflow: TextOverflow.visible),)),
],
),
);
@ -132,28 +124,28 @@ class DestinationMapPage extends StatelessWidget {
options: MapOptions(
onMapReady: (){
indexController.is_rog_mapcontroller_loaded.value = true;
subscription = indexController.rogMapController!.mapEventStream.listen((MapEvent mapEvent) {
subscription = indexController.rogMapController.mapEventStream.listen((MapEvent mapEvent) {
if (mapEvent is MapEventMoveStart) {
}
if (mapEvent is MapEventMoveEnd) {
//destinationController.is_gps_selected.value = true;
//indexController.mapController!.move(c.center, c.zoom);
LatLngBounds bounds = indexController.rogMapController!.bounds!;
LatLngBounds bounds = indexController.rogMapController.bounds!;
indexController.currentBound.clear();
indexController.currentBound.add(bounds);
if(indexController.currentUser.length <= 0){
if(indexController.currentUser.isEmpty){
indexController.loadLocationsBound();
}
}
});
} ,
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
zoom: 1,
maxZoom: 42,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
),
children: [
BaseLayer(),
const BaseLayer(),
Obx(() =>
indexController.routePointLenght > 0 ?
PolylineLayer(

View File

@ -1,7 +1,6 @@
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:rogapp/services/auth_service.dart';
@ -33,16 +32,16 @@ class DrawerPage extends StatelessWidget {
child: Padding(
padding: const EdgeInsets.all(8.0),
child:
indexController.currentUser.length == 0 ?
Flexible(child: Text("drawer_title".tr, style: TextStyle(color: Colors.black, fontSize: 20),))
indexController.currentUser.isEmpty ?
Flexible(child: Text("drawer_title".tr, style: const TextStyle(color: Colors.black, fontSize: 20),))
:
Text(indexController.currentUser[0]['user']['email'], style: TextStyle(color: Colors.black, fontSize: 20),),
Text(indexController.currentUser[0]['user']['email'], style: const TextStyle(color: Colors.black, fontSize: 20),),
),
)
),
),
Obx(() =>
indexController.currentUser.length == 0 ?
indexController.currentUser.isEmpty ?
ListTile(
leading: const Icon(Icons.login),
title: Text("login".tr),
@ -59,7 +58,7 @@ class DrawerPage extends StatelessWidget {
},
)
),
indexController.currentUser.length > 0 ?
indexController.currentUser.isNotEmpty ?
ListTile(
leading: const Icon(Icons.password),
title: Text("change_password".tr),
@ -67,8 +66,8 @@ class DrawerPage extends StatelessWidget {
Get.toNamed(AppPages.CHANGE_PASSWORD);
},
) :
Container(width: 0, height: 0,),
indexController.currentUser.length == 0 ?
const SizedBox(width: 0, height: 0,),
indexController.currentUser.isEmpty ?
ListTile(
leading: const Icon(Icons.person),
title: Text("sign_up".tr),
@ -76,14 +75,14 @@ class DrawerPage extends StatelessWidget {
Get.toNamed(AppPages.REGISTER);
},
) :
Container(width: 0, height: 0,),
indexController.currentUser.length > 0 ?
const SizedBox(width: 0, height: 0,),
indexController.currentUser.isNotEmpty ?
ListTile(
leading: const Icon(Icons.delete_forever),
title: Text("delete_account".tr),
onTap: (){
String _token = indexController.currentUser[0]['token'];
AuthService.deleteUser(_token).then((value){
String token = indexController.currentUser[0]['token'];
AuthService.deleteUser(token).then((value){
if(value.isNotEmpty){
indexController.logout();
Get.toNamed(AppPages.TRAVEL);
@ -92,7 +91,7 @@ class DrawerPage extends StatelessWidget {
});
},
) :
Container(width: 0, height: 0,),
const SizedBox(width: 0, height: 0,),
// ListTile(
// leading: const Icon(Icons.person),
// title: Text("profile".tr),
@ -108,7 +107,7 @@ class DrawerPage extends StatelessWidget {
// title: Text("point_rank".tr),
// onTap: (){},
// ),
indexController.currentUser.length > 0 ?
indexController.currentUser.isNotEmpty ?
ListTile(
leading: const Icon(Icons.featured_video),
title: Text("rog_web".tr),
@ -116,7 +115,7 @@ class DrawerPage extends StatelessWidget {
_launchURL("https://www.gifuai.net/?page_id=17397");
},
) :
Container(width: 0, height: 0,),
const SizedBox(width: 0, height: 0,),
ListTile(
leading: const Icon(Icons.privacy_tip),
title: Text("privacy".tr),

View File

@ -0,0 +1,65 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/utils/database_helper.dart';
class HistoryPage extends StatefulWidget {
const HistoryPage({super.key});
@override
State<HistoryPage> createState() => _HistoryPageState();
}
class _HistoryPageState extends State<HistoryPage> {
DatabaseHelper db = DatabaseHelper.instance;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("History"),
),
body: SingleChildScrollView(
child: Column(
children: [
FutureBuilder(
future: db.getDestinations(),
builder: (BuildContext context,
AsyncSnapshot<List<Destination>> snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
if (snapshot.hasError) {
return Center(
child: Text(
'${snapshot.error} occurred',
style: TextStyle(fontSize: 18),
),
);
} else if (snapshot.hasData) {
final dests = snapshot.data;
if (dests!.length > 0) {
return Center(
child: ListView.builder(itemBuilder:(ctx, index){
return ListTile(
title: Text(dests[index].name?? ""),
subtitle: Text(dests[index].address ?? ""),
leading: dests[0].photos != null ? Image.file(File(dests[0].photos!)) : Container(),
);
}),
);
} else {
return Center(child: Text("No checkin yet"));
}
}
}
else if(snapshot.connectionState == ConnectionState.waiting){
return Center(child: CircularProgressIndicator(),);
}
return Container();
}),
],
),
),
);
}
}

View File

@ -3,6 +3,8 @@ import 'package:get/get.dart';
import 'package:rogapp/pages/search/search_page.dart';
class HomePage extends GetView{
const HomePage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(

View File

@ -1,12 +1,17 @@
import 'package:flutter_map/plugin_api.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
class IndexBinding extends Bindings {
IndexBinding(this.token);
String? token;
@override
void dependencies() {
Get.put<IndexController>(IndexController());
final IndexController indexController = IndexController();
indexController.userToken = token;
Get.put<IndexController>(indexController);
}
}

File diff suppressed because it is too large Load Diff

View File

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

View File

@ -17,18 +17,18 @@ class _LandingPageState extends State<LandingPage> {
child: Container(
width: double.infinity,
height: MediaQuery.of(context).size.height,
padding: EdgeInsets.symmetric(horizontal: 30,vertical: 30),
padding: const EdgeInsets.symmetric(horizontal: 30,vertical: 30),
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
const Text(
"こんにちは!",
style: TextStyle(fontWeight: FontWeight.bold, fontSize: 40),
),
SizedBox(height: 30,),
const SizedBox(height: 30,),
Text("ログインを有効にして本人確認を行うと、サーバーが改善されます",
textAlign: TextAlign.center,
style: TextStyle(
@ -38,11 +38,11 @@ class _LandingPageState extends State<LandingPage> {
),
Container(
height: MediaQuery.of(context).size.height/3,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image:DecorationImage(image: AssetImage('assets/images/gradient_japanese_temple.jpg'))
),
),
SizedBox(height: 20.0,),
const SizedBox(height: 20.0,),
MaterialButton(
minWidth: double.infinity,
height:60,
@ -51,18 +51,18 @@ class _LandingPageState extends State<LandingPage> {
},
color: Colors.indigoAccent[400],
shape: RoundedRectangleBorder(
side: BorderSide(
side: const BorderSide(
color: Colors.black,
),
borderRadius: BorderRadius.circular(40)
),
child: Text("ログイン",style: TextStyle(
child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
),
SizedBox(height: 15.0,),
const SizedBox(height: 15.0,),
MaterialButton(
minWidth: double.infinity,
@ -74,7 +74,7 @@ class _LandingPageState extends State<LandingPage> {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("サインアップ",style: TextStyle(
child: const Text("サインアップ",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,
),),

View File

@ -7,8 +7,8 @@ class LoadingPage extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
alignment: Alignment.topCenter,
margin: EdgeInsets.only(top: 20),
child: CircularProgressIndicator(
margin: const EdgeInsets.only(top: 20),
child: const CircularProgressIndicator(
value: 0.8,
)
);

View File

@ -11,6 +11,8 @@ class LoginPage extends StatelessWidget {
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
LoginPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
@ -22,11 +24,11 @@ class LoginPage extends StatelessWidget {
leading:
IconButton( onPressed: (){
Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
),
body:
indexController.currentUser.length == 0 ?
Container(
indexController.currentUser.isEmpty ?
SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -37,16 +39,16 @@ class LoginPage extends StatelessWidget {
children: [
Container(
height: MediaQuery.of(context).size.height/6,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
),
),
SizedBox(height: 5,),
const SizedBox(height: 5,),
],
),
Padding(
padding: EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric(
horizontal: 40
),
child: Column(
@ -57,9 +59,9 @@ class LoginPage extends StatelessWidget {
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3,left: 3),
padding: const EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
),
@ -74,7 +76,7 @@ class LoginPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: CircularProgressIndicator(),
child: const CircularProgressIndicator(),
) :
Column(
children: [
@ -86,9 +88,9 @@ class LoginPage extends StatelessWidget {
Get.snackbar(
"no_values".tr,
"email_and_password_required".tr,
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
@ -101,12 +103,12 @@ class LoginPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("ログイン",style: TextStyle(
child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
),
SizedBox(height: 5.0,),
const SizedBox(height: 5.0,),
MaterialButton(
minWidth: double.infinity,
height:40,
@ -117,12 +119,12 @@ class LoginPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("sign_up".tr,style: TextStyle(
child: Text("sign_up".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
),
SizedBox(height: 2.0,),
const SizedBox(height: 2.0,),
MaterialButton(
minWidth: double.infinity,
height:40,
@ -133,7 +135,7 @@ class LoginPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("cancel".tr,style: TextStyle(
child: Text("cancel".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
@ -144,14 +146,14 @@ class LoginPage extends StatelessWidget {
),
)
),
SizedBox(height: 5,),
const SizedBox(height: 5,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle(
child: Text("rogaining_user_need_tosign_up".tr, style: const TextStyle(
overflow: TextOverflow.ellipsis,
),),
),
@ -164,7 +166,7 @@ class LoginPage extends StatelessWidget {
Flexible(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text("app_developed_by_gifu_dx".tr, style: TextStyle(
child: Text("app_developed_by_gifu_dx".tr, style: const TextStyle(
overflow: TextOverflow.ellipsis, fontSize: 10.0
),),
),
@ -182,7 +184,7 @@ class LoginPage extends StatelessWidget {
onPressed: (){
indexController.currentUser.clear();
},
child: Text("Already Logged in, Click to logout"),
child: const Text("Already Logged in, Click to logout"),
),
)
,
@ -194,17 +196,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,style:TextStyle(
Text(label,style:const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: Colors.black87
),),
SizedBox(height: 5,),
const SizedBox(height: 5,),
TextField(
controller: controller,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: (Colors.grey[400])!,
@ -216,7 +218,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
),
),
),
SizedBox(height: 30.0,)
const SizedBox(height: 30.0,)
],
);
}

View File

@ -22,11 +22,11 @@ class LoginPopupPage extends StatelessWidget {
leading:
IconButton( onPressed: (){
Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
),
body:
indexController.currentUser.length == 0 ?
Container(
indexController.currentUser.isEmpty ?
SizedBox(
width: double.infinity,
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
@ -37,16 +37,16 @@ class LoginPopupPage extends StatelessWidget {
children: [
Container(
height: MediaQuery.of(context).size.height/5,
decoration: BoxDecoration(
decoration: const BoxDecoration(
image:DecorationImage(image: AssetImage('assets/images/login_image.jpg'))
),
),
SizedBox(height: 5,),
const SizedBox(height: 5,),
],
),
Padding(
padding: EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric(
horizontal: 40
),
child: Column(
@ -57,9 +57,9 @@ class LoginPopupPage extends StatelessWidget {
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3,left: 3),
padding: const EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
),
@ -74,7 +74,7 @@ class LoginPopupPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: CircularProgressIndicator(),
child: const CircularProgressIndicator(),
) :
Column(
children: [
@ -86,9 +86,9 @@ class LoginPopupPage extends StatelessWidget {
Get.snackbar(
"no_values".tr,
"email_and_password_required".tr,
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
@ -101,12 +101,12 @@ class LoginPopupPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("ログイン",style: TextStyle(
child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
),
SizedBox(height: 19.0,),
const SizedBox(height: 19.0,),
MaterialButton(
minWidth: double.infinity,
height:50,
@ -117,12 +117,12 @@ class LoginPopupPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("sign_up".tr,style: TextStyle(
child: Text("sign_up".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
),
SizedBox(height: 19.0,),
const SizedBox(height: 19.0,),
MaterialButton(
minWidth: double.infinity,
height:50,
@ -133,7 +133,7 @@ class LoginPopupPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("cancel".tr,style: TextStyle(
child: Text("cancel".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,color: Colors.white70
),
),
@ -144,14 +144,14 @@ class LoginPopupPage extends StatelessWidget {
),
)
),
SizedBox(height: 20,),
const SizedBox(height: 20,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Text("rogaining_user_need_tosign_up".tr, style: TextStyle(
child: Text("rogaining_user_need_tosign_up".tr, style: const TextStyle(
overflow: TextOverflow.ellipsis,
),),
),
@ -169,7 +169,7 @@ class LoginPopupPage extends StatelessWidget {
onPressed: (){
indexController.currentUser.clear();
},
child: Text("Already Logged in, Click to logout"),
child: const Text("Already Logged in, Click to logout"),
),
)
,
@ -181,17 +181,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,style:TextStyle(
Text(label,style:const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: Colors.black87
),),
SizedBox(height: 5,),
const SizedBox(height: 5,),
TextField(
controller: controller,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: (Colors.grey[400])!,
@ -203,7 +203,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
),
),
),
SizedBox(height: 30.0,)
const SizedBox(height: 30.0,)
],
);
}

View File

@ -11,7 +11,7 @@ class MainPerfPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Select Main Perfecture"),
title: const Text("Select Main Perfecture"),
),
body: ListView.builder(
itemCount: indexController.perfectures.length,
@ -19,7 +19,7 @@ class MainPerfPage extends StatelessWidget {
return ListTile(
onTap: (){
indexController.dropdownValue = indexController.perfectures[index][0]["id"].toString();
indexController.populateForPerf(indexController.dropdownValue, indexController.mapController!);
indexController.populateForPerf(indexController.dropdownValue, indexController.mapController);
Get.back();
},
title: Text(indexController.perfectures[index][0]["adm1_ja"].toString()),

View File

@ -4,7 +4,7 @@ import 'package:permission_handler/permission_handler.dart';
import 'package:rogapp/routes/app_pages.dart';
class PermissionHandlerScreen extends StatefulWidget {
PermissionHandlerScreen({Key? key}) : super(key: key);
const PermissionHandlerScreen({Key? key}) : super(key: key);
@override
State<PermissionHandlerScreen> createState() => _PermissionHandlerScreenState();
@ -20,9 +20,9 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
builder: (BuildContext context) {
return AlertDialog(
title: const Text('ロケーション許可'),
content: SingleChildScrollView(
content: const SingleChildScrollView(
child: ListBody(
children: const <Widget>[
children: <Widget>[
Text( 'このアプリでは、位置情報の収集を行います。'),
Text( 'このアプリでは、開始時点で位置情報を収集します。'),
],
@ -57,22 +57,20 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
permissionServiceCall() async {
await permissionServices().then(
(value) {
if (value != null) {
if (value[Permission.location]!.isGranted ) {
/* ========= New Screen Added ============= */
if (value[Permission.location]!.isGranted ) {
/* ========= New Screen Added ============= */
Get.toNamed(AppPages.TRAVEL);
Get.toNamed(AppPages.TRAVEL);
// Navigator.pushReplacement(
// context,
// MaterialPageRoute(builder: (context) => SplashScreen()),
// );
}
else{
_showMyDialog();
}
// Navigator.pushReplacement(
// context,
// MaterialPageRoute(builder: (context) => SplashScreen()),
// );
}
},
else{
_showMyDialog();
}
},
);
}
@ -122,7 +120,7 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
});
return Scaffold(
body: Container(
child: Text(""),
child: const Text(""),
),
);
}
@ -132,9 +130,9 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
context: context,
builder: (_) => AlertDialog(
title: const Text('ロケーション許可'),
content: SingleChildScrollView(
content: const SingleChildScrollView(
child: ListBody(
children: const <Widget>[
children: <Widget>[
Text( 'このアプリでは、位置情報の収集を行います。'),
Text('岐阜ナビアプリではチェックポイントの自動チェックインの機能を可能にするために、現在地のデータが収集されます。アプリを閉じている時や、使用していないときにも収集されます。位置情報は、個人を特定できない統計的な情報として、ユーザーの個人情報とは一切結びつかない形で送信されます。お知らせの配信、位置情報の利用を許可しない場合は、この後表示されるダイアログで「許可しない」を選択してください。'),
],

View File

@ -1,7 +1,4 @@
import 'package:flutter/material.dart';
import 'package:flutter/src/foundation/key.dart';
import 'package:flutter/src/widgets/container.dart';
import 'package:flutter/src/widgets/framework.dart';
class ProgressPage extends StatelessWidget {
const ProgressPage({Key? key}) : super(key: key);
@ -10,7 +7,7 @@ class ProgressPage extends StatelessWidget {
Widget build(BuildContext context) {
return Container(
color: Colors.transparent,
child: Center(
child: const Center(
child: CircularProgressIndicator(),
),
);

View File

@ -13,6 +13,8 @@ class RegisterPage extends StatelessWidget {
TextEditingController passwordController = TextEditingController();
TextEditingController confirmPasswordController = TextEditingController();
RegisterPage({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return Scaffold(
@ -24,11 +26,11 @@ class RegisterPage extends StatelessWidget {
leading:
IconButton( onPressed: (){
Navigator.pop(context);
},icon:Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
},icon:const Icon(Icons.arrow_back_ios,size: 20,color: Colors.black,)),
),
body: SafeArea(
child: SingleChildScrollView(
child: Container(
child: SizedBox(
height: MediaQuery.of(context).size.height,
width: double.infinity,
child: Column(
@ -39,20 +41,20 @@ class RegisterPage extends StatelessWidget {
Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
Text ("サインアップ", style: TextStyle(
const Text ("サインアップ", style: TextStyle(
fontSize: 30,
fontWeight: FontWeight.bold,
),),
SizedBox(height: 20,),
const SizedBox(height: 20,),
Text("アカウントを作成し、無料です",style: TextStyle(
fontSize: 15,
color: Colors.grey[700],
),),
SizedBox(height: 30,)
const SizedBox(height: 30,)
],
),
Padding(
padding: EdgeInsets.symmetric(
padding: const EdgeInsets.symmetric(
horizontal: 40
),
child: Column(
@ -64,12 +66,12 @@ class RegisterPage extends StatelessWidget {
),
),
Padding(
padding: EdgeInsets.symmetric(horizontal: 40),
padding: const EdgeInsets.symmetric(horizontal: 40),
child: Container(
padding: EdgeInsets.only(top: 3,left: 3),
padding: const EdgeInsets.only(top: 3,left: 3),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(40),
border: Border(
border: const Border(
bottom: BorderSide(color: Colors.black),
top: BorderSide(color: Colors.black),
right: BorderSide(color: Colors.black),
@ -84,9 +86,9 @@ class RegisterPage extends StatelessWidget {
Get.snackbar(
"No match",
"Passwords does not match",
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
@ -95,9 +97,9 @@ class RegisterPage extends StatelessWidget {
Get.snackbar(
"no_values".tr,
"email_and_password_required".tr,
icon: Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
icon: const Icon(Icons.assistant_photo_outlined, size: 40.0, color: Colors.blue),
snackPosition: SnackPosition.TOP,
duration: Duration(milliseconds: 800),
duration: const Duration(milliseconds: 800),
backgroundColor: Colors.yellow,
//icon:Image(image:AssetImage("assets/images/dora.png"))
);
@ -110,23 +112,23 @@ class RegisterPage extends StatelessWidget {
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(40)
),
child: Text("sign_up".tr,style: TextStyle(
child: Text("sign_up".tr,style: const TextStyle(
fontWeight: FontWeight.w600,fontSize: 16,
),),
),
),
),
SizedBox(height: 20,),
const SizedBox(height: 20,),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Flexible(child: Text("すでにアカウントをお持ちですか?")),
const Flexible(child: Text("すでにアカウントをお持ちですか?")),
TextButton(
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
child: Text("ログイン",style: TextStyle(
child: const Text("ログイン",style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: 18
),),
@ -149,17 +151,17 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(label,style:TextStyle(
Text(label,style:const TextStyle(
fontSize: 15,
fontWeight: FontWeight.w400,
color: Colors.black87
),),
SizedBox(height: 5,),
const SizedBox(height: 5,),
TextField(
controller: controller,
obscureText: obsureText,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(vertical: 0,horizontal: 10),
contentPadding: const EdgeInsets.symmetric(vertical: 0,horizontal: 10),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: (Colors.grey[400])!,
@ -171,7 +173,7 @@ Widget makeInput({label, required TextEditingController controller, obsureText =
),
),
),
SizedBox(height: 30,)
const SizedBox(height: 30,)
],
);

View File

@ -1,8 +1,5 @@
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:get/get_state_manager/get_state_manager.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/index/index_controller.dart';
class SearchBarController extends GetxController {

View File

@ -1,4 +1,3 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:geojson/geojson.dart';
@ -15,7 +14,7 @@ class SearchPage extends StatelessWidget {
Image getImage(int index){
if(searchController.searchResults[index].properties!["photos"] == null || searchController.searchResults[index].properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
return Image(
@ -39,7 +38,7 @@ class SearchPage extends StatelessWidget {
},
icon: const Icon(Icons.arrow_back_ios_new, color: Colors.black,)),
title: TypeAheadField(
textFieldConfiguration: TextFieldConfiguration(
textFieldConfiguration: const TextFieldConfiguration(
autofocus: true,
),
suggestionsCallback: (pattern) async{
@ -49,7 +48,7 @@ class SearchPage extends StatelessWidget {
itemBuilder: (context, GeoJsonFeature suggestion){
return ListTile(
title: Text(suggestion.properties!["location_name"]),
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : Text(""),
subtitle: suggestion.properties!["category"] != null ? Text(suggestion.properties!["category"]) : const Text(""),
//leading: getImage(index),
);
},

View File

@ -11,7 +11,7 @@ class SubPerfPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Select Sub Perfecture"),
title: const Text("Select Sub Perfecture"),
),
body: ListView.builder(
itemCount: indexController.subPerfs.length,

View File

@ -6,6 +6,7 @@ import 'package:rogapp/pages/changepassword/change_password_page.dart';
import 'package:rogapp/pages/city/city_page.dart';
import 'package:rogapp/pages/destination/destination_binding.dart';
import 'package:rogapp/pages/destination/destination_page.dart';
import 'package:rogapp/pages/history/history_page.dart';
import 'package:rogapp/pages/home/home_binding.dart';
import 'package:rogapp/pages/home/home_page.dart';
@ -48,6 +49,7 @@ class AppPages {
static const CHANGE_PASSWORD = Routes.CHANGE_PASSWORD;
static const CAMERA_PAGE = Routes.CAMERA_PAGE;
static const PROGRESS = Routes.PROGRESS;
static const HISTORY = Routes.HISTORY;
static final routes = [
// GetPage(
@ -72,7 +74,7 @@ class AppPages {
),
GetPage(
name: Routes.LANDING,
page: () => LandingPage(),
page: () => const LandingPage(),
//binding: SpaBinding(),
),
GetPage(
@ -92,7 +94,7 @@ class AppPages {
),
GetPage(
name: Routes.LOADING,
page: () => LoadingPage(),
page: () => const LoadingPage(),
//binding: DestinationBinding(),
),
GetPage(
@ -102,12 +104,12 @@ class AppPages {
),
GetPage(
name: Routes.HOME,
page: () => HomePage(),
page: () => const HomePage(),
binding: HomeBinding(),
),
GetPage(
name: Routes.PERMISSION,
page: () => PermissionHandlerScreen(),
page: () => const PermissionHandlerScreen(),
),
GetPage(
name: Routes.SEARCH,
@ -124,11 +126,11 @@ class AppPages {
),
GetPage(
name: Routes.CITY,
page: () => CityPage(),
page: () => const CityPage(),
),
GetPage(
name: Routes.CATEOGORY,
page: () => CategoryPage(),
page: () => const CategoryPage(),
),
GetPage(
name: Routes.CHANGE_PASSWORD,
@ -140,7 +142,11 @@ class AppPages {
),
GetPage(
name: Routes.PROGRESS,
page: () => ProgressPage(),
page: () => const ProgressPage(),
),
GetPage(
name: Routes.HISTORY,
page: () => const HistoryPage(),
)
];
}

View File

@ -24,4 +24,5 @@ abstract class Routes {
static const CHANGE_PASSWORD = '/change_password';
static const CAMERA_PAGE = '/camera_page';
static const PROGRESS = '/progress';
static const HISTORY = '/history';
}

View File

@ -5,14 +5,14 @@ import 'package:rogapp/utils/const.dart';
class ActionService{
static Future<Map<String, dynamic>> makeAction(int user_id, int location_id, bool wanttogo, bool like, bool checkin) async {
print("----- action is ---- ${like}-- ${wanttogo}-- ${checkin}");
static Future<Map<String, dynamic>> makeAction(int userId, int locationId, bool wanttogo, bool like, bool checkin) async {
print("----- action is ---- $like-- $wanttogo-- $checkin");
Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer();
String url = "${server_url}/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
String serverUrl = ConstValues.currentServer();
String url = "$serverUrl/api/makeaction/?user_id=$userId&location_id=$locationId&wanttogo=$wanttogo&like=$like&checkin=$checkin";
//String url = "http://localhost:8100/api/makeaction/?user_id=${user_id}&location_id=${location_id}&wanttogo=${wanttogo}&like=${like}&checkin=${checkin}";
print('++++++++${url}');
print("url is ------ ${url}");
print('++++++++$url');
print("url is ------ $url");
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
@ -27,11 +27,11 @@ class ActionService{
}
static Future<List<dynamic>?> userAction(int user_id, int location_id) async {
static Future<List<dynamic>?> userAction(int userId, int locationId) async {
List<dynamic> cats = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/useraction/?user_id=${user_id}&location_id=${location_id}';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/useraction/?user_id=$userId&location_id=$locationId';
print('++++++++$url');
//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>{

View File

@ -8,14 +8,14 @@ class AuthService{
static Future<Map<String, dynamic>> changePassword(String oldpassword, String newpassword, String token) async {
Map<String, dynamic> changePassword = {};
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/change-password/';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/change-password/';
print('++++++++$url');
final http.Response response = await http.put(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}'
'Authorization': 'Token $token'
},
body: jsonEncode(<String, String>{
'old_password': oldpassword,
@ -31,11 +31,11 @@ class AuthService{
static Future<Map<String, dynamic>> login(String email, String password) async {
print("------- in logged email ${email} pwd ${password} ###### --------");
print("------- in logged email $email pwd $password ###### --------");
Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/login/';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/login/';
print('++++++++$url');
//String url = 'http://localhost:8100/api/login/';
final http.Response response = await http.post(
Uri.parse(url),
@ -57,9 +57,9 @@ class AuthService{
static Future<Map<String, dynamic>> register(String email, String password) async {
Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/register/';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/register/';
print('++++++++$url');
final http.Response response = await http.post(
Uri.parse(url),
headers: <String, String>{
@ -79,14 +79,14 @@ class AuthService{
static Future<Map<String, dynamic>> deleteUser(String token) async {
Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/delete-account/';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/delete-account/';
print('++++++++$url');
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}'
'Authorization': 'Token $token'
}
);
@ -99,10 +99,10 @@ class AuthService{
static Future<List<dynamic>?> UserDetails(int userid) async {
List<dynamic> cats = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/userdetials?user_id=${userid}';
print('++++++++${url}');
print("---- UserDetails url is ${url}");
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/userdetials?user_id=$userid';
print('++++++++$url');
print("---- UserDetails url is $url");
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -117,6 +117,28 @@ class AuthService{
}
static Future<List<dynamic>?> userForToken(String token) async {
Map<String, dynamic> cats = {};
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/user/';
print('++++++++$url');
print("---- UserDetails url is $url");
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token $token'
},
);
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
print("--- eeeeee $cats ----");
}
return [{"user":cats}];
}

View File

@ -1,5 +1,4 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import '../utils/const.dart';
@ -9,9 +8,9 @@ class CatService{
static Future<List<dynamic>?> loadCats(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4) async {
List<dynamic> cats = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/cats/?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/cats/?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -28,9 +27,9 @@ class CatService{
static Future<List<dynamic>?> loadCatByCity(String cityname)async {
List<dynamic> cats = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/catbycity/?${cityname}';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/catbycity/?$cityname';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',

View File

@ -11,11 +11,11 @@ import '../utils/const.dart';
class DestinationService{
static Future<List<dynamic>> getDestinations(int user_id) async {
static Future<List<dynamic>> getDestinations(int userId) async {
List<dynamic> cats = [];
String server_url = ConstValues.currentServer();
String url = "${server_url}/api/destinations/?user_id=${user_id}";
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = "$serverUrl/api/destinations/?user_id=$userId";
print('++++++++$url');
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
@ -29,11 +29,11 @@ class DestinationService{
return cats;
}
static Future<Map<String, dynamic>> deleteDestination(int dest_id) async {
static Future<Map<String, dynamic>> deleteDestination(int destId) async {
Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer();
String url = "${server_url}/api/delete_destination/?dest_id=${dest_id}";
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = "$serverUrl/api/delete_destination/?dest_id=$destId";
print('++++++++$url');
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
@ -44,15 +44,15 @@ class DestinationService{
if (response.statusCode == 200) {
cats = json.decode(utf8.decode(response.bodyBytes));
}
print("####### ---- ${cats}");
print("####### ---- $cats");
return cats;
}
static Future<int> updateOrder(int action_id, int order, String dir) async {
static Future<int> updateOrder(int actionId, int order, String dir) async {
int cats = 0;
String server_url = ConstValues.currentServer();
String url = "${server_url}/api/updateorder/?user_action_id=${action_id}&order=${order}&dir=${dir}";
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = "$serverUrl/api/updateorder/?user_action_id=$actionId&order=$order&dir=$dir";
print('++++++++$url');
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
@ -69,7 +69,7 @@ class DestinationService{
static Future<List<PointLatLng>>? getDestinationLine(List<Destination> destinations, Map<String, dynamic> mtx) async{
PolylinePoints polylinePoints = PolylinePoints();
if(destinations.length <= 0){
if(destinations.isEmpty){
return [];
}
@ -90,7 +90,7 @@ class DestinationService{
int j = 0;
PolylineWayPoint pwp = PolylineWayPoint(location: "${la},${ln}", stopOver: false);
PolylineWayPoint pwp = PolylineWayPoint(location: "$la,$ln", stopOver: false);
//print("----- UUUUUU ${pwp}");
@ -101,15 +101,15 @@ class DestinationService{
}
final DestinationController destinationController = Get.find<DestinationController>();
int trav_mode = destinationController.travelMode.value;
String _mode = "WALKING";
if(trav_mode == 1){
int travMode = destinationController.travelMode.value;
String mode = "WALKING";
if(travMode == 1){
//_mode = TravelMode.driving;
_mode = "DRIVING";
mode = "DRIVING";
}
else if(trav_mode == 2) {
else if(travMode == 2) {
//_mode = TravelMode.transit;
_mode = "TRANSIT";
mode = "TRANSIT";
}

View File

@ -2,12 +2,10 @@ import 'dart:io';
import 'package:get/get.dart';
import 'package:http/http.dart' as http;
import 'package:intl/intl.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/model/rog.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/database_helper.dart';
import 'package:sqflite/sqlite_api.dart';
import 'dart:convert';
import '../utils/const.dart';
@ -33,100 +31,100 @@ class ExternalService {
final IndexController indexController = Get.find<IndexController>();
Map<String, dynamic> _res = {};
Map<String, dynamic> res = {};
int user_id = indexController.currentUser[0]["user"]["id"];
int userId = indexController.currentUser[0]["user"]["id"];
//print("--- Pressed -----");
String _team = indexController.currentUser[0]["user"]['team_name'];
String team = indexController.currentUser[0]["user"]['team_name'];
//print("--- _team : ${_team}-----");
String _event_code = indexController.currentUser[0]["user"]["event_code"];
String eventCode = indexController.currentUser[0]["user"]["event_code"];
if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){
DatabaseHelper db = DatabaseHelper.instance;
Rog _rog = Rog(
Rog rog = Rog(
id:1,
team_name: _team,
event_code : _event_code,
user_id: user_id,
team_name: team,
event_code : eventCode,
user_id: userId,
cp_number: -1,
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
image: null,
rog_action_type: 0
);
db.insertRogaining(_rog);
db.insertRogaining(rog);
}
else {
String url = 'https://natnats.mobilous.com/start_from_rogapp';
print('++++++++${url}');
print('++++++++$url');
final http.Response response = await http.post(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(<String, String>{
'team_name': _team,
'event_code': _event_code
'team_name': team,
'event_code': eventCode
}),
);
print("---- start rogianing api status ---- ${response.statusCode}");
if (response.statusCode == 200) {
_res = json.decode(utf8.decode(response.bodyBytes));
print('----_res : ${_res} ----');
res = json.decode(utf8.decode(response.bodyBytes));
print('----_res : $res ----');
}
}
return _res;
return res;
}
Future<Map<String, dynamic>> makeCheckpoint(int user_id, String token, String checkin_time, String teamname, int cp, String eventcode, String imageurl) async {
Map<String, dynamic> _res = {};
Future<Map<String, dynamic>> makeCheckpoint(int userId, String token, String checkinTime, String teamname, int cp, String eventcode, String imageurl) async {
Map<String, dynamic> res = {};
String url = 'https://natnats.mobilous.com/checkin_from_rogapp';
print('++++++++${url}');
print('++++++++$url');
final IndexController indexController = Get.find<IndexController>();
if(imageurl != null){
if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){
DatabaseHelper db = DatabaseHelper.instance;
Rog _rog = Rog(
Rog rog = Rog(
id:1,
team_name: teamname,
event_code : eventcode,
user_id: user_id,
user_id: userId,
cp_number: cp,
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
image: imageurl,
rog_action_type: 1,
);
db.insertRogaining(_rog);
db.insertRogaining(rog);
}
else {
String server_url = ConstValues.currentServer();
String url1 = "${server_url}/api/checkinimage/";
final im1Bytes = File(imageurl!).readAsBytesSync();
String serverUrl = ConstValues.currentServer();
String url1 = "$serverUrl/api/checkinimage/";
final im1Bytes = File(imageurl).readAsBytesSync();
String im1_64 = base64Encode(im1Bytes);
final http.Response response = await http.post(
Uri.parse(url1),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}'
'Authorization': 'Token $token'
},
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
body: jsonEncode(<String, String>{
'user' : user_id.toString(),
'user' : userId.toString(),
'team_name': teamname,
'event_code': eventcode,
'checkinimage' : im1_64,
'checkintime' : checkin_time,
'checkintime' : checkinTime,
'cp_number' : cp.toString()
}),
);
_res = json.decode(utf8.decode(response.bodyBytes));
res = json.decode(utf8.decode(response.bodyBytes));
print("-----@@@@@ ${_res} -----");
print("-----@@@@@ $res -----");
if(response.statusCode == 201){
//print('---- toekn is ${token} -----');
@ -139,13 +137,13 @@ class ExternalService {
'team_name': teamname,
'cp_number': cp.toString(),
'event_code': eventcode,
'image': _res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
'image': res["checkinimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
}),
);
print("--- checnin response ${response2.statusCode}----");
if (response2.statusCode == 200) {
_res = json.decode(utf8.decode(response2.bodyBytes));
print('----checkin res _res : ${_res} ----');
res = json.decode(utf8.decode(response2.bodyBytes));
print('----checkin res _res : $res ----');
}
}
}
@ -153,17 +151,17 @@ class ExternalService {
else{
if(indexController.connectionStatusName != "wifi" || indexController.connectionStatusName != "mobile"){
DatabaseHelper db = DatabaseHelper.instance;
Rog _rog = Rog(
Rog rog = Rog(
id:1,
team_name: teamname,
event_code : eventcode,
user_id: user_id,
user_id: userId,
cp_number: cp,
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
image: null,
rog_action_type: 1,
);
db.insertRogaining(_rog);
db.insertRogaining(rog);
}
else {
final http.Response response3 = await http.post(
@ -180,64 +178,64 @@ class ExternalService {
);
print("--- checnin response ${response3.statusCode}----");
if (response3.statusCode == 200) {
_res = json.decode(utf8.decode(response3.bodyBytes));
print('----checkin res _res : ${_res} ----');
res = json.decode(utf8.decode(response3.bodyBytes));
print('----checkin res _res : $res ----');
}
}
}
return _res;
return res;
}
Future<Map<String, dynamic>> makeGoal(int user_id, String token, String teamname, String image, String goal_time, String eventcode) async {
Map<String, dynamic> _res2 = {};
Future<Map<String, dynamic>> makeGoal(int userId, String token, String teamname, String image, String goalTime, String eventcode) async {
Map<String, dynamic> res2 = {};
final IndexController indexController = Get.find<IndexController>();
final DestinationController destinationController = Get.find<DestinationController>();
//if(indexController.connectionStatusName != "wifi" && indexController.connectionStatusName != "mobile"){
DatabaseHelper db = DatabaseHelper.instance;
Rog _rog = Rog(
Rog rog = Rog(
id:1,
team_name: teamname,
event_code : eventcode,
user_id: user_id,
user_id: userId,
cp_number: -1,
checkintime: DateTime.now().toUtc().microsecondsSinceEpoch,
image: image,
rog_action_type: 1,
);
db.insertRogaining(_rog);
db.insertRogaining(rog);
// }
// else{
String server_url = ConstValues.currentServer();
String url1 = "${server_url}/api/goalimage/";
final im1Bytes = File(image!).readAsBytesSync();
String serverUrl = ConstValues.currentServer();
String url1 = "$serverUrl/api/goalimage/";
final im1Bytes = File(image).readAsBytesSync();
String im1_64 = base64Encode(im1Bytes);
final http.Response response = await http.post(
Uri.parse(url1),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}'
'Authorization': 'Token $token'
},
// 'id', 'user', 'goalimage', 'goaltime', 'team_name', 'event_code','cp_number'
body: jsonEncode(<String, String>{
'user' : user_id.toString(),
'user' : userId.toString(),
'team_name': teamname,
'event_code': eventcode,
'goaltime' : goal_time,
'goaltime' : goalTime,
'goalimage' : im1_64,
'cp_number' : "-1"
}),
);
String url = 'https://natnats.mobilous.com/goal_from_rogapp';
print('++++++++${url}');
print('++++++++$url');
if (response.statusCode == 201) {
Map<String, dynamic> _res = json.decode(utf8.decode(response.bodyBytes));
print('----_res : ${_res} ----');
print('---- image url ${_res["goalimage"]} ----');
Map<String, dynamic> res = json.decode(utf8.decode(response.bodyBytes));
print('----_res : $res ----');
print('---- image url ${res["goalimage"]} ----');
final http.Response response2 = await http.post(
Uri.parse(url),
headers: <String, String>{
@ -246,26 +244,26 @@ class ExternalService {
body: jsonEncode(<String, String>{
'team_name': teamname,
'event_code': eventcode,
'goal_time' : goal_time,
'image' : _res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
'goal_time' : goalTime,
'image' : res["goalimage"].toString().replaceAll('http://localhost:8100', 'http://rogaining.sumasen.net')
}
),
);
print('----- response2 is ${response2} --------');
print('----- response2 is $response2 --------');
if (response2.statusCode == 200) {
_res2 = json.decode(utf8.decode(response2.bodyBytes));
res2 = json.decode(utf8.decode(response2.bodyBytes));
}
}
//}
destinationController.resetRogaining();
return _res2;
return res2;
}
static Future<Map<String, dynamic>> usersEventCode(String teamcode, String password) async {
Map<String, dynamic> _res = {};
String url = "https://natnats.mobilous.com/check_event_code?zekken_number=${teamcode}&password=${password}";
print('++++++++${url}');
Map<String, dynamic> res = {};
String url = "https://natnats.mobilous.com/check_event_code?zekken_number=$teamcode&password=$password";
print('++++++++$url');
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{
@ -274,9 +272,9 @@ class ExternalService {
);
if (response.statusCode == 200) {
_res = json.decode(utf8.decode(response.bodyBytes));
res = json.decode(utf8.decode(response.bodyBytes));
}
return _res;
return res;
}
}

View File

@ -8,9 +8,9 @@ class LocationLineService{
static Future<GeoJsonFeature?> loadLocationLines() async {
final geo = GeoJson();
GeoJsonFeature? fs;
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/location_line/';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/location_line/';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',

View File

@ -9,9 +9,9 @@ class LocationPolygonervice{
final geo = GeoJson();
GeoJsonFeature? fs;
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/location_polygon/';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/location_polygon/';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',

View File

@ -37,31 +37,31 @@ class LocationService{
static Future<GeoJsonFeatureCollection?> loadLocationsFor(String perfecture, String cat) async {
final IndexController indexController = Get.find<IndexController>();
String url = "";
String server_url = ConstValues.currentServer();
String serverUrl = ConstValues.currentServer();
if(cat.isNotEmpty){
if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False';
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture + '&cat=' + cat;
url = '$serverUrl/api/inperf/?rog=$r&perf=$perfecture&cat=$cat';
}
else {
url = '${server_url}/api/inperf/?perf=' + perfecture + '&cat=' + cat;
url = '$serverUrl/api/inperf/?perf=$perfecture&cat=$cat';
}
}
else{
if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False';
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/inperf/?rog=${r}&perf=' + perfecture;
url = '$serverUrl/api/inperf/?rog=$r&perf=$perfecture';
}
else {
url = '${server_url}/api/inperf/?perf=' + perfecture;
url = '$serverUrl/api/inperf/?perf=$perfecture';
}
}
print('++++++++${url}');
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -78,13 +78,13 @@ class LocationService{
static Future<List<dynamic>?> getLocationsExt(String token) async {
List<dynamic> ext = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/locsext/';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/locsext/';
print('++++++++$url');
final response = await http.post(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
'Authorization': 'Token ${token}'
'Authorization': 'Token $token'
},
body: jsonEncode(<String, String>{
'token': token,
@ -102,30 +102,30 @@ class LocationService{
static Future<GeoJsonFeatureCollection?> loadLocationsSubFor(String subperfecture, String cat) async {
final IndexController indexController = Get.find<IndexController>();
String url = "";
String server_url = ConstValues.currentServer();
String serverUrl = ConstValues.currentServer();
if(cat.isNotEmpty){
if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False';
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture + '&cat=' + cat;
url = '$serverUrl/api/insubperf?rog=$r&subperf=$subperfecture&cat=$cat';
}
else{
url = '${server_url}/api/insubperf?subperf=' + subperfecture + '&cat=' + cat;
url = '$serverUrl/api/insubperf?subperf=$subperfecture&cat=$cat';
}
}
else{
if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False';
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/insubperf?rog=${r}&subperf=' + subperfecture;
url = '$serverUrl/api/insubperf?rog=$r&subperf=$subperfecture';
}
else{
url = '${server_url}/api/insubperf?subperf=' + subperfecture;
url = '$serverUrl/api/insubperf?subperf=$subperfecture';
}
}
print('++++++++${url}');
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -142,34 +142,35 @@ class LocationService{
static Future<GeoJsonFeatureCollection?> loadLocationsBound(double lat1, double lon1, double lat2, double lon2, double lat3, double lon3, double lat4, double lon4, String cat) async {
print("-------- in location for bound -------------");
final IndexController indexController = Get.find<IndexController>();
print("-------- in location for bound -------------");
print("-------- in location for bound current user ${indexController.currentUser} -------------");
String url = "";
String server_url = ConstValues.currentServer();
String serverUrl = ConstValues.currentServer();
if(cat.isNotEmpty){
if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False';
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/inbound?rog=${r}&grp=$grp&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
url = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4&cat=$cat';
}
else{
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}' + '&cat=' + cat;
url = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4&cat=$cat';
}
}
else{
if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False';
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code'];
print("-------- requested user group ${grp} -------------");
url = '${server_url}/api/inbound?rog=${r}&grp=$grp&ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
print("-------- requested user group $grp -------------");
url = '$serverUrl/api/inbound?rog=$r&grp=$grp&ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
}
else{
url = '${server_url}/api/inbound?ln1=${lon1}&la1=${lat1}&ln2=${lon2}&la2=${lat2}&ln3=${lon3}&la3=${lat3}&ln4=${lon4}&la4=${lat4}';
url = '$serverUrl/api/inbound?ln1=$lon1&la1=$lat1&ln2=$lon2&la2=$lat2&ln3=$lon3&la3=$lat3&ln4=$lon4&la4=$lat4';
}
}
print('++++++++${url}');
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -200,31 +201,31 @@ class LocationService{
if(cat == "-all-"){
cat = "";
}
String server_url = ConstValues.currentServer();
print("loadCustomLocations url is ----- ${cat}");
String serverUrl = ConstValues.currentServer();
print("loadCustomLocations url is ----- $cat");
if(cat.isNotEmpty){
if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False';
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/custom_area/?rog=${r}&&cat=' + cat;
url = '$serverUrl/api/custom_area/?rog=$r&&cat=$cat';
}
else{
url = '${server_url}/api/custom_area/?&cat=' + cat;
url = '$serverUrl/api/custom_area/?&cat=$cat';
}
}
else{
if(indexController.currentUser.isNotEmpty){
bool _rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = _rog == true ? 'True': 'False';
bool rog = indexController.currentUser[0]['user']['is_rogaining'];
String r = rog == true ? 'True': 'False';
var grp = indexController.currentUser[0]['user']['event_code'];
url = '${server_url}/api/customarea?rog=${r}&name=${name}';
url = '$serverUrl/api/customarea?rog=$r&name=$name';
}
else{
url = '${server_url}/api/customarea?name=${name}';
url = '$serverUrl/api/customarea?name=$name';
}
}
print('++++++++${url}');
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',

View File

@ -18,7 +18,7 @@ class MatrixService{
int i = 0;
for(Destination d in destinations){
print("---- getting matrix for ${d} ------------");
print("---- getting matrix for $d ------------");
if(i==0){
origin = "${d.lat}, ${d.lon}";
@ -37,24 +37,24 @@ class MatrixService{
i++;
}
locs = "optimize:false|${locs}";
locs = "optimize:false|$locs";
String _mode = "walking";
String mode = "walking";
switch (destinationController.travelMode.value) {
case 1:
_mode = "driving";
mode = "driving";
break;
case 2:
_mode = "transit";
mode = "transit";
break;
default:
_mode = "walking";
mode = "walking";
break;
}
Map<String, dynamic> cats = {};
String url = "https://maps.googleapis.com/maps/api/directions/json?destination=${destination}&mode=${_mode}&waypoints=${locs}&origin=${origin}&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
print('++++++++${url}');
String url = "https://maps.googleapis.com/maps/api/directions/json?destination=$destination&mode=$mode&waypoints=$locs&origin=$origin&key=AIzaSyAUBI1ablMKuJwGj2-kSuEhvYxvB1A-mOE";
print('++++++++$url');
final http.Response response = await http.get(
Uri.parse(url),
headers: <String, String>{

View File

@ -7,9 +7,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadPerfectures() async {
List<dynamic> perfs = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/perf_main/';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/perf_main/';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -25,9 +25,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadSubPerfectures(String area) async {
List<dynamic> perfs = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/subperfinmain/?area=' + area;
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/subperfinmain/?area=$area';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -44,9 +44,9 @@ class PerfectureService{
static Future<List<dynamic>?> getMainPerfExt(String id) async {
List<dynamic> perfs = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/mainperfext/?perf=' + id;
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/mainperfext/?perf=$id';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -62,9 +62,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadGifuAreas(String perf) async {
List<dynamic> perfs = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/allgifuareas/?perf=' + perf;
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/allgifuareas/?perf=$perf';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -80,9 +80,9 @@ class PerfectureService{
static Future<List<dynamic>?> loadCustomAreas() async {
List<dynamic> perfs = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/customareanames';
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/customareanames';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
@ -99,9 +99,9 @@ class PerfectureService{
static Future<List<dynamic>?> getSubExt(String id) async {
List<dynamic> perfs = [];
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/perfext/?sub_perf=' + id;
print('++++++++${url}');
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/perfext/?sub_perf=$id';
print('++++++++$url');
final response = await http.get(Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',

View File

@ -1,26 +1,25 @@
import 'dart:convert';
import 'package:flutter/material.dart';
import 'package:http/http.dart' as http;
import 'package:rogapp/utils/const.dart';
class TrackingService {
static Future<Map<String, dynamic>> addTrack(String user_id, double lat, double lon) async {
static Future<Map<String, dynamic>> addTrack(String userId, double lat, double lon) async {
Map<String, dynamic> cats = {};
String server_url = ConstValues.currentServer();
String url = '${server_url}/api/track/';
print('++++++++${url}');
final geom = '{"type": "MULTIPOINT", "coordinates": [[${lon}, ${lat}]]}';
String serverUrl = ConstValues.currentServer();
String url = '$serverUrl/api/track/';
print('++++++++$url');
final geom = '{"type": "MULTIPOINT", "coordinates": [[$lon, $lat]]}';
final http.Response response = await http.post(
Uri.parse(url),
headers: <String, String>{
'Content-Type': 'application/json; charset=UTF-8',
},
body: jsonEncode(<String, String>{
'user_id': user_id,
'user_id': userId,
'geom': geom
}),
);

View File

@ -1,6 +1,5 @@
import 'dart:io';
import 'package:path_provider/path_provider.dart';
import 'package:rogapp/model/Rogaining.dart';
import 'package:rogapp/model/destination.dart';
import 'package:sqflite/sqflite.dart';
import 'package:path/path.dart';
@ -86,14 +85,14 @@ class DatabaseHelper{
var rog = await db.query('rog');
List<Rog> roglist = rog.isNotEmpty ?
rog.map((e) => Rog.fromMap(e)).toList() : [];
print("--------- ${rog}");
print("--------- $rog");
return roglist;
}
Future<List<Rog>> getRogainingByLatLon(double lat, double lon) async {
Database db = await instance.database;
var rog = await db.query('rog', where: "lat = ${lat} and lon= ${lon}");
var rog = await db.query('rog', where: "lat = $lat and lon= $lon");
List<Rog> roglist = rog.isNotEmpty
? rog.map((e) => Rog.fromMap(e)).toList() : [];
return roglist;
@ -101,12 +100,12 @@ class DatabaseHelper{
Future clearSelection() async {
Database db = await instance.database;
Map<String, dynamic> row_clear = {
Map<String, dynamic> rowClear = {
"selected": false
};
return await db.update(
"destination",
row_clear
rowClear
);
}
@ -114,7 +113,7 @@ class DatabaseHelper{
Database db = await instance.database;
bool val = !dest.selected!;
Map<String, dynamic> row_target = {
Map<String, dynamic> rowTarget = {
"selected": val
};
@ -122,7 +121,7 @@ class DatabaseHelper{
return await db.update(
"destination",
row_target,
rowTarget,
where: 'location_id = ?',
whereArgs: [dest.location_id!]
);
@ -130,7 +129,7 @@ class DatabaseHelper{
Future<int> deleteRogaining(int id) async {
Database db = await instance.database;
var rog = await db.delete('rog', where: "id = ${id}");
var rog = await db.delete('rog', where: "id = $id");
int ret = rog > 0 ? rog : -1;
return ret;
@ -145,8 +144,8 @@ class DatabaseHelper{
Future<bool>isRogAlreadyAvailable(int id) async{
Database db = await instance.database;
var rog = await db.query('rog', where: "id = ${id}");
return rog.length > 0 ? true : false;
var rog = await db.query('rog', where: "id = $id");
return rog.isNotEmpty ? true : false;
}
Future<int?>latestGoal() async{
@ -157,16 +156,16 @@ class DatabaseHelper{
Future<int> insertRogaining(Rog rog) async {
Database db = await instance.database;
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog'));
next_order = next_order==null ? 0 : next_order;
next_order = next_order + 1;
rog.id = next_order;
int? nextOrder = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(id) FROM rog'));
nextOrder = nextOrder ?? 0;
nextOrder = nextOrder + 1;
rog.id = nextOrder;
int res = await db.insert(
'rog',
rog.toMap(),
conflictAlgorithm: ConflictAlgorithm.replace,
);
print("------ database helper insert ${res}-----------::::::::");
print("------ database helper insert $res-----------::::::::");
return res;
}
@ -176,13 +175,13 @@ class DatabaseHelper{
var dest = await db.query('destination', orderBy: 'list_order');
List<Destination> destList = dest.isNotEmpty ?
dest.map((e) => Destination.fromMap(e)).toList() : [];
print("--------- ${destList}");
print("--------- $destList");
return destList;
}
Future<List<Destination>> getDestinationById(int id) async {
Database db = await instance.database;
var rog = await db.query('destination', where: "location_id = ${id}");
var rog = await db.query('destination', where: "location_id = $id");
List<Destination> deslist = rog.isNotEmpty
? rog.map((e) => Destination.fromMap(e)).toList() : [];
return deslist;
@ -191,15 +190,15 @@ class DatabaseHelper{
Future<List<Destination>> getDestinationByLatLon(double lat, double lon) async {
Database db = await instance.database;
var dest = await db.query('destination', where: "lat = ${lat} and lon= ${lon}", orderBy: 'list_order');
var dest = await db.query('destination', where: "lat = $lat and lon= $lon", orderBy: 'list_order');
List<Destination> destList = dest.isNotEmpty
? dest.map((e) => Destination.fromMap(e)).toList() : [];
return destList;
}
Future<int> deleteDestination(int location_id) async {
Future<int> deleteDestination(int locationId) async {
Database db = await instance.database;
var dest = await db.delete('destination', where: "location_id = ${location_id}");
var dest = await db.delete('destination', where: "location_id = $locationId");
int ret = dest > 0 ? dest : -1;
//after deleting set correct order
@ -212,19 +211,19 @@ class DatabaseHelper{
Database db = await instance.database;
var byOrder = await db.query('destination', orderBy: 'list_order');
List<Destination> des_db = byOrder.isNotEmpty
List<Destination> desDb = byOrder.isNotEmpty
? byOrder.map((e) => Destination.fromMap(e)).toList() : [];
int order = 1;
for( Destination d in des_db){
for( Destination d in desDb){
Map<String, dynamic> row_target = {
Map<String, dynamic> rowTarget = {
"list_order": order
};
await db.update(
"destination",
row_target,
rowTarget,
where: 'location_id = ?',
whereArgs: [d.location_id]
);
@ -238,18 +237,18 @@ class DatabaseHelper{
await db.delete('destination');
}
Future<bool>isAlreadyAvailable(int location_id) async{
Future<bool>isAlreadyAvailable(int locationId) async{
Database db = await instance.database;
var dest = await db.query('destination', where: "location_id = ${location_id}");
return dest.length > 0 ? true : false;
var dest = await db.query('destination', where: "location_id = $locationId");
return dest.isNotEmpty ? true : false;
}
Future<int> insertDestination(Destination dest) async {
Database db = await instance.database;
int? next_order = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination'));
next_order = next_order==null ? 0 : next_order;
next_order = next_order + 1;
dest.list_order = next_order;
int? nextOrder = Sqflite.firstIntValue(await db.rawQuery('SELECT MAX(list_order) FROM destination'));
nextOrder = nextOrder ?? 0;
nextOrder = nextOrder + 1;
dest.list_order = nextOrder;
int res = await db.insert(
'destination',
dest.toMap(),
@ -278,23 +277,23 @@ class DatabaseHelper{
var target = await db.query('destination', where: "list_order = ${d.list_order! + dir}");
var dest = await db.query('destination', where: "location_id = ${d.location_id}");
print("--- target in db is ${target}");
print("--- destine in db is ${dest}");
print("--- target in db is $target");
print("--- destine in db is $dest");
if(target.isNotEmpty){
List<Destination> target_indb = target.isNotEmpty
List<Destination> targetIndb = target.isNotEmpty
? target.map((e) => Destination.fromMap(e)).toList() : [];
List<Destination> dest_indb = dest.isNotEmpty
List<Destination> destIndb = dest.isNotEmpty
? dest.map((e) => Destination.fromMap(e)).toList() : [];
Map<String, dynamic> row_target = {
Map<String, dynamic> rowTarget = {
"list_order": d.list_order
};
Map<String, dynamic> row_des = {
"list_order": dest_indb[0].list_order! + dir
Map<String, dynamic> rowDes = {
"list_order": destIndb[0].list_order! + dir
};
// print("--- target destination is ${target_indb[0].location_id}");
@ -302,16 +301,16 @@ class DatabaseHelper{
await db.update(
"destination",
row_target,
rowTarget,
where: 'location_id = ?',
whereArgs: [target_indb[0]!.location_id]
whereArgs: [targetIndb[0].location_id]
);
await db.update(
"destination",
row_des,
rowDes,
where: 'location_id = ?',
whereArgs: [dest_indb[0]!.location_id]
whereArgs: [destIndb[0].location_id]
);
}
}

View File

@ -12,7 +12,7 @@ class TextUtils{
// txt = "${f.properties!["cp"].toString().replaceAll(regex, '')}";
// }
//if(f.properties!["buy_point"] != null && f.properties!["buy_point"] > 0){
txt = txt + "${f.properties!["sub_loc_id"]}";
txt = "$txt${f.properties!["sub_loc_id"]}";
//}
return txt;
}
@ -22,9 +22,9 @@ class TextUtils{
RegExp regex = RegExp(r'([.]*0)(?!.*\d)');
String txt = "";
if(dp.cp! > 0){
txt = "${dp.cp.toString().replaceAll(regex, '')}";
txt = dp.cp.toString().replaceAll(regex, '');
if(dp.checkin_point != null && dp.checkin_point! > 0){
txt = txt + "{${dp.checkin_point.toString().replaceAll(regex, '')}}";
txt = "$txt{${dp.checkin_point.toString().replaceAll(regex, '')}}";
}
if(dp.buy_point != null && dp.buy_point! > 0){
print("^^^^^^^^^ ${dp.sub_loc_id}^^^^^^^^^^");

View File

@ -13,7 +13,7 @@ class BaseLayer extends StatelessWidget {
FMTCTileProviderSettings(
behavior: CacheBehavior.values
.byName('cacheFirst'),
cachedValidDuration: Duration(
cachedValidDuration: const Duration(
days: 14
),
),

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,3 @@
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
@ -13,9 +12,11 @@ class BottomSheetWidget extends StatelessWidget {
final IndexController indexController = Get.find<IndexController>();
BottomSheetWidget({Key? key}) : super(key: key);
Image getImage(GeoJsonFeature? gf){
if(gf!.properties!["photos"] == null || gf.properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
return Image(image: NetworkImage(
@ -37,7 +38,7 @@ class BottomSheetWidget extends StatelessWidget {
return SingleChildScrollView(
child: Column(
children: [
SizedBox(height: 5.0,),
const SizedBox(height: 5.0,),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
@ -47,18 +48,18 @@ class BottomSheetWidget extends StatelessWidget {
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
padding: const EdgeInsets.all(14),
shape: const CircleBorder(),
child: const Icon(
Icons.arrow_back_ios,
size: 14,
),
padding: EdgeInsets.all(14),
shape: CircleBorder(),
),
Expanded(
child: Container(
alignment: Alignment.center,
child: Obx(() =>
Text(indexController.currentFeature[0].properties!["location_name"], style: TextStyle(
Text(indexController.currentFeature[0].properties!["location_name"], style: const TextStyle(
fontSize: 15.0,
fontWeight: FontWeight.bold,
),
@ -72,12 +73,12 @@ class BottomSheetWidget extends StatelessWidget {
},
color: Colors.blue,
textColor: Colors.white,
child: Icon(
padding: const EdgeInsets.all(14),
shape: const CircleBorder(),
child: const Icon(
Icons.arrow_forward_ios,
size: 14,
),
padding: EdgeInsets.all(14),
shape: CircleBorder(),
),
],
),
@ -105,59 +106,59 @@ class BottomSheetWidget extends StatelessWidget {
Expanded(
child: Container(
alignment: Alignment.topRight,
child: Text("address".tr, style: TextStyle(fontWeight: FontWeight.bold),)),
child: Text("address".tr, style: const TextStyle(fontWeight: FontWeight.bold),)),
),
SizedBox(width: 12.0,),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["address"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
softWrap: true,
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0.0, height: 0,),
): const SizedBox(width: 0.0, height: 0,),
indexController.currentFeature[0].properties!["phone"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("telephone".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
SizedBox(width: 12.0,),
child: Text("telephone".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["phone"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0, height: 0,),
): const SizedBox(width: 0, height: 0,),
indexController.currentFeature[0].properties!["email"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("email".tr, style: TextStyle(fontWeight: FontWeight.bold),))),
SizedBox(width: 12.0,),
child: Text("email".tr, style: const TextStyle(fontWeight: FontWeight.bold),))),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["email"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0, height: 0,),
): const SizedBox(width: 0, height: 0,),
indexController.currentFeature[0].properties!["webcontents"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -165,8 +166,8 @@ class BottomSheetWidget extends StatelessWidget {
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text(
"web".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
SizedBox(width: 12.0,),
"web".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
@ -175,40 +176,40 @@ class BottomSheetWidget extends StatelessWidget {
_launchURL(indexController.currentFeature[0].properties!["webcontents"]);
},
child: Text(indexController.currentFeature[0].properties!["webcontents"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
softWrap: false,
overflow: TextOverflow.fade,),
)),
),
)
],
): Container(width: 0.0, height: 0.0,),
): const SizedBox(width: 0.0, height: 0.0,),
indexController.currentFeature[0].properties!["videos"] != null ?
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(child: Container(
alignment: Alignment.topRight,
child: Text("video".tr, style: TextStyle(fontWeight: FontWeight.bold)))),
SizedBox(width: 12.0,),
child: Text("video".tr, style: const TextStyle(fontWeight: FontWeight.bold)))),
const SizedBox(width: 12.0,),
Expanded(
child: Container(
alignment: Alignment.topLeft,
child: Obx(() => Text(indexController.currentFeature[0].properties!["videos"] ?? '',
style: TextStyle(color: Colors.blue,),
style: const TextStyle(color: Colors.blue,),
overflow: TextOverflow.ellipsis,)
),
),
)
],
): Container(width: 0.0, height: 0.0,),
): const SizedBox(width: 0.0, height: 0.0,),
],
),
),
),
],
),
SizedBox(height: 20.0,),
const SizedBox(height: 20.0,),
Obx(() =>
indexController.currentAction.isNotEmpty ?
Row(
@ -232,7 +233,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["wanttogo"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -246,7 +247,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["wanttogo"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -267,7 +268,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["like"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -281,7 +282,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["like"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -302,7 +303,7 @@ class BottomSheetWidget extends StatelessWidget {
:
Container(width: 0, height: 0,),
const SizedBox(width: 0, height: 0,),
indexController.rog_mode.value == 1 ?
indexController.currentAction[0][0]["checkin"] == false ?
Column(
@ -311,9 +312,9 @@ class BottomSheetWidget extends StatelessWidget {
mainAxisSize: MainAxisSize.max,
children: [
ElevatedButton(
child: Text("Image"), onPressed: (){
final ImagePicker _picker = ImagePicker();
_picker.pickImage(source: ImageSource.camera).then((value){
child: const Text("Image"), onPressed: (){
final ImagePicker picker = ImagePicker();
picker.pickImage(source: ImageSource.camera).then((value){
print("----- image---- ${value!.path}");
});
},
@ -327,7 +328,7 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["checkin"] = true;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
@ -344,18 +345,18 @@ class BottomSheetWidget extends StatelessWidget {
indexController.currentAction[0][0]["checkin"] = false;
Map<String,dynamic> temp = Map<String,dynamic>.from(indexController.currentAction[0][0]);
indexController.currentAction.clear();
print("---temp---${temp}");
print("---temp---$temp");
indexController.currentAction.add([temp]);
}
indexController.makeAction(context);
},
child: Icon(
child: const Icon(
Icons.favorite, color: Colors.red)
,
):
Container(width: 0, height: 0,),
const SizedBox(width: 0, height: 0,),
],
): Row(
mainAxisAlignment: MainAxisAlignment.center,
@ -364,11 +365,11 @@ class BottomSheetWidget extends StatelessWidget {
onPressed: (){
Get.toNamed(AppPages.LOGIN);
},
child: Flexible(child: Text("その他のオプションについてはログインしてください")))
child: const Flexible(child: Text("その他のオプションについてはログインしてください")))
],
),
),
Row(
const Row(
children: [
SizedBox(height: 60.0,),
],

View File

@ -15,7 +15,7 @@ class BreadCrumbWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
print("------ map controller is ${mapController}------------");
print("------ map controller is $mapController------------");
return
Obx(()=>
indexController.perfectures.isNotEmpty && mapController != null ?

View File

@ -1,6 +1,5 @@
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);
@ -31,7 +30,7 @@ class _CatWidgetState extends State<CatWidget> {
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());
PopupMenuItem itm = PopupMenuItem(value: d['category'].toString(), child: Text(d['category'].toString()));
itms.add(itm);
}
return itms;

View File

@ -1,5 +1,4 @@
import 'package:flutter/material.dart';
import 'package:geojson/geojson.dart';
import 'package:get/get.dart';
import 'package:rogapp/model/destination.dart';
import 'package:rogapp/pages/destination/destination_controller.dart';
@ -7,8 +6,6 @@ import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/const.dart';
import 'package:rogapp/utils/database_helper.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
import 'package:sqflite/sqlite_api.dart';
import 'package:timeline_tile/timeline_tile.dart';
class DestinationWidget extends StatelessWidget {
@ -22,12 +19,12 @@ class DestinationWidget extends StatelessWidget {
Image getImage(int index){
if(destinationController.destinations[index].photos== null || destinationController.destinations[index].photos == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
print("------- image is ${destinationController.destinations[index].photos!}------");
String _photo = destinationController.destinations[index].photos!;
if(_photo.contains('http')){
String photo = destinationController.destinations[index].photos!;
if(photo.contains('http')){
return Image(image: NetworkImage(
destinationController.destinations[index].photos!),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
@ -36,10 +33,10 @@ class DestinationWidget extends StatelessWidget {
);
}
else {
String server_url = ConstValues.currentServer();
String serverUrl = ConstValues.currentServer();
//print("==== photo is ${server_url + '/media/compressed/' + destinationController.destinations[index].photos!} ===");
return Image(image: NetworkImage(
'${server_url}/media/compressed/' + destinationController.destinations[index].photos!),
'$serverUrl/media/compressed/${destinationController.destinations[index].photos!}'),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
},
@ -63,10 +60,10 @@ class DestinationWidget extends StatelessWidget {
// }
void doDelete() {
destinationController.currentSelectedDestinations.forEach((element) {
for (var element in destinationController.currentSelectedDestinations) {
destinationController.deleteDestination(element);
destinationController.resetRogaining();
});
}
// destinationController.destination_index_data.forEach((element) {
// //print(element["index"]);
// destinationController.deleteDestination(element["index"]);
@ -75,7 +72,7 @@ class DestinationWidget extends StatelessWidget {
}
void moveUp() {
Destination? d = null;
Destination? d;
for(Destination ad in destinationController.destinations){
if(ad.selected == true){
d = ad;
@ -89,7 +86,7 @@ class DestinationWidget extends StatelessWidget {
}
void moveDown() {
Destination? d = null;
Destination? d;
for(Destination ad in destinationController.destinations){
if(ad.selected == true){
d = ad;
@ -107,8 +104,8 @@ class DestinationWidget extends StatelessWidget {
title: "are_you_sure_want_to_delete_all".tr,
middleText: "all_added_destination_will_be_deleted".tr,
backgroundColor: Colors.blue.shade300,
titleStyle: TextStyle(color: Colors.white),
middleTextStyle: TextStyle(color: Colors.white),
titleStyle: const TextStyle(color: Colors.white),
middleTextStyle: const TextStyle(color: Colors.white),
textConfirm: "confirm".tr,
textCancel: "cancel".tr,
cancelTextColor: Colors.white,
@ -116,7 +113,7 @@ class DestinationWidget extends StatelessWidget {
buttonColor: Colors.white,
barrierDismissible: false,
radius: 10,
content: Column(
content: const Column(
children: [
],
),
@ -138,9 +135,9 @@ class DestinationWidget extends StatelessWidget {
// });
}
Future getIsLocationAvilable(int location_id) async {
Future getIsLocationAvilable(int locationId) async {
DatabaseHelper db = DatabaseHelper.instance;
return await db.isAlreadyAvailable(location_id);
return await db.isAlreadyAvailable(locationId);
}
@override
@ -164,8 +161,8 @@ class DestinationWidget extends StatelessWidget {
isFirst: index == 0 ? true : false,
indicatorStyle: IndicatorStyle(
indicator: CircleAvatar(
child: Text(destinationController.destinations[index].list_order.toString(), style: TextStyle(color: Colors.white),),
backgroundColor: Colors.red,
child: Text(destinationController.destinations[index].list_order.toString(), style: const TextStyle(color: Colors.white),),
),
),
key: Key(index.toString()),
@ -178,22 +175,20 @@ class DestinationWidget extends StatelessWidget {
onTap: () async {
{
Destination? fs = destinationController.destinations[index];
print("----fsf-----${index}");
if(fs != null){
if(indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear();
}
indexController.currentDestinationFeature.add(fs);
print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----");
//indexController.getAction();
showModalBottomSheet(context: context, isScrollControlled: true,
//builder:((context) => BottomSheetWidget())
builder:((context) => BottomSheetNew())
);
print("----fsf-----$index");
if(indexController.currentDestinationFeature.isNotEmpty) {
indexController.currentDestinationFeature.clear();
}
};
indexController.currentDestinationFeature.add(fs);
print("--- ndexController.currentDestinationFeature ----- ${ indexController.currentDestinationFeature[0].name} ----");
//indexController.getAction();
showModalBottomSheet(context: context, isScrollControlled: true,
//builder:((context) => BottomSheetWidget())
builder:((context) => BottomSheetNew())
);
}
},
onLongPress: (){
destinationController.toggleSelection(destinationController.destinations[index]);
@ -229,7 +224,7 @@ class DestinationWidget extends StatelessWidget {
color: Colors.grey.withOpacity(0.3),
spreadRadius: 5,
blurRadius: 3,
offset: Offset(0, 7), // changes position of shadow
offset: const Offset(0, 7), // changes position of shadow
),
],
),
@ -239,22 +234,22 @@ class DestinationWidget extends StatelessWidget {
mainAxisAlignment: MainAxisAlignment.center,
children: [
IconButton(
icon:Icon(Icons.delete_forever),
icon:const Icon(Icons.delete_forever),
//onPressed: (){doDelete();},
onPressed: clearall,
),
IconButton(
icon:Icon(Icons.cancel),
icon:const Icon(Icons.cancel),
//onPressed: (){doDelete();},
onPressed: destinationController.currentSelectedDestinations.length > 0 ? doDelete : null,
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? doDelete : null,
),
IconButton(
icon:Icon(Icons.move_up),
onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveUp : null,
icon:const Icon(Icons.move_up),
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveUp : null,
),
IconButton(
icon:Icon(Icons.move_down),
onPressed: destinationController.currentSelectedDestinations.length > 0 ? moveDown : null,
icon:const Icon(Icons.move_down),
onPressed: destinationController.currentSelectedDestinations.isNotEmpty ? moveDown : null,
),
// IconButton(
// icon:Icon(Icons.sync),

View File

@ -6,7 +6,6 @@ import 'package:rogapp/pages/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/const.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class ListWidget extends StatelessWidget {
ListWidget({ Key? key }) : super(key: key);
@ -16,16 +15,16 @@ class ListWidget extends StatelessWidget {
Image getImage(int index){
if(indexController.locations[0].collection[index].properties!["photos"] == null || indexController.locations[0].collection[index].properties!["photos"] == ""){
return Image(image: AssetImage('assets/images/empty_image.png'));
return const Image(image: AssetImage('assets/images/empty_image.png'));
}
else{
print("==== photo index is ${index} ===");
String server_url = ConstValues.currentServer();
print("==== photo index is $index ===");
String serverUrl = ConstValues.currentServer();
GeoJsonFeature<dynamic> gf = indexController.locations[0].collection[index];
String _photo = gf!.properties!["photos"];
String photo = gf.properties!["photos"];
return Image(
image: NetworkImage(
'${server_url}/media/compressed/' + _photo
'$serverUrl/media/compressed/$photo'
),
errorBuilder: (BuildContext context, Object exception, StackTrace? stackTrace) {
return Image.asset("assets/images/empty_image.png");
@ -35,7 +34,7 @@ class ListWidget extends StatelessWidget {
}
void changeCurrentFeature(GeoJsonFeature fs){
if(indexController.currentFeature.length > 0){
if(indexController.currentFeature.isNotEmpty){
indexController.currentFeature.clear();
}
indexController.currentFeature.add(fs);
@ -44,21 +43,21 @@ class ListWidget extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Obx(() =>
indexController.locations.length > 0 ?
indexController.locations.isNotEmpty ?
ListView.builder(
itemCount: indexController.locations[0].collection.length,
shrinkWrap: true,
itemBuilder: (_, index){
bool _is_found = false;
bool isFound = false;
for(Destination d in destinationController.destinations){
if(indexController.locations[0].collection[index].properties!['location_id'] == d.location_id){
_is_found = true;
isFound = true;
break;
}
}
return Card(
child: ListTile(
selected: _is_found,
selected: isFound,
selectedTileColor: Colors.yellow.shade200,
onTap: (){
@ -72,13 +71,13 @@ class ListWidget extends StatelessWidget {
);
},
leading: getImage(index),
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : Text(""),
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : Text(""),
trailing: indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : Text(""),
title: indexController.locations[0].collection[index].properties!['location_name'] != null ? Text(indexController.locations[0].collection[index].properties!['location_name'].toString()) : const Text(""),
subtitle: indexController.locations[0].collection[index].properties!['category'] != null ? Text(indexController.locations[0].collection[index].properties!['category']) : const Text(""),
trailing: indexController.locations[0].collection[index].properties!['sub_loc_id'] != null ? Text(indexController.locations[0].collection[index].properties!['sub_loc_id']) : const Text(""),
),
);
},
) : Container(width: 0, height: 0,),
) : const SizedBox(width: 0, height: 0,),
);
}
}

View File

@ -5,14 +5,12 @@ import 'package:flutter_map_location_marker/flutter_map_location_marker.dart';
import 'package:flutter_map_marker_cluster/flutter_map_marker_cluster.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/destination/destination_controller.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/utils/text_util.dart';
import 'package:rogapp/widgets/base_layer_widget.dart';
import 'package:rogapp/widgets/bottom_sheet_new.dart';
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
class MapWidget extends StatelessWidget {
@ -69,19 +67,19 @@ class MapWidget extends StatelessWidget {
child: Stack(
alignment: Alignment.center,
children: [
Icon(Icons.circle,size: 6.0,),
const Icon(Icons.circle,size: 6.0,),
i.properties!['cp'] == -1 ?
Transform.rotate(
alignment: Alignment.centerLeft,
origin: Offset.fromDirection(1, 26),
angle: 270 * pi / 180,
child: Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)):
child: const Icon(Icons.play_arrow_outlined, color: Colors.red, size: 70,)):
Container(color: Colors.transparent,),
],
)
),
),
Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
Container(color: Colors.white, child: Text(TextUtils.getDisplayTextFeture(i), style: const TextStyle(fontSize: 16, fontWeight: FontWeight.bold, color:Colors.red,))),
],
);
}
@ -91,12 +89,12 @@ class MapWidget extends StatelessWidget {
print("---------- rog mode is ${indexController.rog_mode.value.toString()}----------");
final PopupController _popupController = PopupController();
final PopupController popupController = PopupController();
return Stack(
children: [
Obx(() =>
indexController.is_loading == true ? Padding(
padding: const EdgeInsets.only(top: 60.0),
indexController.is_loading == true ? const Padding(
padding: EdgeInsets.only(top: 60.0),
child: CircularProgressIndicator(),
):
FlutterMap(
@ -110,7 +108,7 @@ class MapWidget extends StatelessWidget {
//print(DateTime.now().toString() + ' [MapEventMoveStart] START');
// do something
}
if (mapEvent is MapEventMoveEnd && indexController.currentUser. length <= 0) {
if (mapEvent is MapEventMoveEnd && indexController.currentUser.isEmpty) {
//print(DateTime.now().toString() + ' [MapEventMoveStart] END');
indexController.loadLocationsBound();
//indexController.rogMapController!.move(c.center, c.zoom);
@ -119,7 +117,7 @@ class MapWidget extends StatelessWidget {
},
//center: LatLng(37.15319600454702, 139.58765950528198),
bounds: indexController.currentBound.length > 0 ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
bounds: indexController.currentBound.isNotEmpty ? indexController.currentBound[0]: LatLngBounds.fromPoints([LatLng(35.03999881162295, 136.40587119778962), LatLng(36.642756778706904, 137.95226720406063)]),
zoom: 1,
interactiveFlags: InteractiveFlag.pinchZoom | InteractiveFlag.drag,
@ -127,11 +125,11 @@ class MapWidget extends StatelessWidget {
},
onTap: (_, __) =>
_popupController
popupController
.hideAllPopups(), // Hide popup when the map is tapped.
),
children: [
BaseLayer(),
const BaseLayer(),
CurrentLocationLayer(),
indexController.locations.isNotEmpty && indexController.locations[0].collection.isNotEmpty ?
MarkerLayer(

View File

@ -2,7 +2,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_map/flutter_map.dart';
import 'package:get/get.dart';
import 'package:rogapp/pages/index/index_controller.dart';
import 'package:rogapp/widgets/cat_widget.dart';
class PerfectureWidget extends StatefulWidget {
@ -41,8 +40,8 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
for (Map<String, dynamic> currency in widget.indexController.perfectures[0]) {
//print(currency["id"].toString());
var newDropdown = DropdownMenuItem(
child: Text(currency["adm1_ja"].toString()),
value: currency["id"].toString(),
child: Text(currency["adm1_ja"].toString()),
);
dropDownItems.add(newDropdown);
@ -57,8 +56,8 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
for (Map<String, dynamic> currency in widget.indexController.subPerfs[0]) {
var newDropdown = DropdownMenuItem(
child: Text(currency["adm2_ja"].toString()),
value: currency["id"].toString(),
child: Text(currency["adm2_ja"].toString()),
);
dropDownItems.add(newDropdown);
}
@ -72,8 +71,8 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
for (Map<String, dynamic> currency in widget.indexController.areas[0]) {
var newDropdown = DropdownMenuItem(
child: Text(currency["area_nm"].toString()),
value: currency["id"].toString(),
child: Text(currency["area_nm"].toString()),
);
dropDownItems.add(newDropdown);
@ -85,8 +84,8 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
for (Map<String, dynamic> currency in widget.indexController.customAreas[0]) {
var newDropdown = DropdownMenuItem(
child: Text(currency["event_name"].toString()),
value: currency["event_name"].toString(),
child: Text(currency["event_name"].toString()),
);
dropDownItems.add(newDropdown);
@ -105,7 +104,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
//print("--------cats ------############### ${widget.indexController.cats.toString()} -------------");
for(dynamic d in widget.indexController.cats){
//print("-------- ddd ------############### ${d} --------dddd-----");
var newDropdown = DropdownMenuItem(child: Text(d['category'].toString()), value: d['category'].toString());
var newDropdown = DropdownMenuItem(value: d['category'].toString(), child: Text(d['category'].toString()));
//print("--------cats ------############### ${d['category'].toString()} -------------");
dropDownItems.add(newDropdown);
}
@ -166,12 +165,10 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
}
setState(() {
widget.indexController.locations.clear();
if(newValue != null){
widget.indexController.is_loading.value = true;
widget.indexController.areaDropdownValue = newValue;
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
}
});
widget.indexController.is_loading.value = true;
widget.indexController.areaDropdownValue = newValue;
widget.indexController.populateSubPerForArea(newValue, widget.mapController);
});
},
items: getCustomArea(),
): const Text(""),
@ -203,7 +200,7 @@ class _PerfectureWidgetState extends State<PerfectureWidget> {
) :
const Text(""),
//CatWidget(indexController: widget.indexController,),
widget.indexController.cats.length > 0 ?
widget.indexController.cats.isNotEmpty ?
DropdownButton<String>(
value: widget.indexController.getCatText(),
icon: const Icon(Icons.arrow_downward),