update for permission and destination ordering
This commit is contained in:
@ -643,6 +643,25 @@ class DestinationController extends GetxController {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void toggleSelection(Destination dest) async {
|
||||||
|
DatabaseHelper db = DatabaseHelper.instance;
|
||||||
|
await db.toggleSelecttion(dest);
|
||||||
|
destinations.clear();
|
||||||
|
db.getDestinations().then((value){
|
||||||
|
destinationCount.value = 0;
|
||||||
|
currentSelectedDestinations.clear();
|
||||||
|
for(Destination d in value){
|
||||||
|
//print("------ destination controller populating destination-------- ${d.checkedin}-------- :::::");
|
||||||
|
//print("-----populated----- ${d.toMap()}");
|
||||||
|
if(d.selected!){
|
||||||
|
currentSelectedDestinations.add(d);
|
||||||
|
}
|
||||||
|
destinations.add(d);
|
||||||
|
}
|
||||||
|
destinationCount.value = destinations.length;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void PopulateDestinations(){
|
void PopulateDestinations(){
|
||||||
print("--------- destination controller populsting destinations ----------- ::::::");
|
print("--------- destination controller populsting destinations ----------- ::::::");
|
||||||
|
|
||||||
|
|||||||
@ -12,6 +12,7 @@ class PermissionHandlerScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
||||||
|
|
||||||
|
|
||||||
Future<void> _showMyDialog() async {
|
Future<void> _showMyDialog() async {
|
||||||
return showDialog<void>(
|
return showDialog<void>(
|
||||||
context: context,
|
context: context,
|
||||||
@ -45,10 +46,15 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
|||||||
void initState() {
|
void initState() {
|
||||||
// TODO: implement initState
|
// TODO: implement initState
|
||||||
super.initState();
|
super.initState();
|
||||||
permissionServiceCall();
|
|
||||||
|
//permissionServiceCall();
|
||||||
}
|
}
|
||||||
|
|
||||||
permissionServiceCall() async {
|
Future<PermissionStatus> checkLocationPermission() async {
|
||||||
|
return await Permission.location.status;
|
||||||
|
}
|
||||||
|
|
||||||
|
permissionServiceCall() async {
|
||||||
await permissionServices().then(
|
await permissionServices().then(
|
||||||
(value) {
|
(value) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
@ -106,11 +112,45 @@ class _PermissionHandlerScreenState extends State<PermissionHandlerScreen> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
var status = Permission.location.status.then((value){
|
||||||
color: Colors.white,
|
if(value.isGranted == false){
|
||||||
child: Center(
|
Future.delayed(Duration.zero, () => showAlert(context));
|
||||||
child: Text(""),
|
}
|
||||||
),
|
else {
|
||||||
|
Get.toNamed(AppPages.TRAVEL);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return Scaffold(
|
||||||
|
body: Container(
|
||||||
|
child: Text(""),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void showAlert(BuildContext context) {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (_) => AlertDialog(
|
||||||
|
title: const Text('ロケーション許可'),
|
||||||
|
content: SingleChildScrollView(
|
||||||
|
child: ListBody(
|
||||||
|
children: const <Widget>[
|
||||||
|
Text( 'このアプリでは、位置情報の収集を行います。'),
|
||||||
|
Text('岐阜ナビアプリではチェックポイントの自動チェックインの機能を可能にするために、現在地のデータが収集されます。アプリを閉じている時や、使用していないときにも収集されます。位置情報は、個人を特定できない統計的な情報として、ユーザーの個人情報とは一切結びつかない形で送信されます。お知らせの配信、位置情報の利用を許可しない場合は、この後表示されるダイアログで「許可しない」を選択してください。'),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
actions: <Widget>[
|
||||||
|
TextButton(
|
||||||
|
child: const Text('わかった'),
|
||||||
|
onPressed: () {
|
||||||
|
permissionServiceCall();
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -98,6 +98,35 @@ class DatabaseHelper{
|
|||||||
return roglist;
|
return roglist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future clearSelection() async {
|
||||||
|
Database db = await instance.database;
|
||||||
|
Map<String, dynamic> row_clear = {
|
||||||
|
"selected": false
|
||||||
|
};
|
||||||
|
return await db.update(
|
||||||
|
"destination",
|
||||||
|
row_clear
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
Future<int> toggleSelecttion(Destination dest) async {
|
||||||
|
Database db = await instance.database;
|
||||||
|
|
||||||
|
bool val = !dest.selected!;
|
||||||
|
Map<String, dynamic> row_target = {
|
||||||
|
"selected": val
|
||||||
|
};
|
||||||
|
|
||||||
|
await clearSelection();
|
||||||
|
|
||||||
|
return await db.update(
|
||||||
|
"destination",
|
||||||
|
row_target,
|
||||||
|
where: 'location_id = ?',
|
||||||
|
whereArgs: [dest.location_id!]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
Future<int> deleteRogaining(int id) async {
|
Future<int> deleteRogaining(int id) async {
|
||||||
Database db = await instance.database;
|
Database db = await instance.database;
|
||||||
var rog = await db.delete('rog', where: "id = ${id}");
|
var rog = await db.delete('rog', where: "id = ${id}");
|
||||||
|
|||||||
@ -8,6 +8,7 @@ import 'package:rogapp/utils/const.dart';
|
|||||||
import 'package:rogapp/utils/database_helper.dart';
|
import 'package:rogapp/utils/database_helper.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
import 'package:rogapp/widgets/bottom_sheet_new.dart';
|
||||||
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
import 'package:rogapp/widgets/bottom_sheet_widget.dart';
|
||||||
|
import 'package:sqflite/sqlite_api.dart';
|
||||||
import 'package:timeline_tile/timeline_tile.dart';
|
import 'package:timeline_tile/timeline_tile.dart';
|
||||||
|
|
||||||
class DestinationWidget extends StatelessWidget {
|
class DestinationWidget extends StatelessWidget {
|
||||||
@ -176,7 +177,7 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
onTap: () async {
|
onTap: () async {
|
||||||
{
|
{
|
||||||
Destination? fs = destinationController.destinations[index];
|
Destination? fs = destinationController.destinations[index];
|
||||||
print("----fsf-----${fs.location_id}");
|
print("----fsf-----${index}");
|
||||||
if(fs != null){
|
if(fs != null){
|
||||||
|
|
||||||
if(indexController.currentDestinationFeature.isNotEmpty) {
|
if(indexController.currentDestinationFeature.isNotEmpty) {
|
||||||
@ -194,37 +195,7 @@ class DestinationWidget extends StatelessWidget {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
onLongPress: (){
|
onLongPress: (){
|
||||||
|
destinationController.toggleSelection(destinationController.destinations[index]);
|
||||||
for(Destination d in destinationController.destinations){
|
|
||||||
if(destinationController.currentSelectedDestinations.length > 0){
|
|
||||||
if(destinationController.currentSelectedDestinations[0].location_id == destinationController.destinations[index].location_id){
|
|
||||||
destinationController.currentSelectedDestinations.clear();
|
|
||||||
print("---- found ----");
|
|
||||||
destinationController.PopulateDestinations();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
destinationController.currentSelectedDestinations.clear();
|
|
||||||
destinationController.currentSelectedDestinations.add(destinationController.destinations[index]);
|
|
||||||
|
|
||||||
// Destination? match_element = null;
|
|
||||||
// destinationController.currentSelectedDestinations.forEach((element) {
|
|
||||||
// if(element.location_id == destinationController.destinations[index].location_id){
|
|
||||||
// match_element = element;
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
|
|
||||||
// if(match_element != null){
|
|
||||||
// destinationController.currentSelectedDestinations.remove(destinationController.destinations[index]);
|
|
||||||
// }
|
|
||||||
// //destinationController.currentSelectedDestinations.clear();
|
|
||||||
// destinationController.currentSelectedDestinations.add(destinationController.destinations[index]);
|
|
||||||
|
|
||||||
destinationController.PopulateDestinations();
|
|
||||||
|
|
||||||
},
|
},
|
||||||
selectedTileColor: Colors.amberAccent,
|
selectedTileColor: Colors.amberAccent,
|
||||||
selected:destinationController.destinations[index].selected!,
|
selected:destinationController.destinations[index].selected!,
|
||||||
|
|||||||
@ -15,7 +15,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
|
||||||
# Read more about iOS versioning at
|
# Read more about iOS versioning at
|
||||||
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
|
||||||
version: 1.0.2+2
|
version: 1.0.3+3
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.16.0 <3.0.0"
|
sdk: ">=2.16.0 <3.0.0"
|
||||||
|
|||||||
Reference in New Issue
Block a user