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,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),