This commit is contained in:
Hamza-Ayed
2023-08-18 22:59:16 +03:00
parent 6635a46933
commit 6a3865a3d1
12 changed files with 657 additions and 141 deletions

View File

@@ -89,7 +89,10 @@ class MainBottomMenuMap extends StatelessWidget {
: const SizedBox(),
controller.isMainBottomMenuMap
? const SizedBox()
: Text('From : Current Location',style: AppStyle.subtitle,),
: Text(
'From : Current Location',
style: AppStyle.subtitle,
),
controller.isMainBottomMenuMap
? const SizedBox()
: formSearchPlaces()
@@ -101,96 +104,102 @@ class MainBottomMenuMap extends StatelessWidget {
}
class FavioratePlacesDialogu extends StatelessWidget {
FavioratePlacesDialogu({
const FavioratePlacesDialogu({
super.key,
});
final controller = MapController();
@override
Widget build(BuildContext context) {
return DefaultTextStyle(
style: AppStyle.title,
child: Center(
child: AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText('Favorite Places'.tr),
ScaleAnimatedText(
'Favorite Places'.tr,
),
TyperAnimatedText(
'Favorite Places'.tr,
),
],
isRepeatingAnimation: true,
onTap: () async {
List favoritePlaces =
await sql.getAllData(TableName.placesFavorite);
print(favoritePlaces);
Get.defaultDialog(
title: 'Favorite Places'.tr,
content: SizedBox(
width: Get.width * .8,
height: 300,
child: favoritePlaces.isEmpty
? Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.hourglass_empty_rounded,
size: 99,
color: AppColor.primaryColor,
),
Text(
'You Dont Have Any places yet !'.tr,
style: AppStyle.title,
),
],
),
)
: ListView.builder(
itemCount: favoritePlaces.length,
itemBuilder: (BuildContext context, int index) {
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: () async {
await controller.getMap(
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
);
controller.changePickerShown();
controller.changeButtomSheetShown();
controller.bottomSheet();
Get.back();
},
child: Text(
favoritePlaces[index]['name'],
style: AppStyle.title,
Get.put(MapController());
return GetBuilder<MapController>(
builder: (controller) => DefaultTextStyle(
style: AppStyle.title,
child: Center(
child: AnimatedTextKit(
animatedTexts: [
TypewriterAnimatedText('Favorite Places'.tr),
ScaleAnimatedText(
'Favorite Places'.tr,
),
TyperAnimatedText(
'Favorite Places'.tr,
),
],
isRepeatingAnimation: true,
onTap: () async {
List favoritePlaces =
await sql.getAllData(TableName.placesFavorite);
print(favoritePlaces);
Get.defaultDialog(
title: 'Favorite Places'.tr,
content: SizedBox(
width: Get.width * .8,
height: 300,
child: favoritePlaces.isEmpty
? Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Icon(
Icons.hourglass_empty_rounded,
size: 99,
color: AppColor.primaryColor,
),
Text(
'You Dont Have Any places yet !'.tr,
style: AppStyle.title,
),
],
),
),
IconButton(
onPressed: () async {
await sql.deleteData(TableName.placesFavorite,
favoritePlaces[index]['id']);
Get.back();
Get.snackbar('Deleted ',
'You are Delete ${favoritePlaces[index]['name']} from your list',
backgroundColor: AppColor.accentColor);
)
: ListView.builder(
itemCount: favoritePlaces.length,
itemBuilder: (BuildContext context, int index) {
return Row(
mainAxisAlignment:
MainAxisAlignment.spaceBetween,
children: [
TextButton(
onPressed: () async {
await controller.getMap(
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
'${favoritePlaces[index]['latitude']},${favoritePlaces[index]['longitude']}',
);
controller.changePickerShown();
controller.changeButtomSheetShown();
controller.bottomSheet();
Get.back();
},
child: Text(
favoritePlaces[index]['name'],
style: AppStyle.title,
),
),
IconButton(
onPressed: () async {
await sql.deleteData(
TableName.placesFavorite,
favoritePlaces[index]['id']);
Get.back();
Get.snackbar('Deleted ',
'You are Delete ${favoritePlaces[index]['name']} from your list',
backgroundColor:
AppColor.accentColor);
},
icon:
const Icon(Icons.favorite_outlined),
),
],
);
},
icon: const Icon(Icons.favorite_outlined),
),
],
);
},
),
cancel: MyElevatedButton(
title: 'Back'.tr, onPressed: () => Get.back()),
);
},
),
),
cancel: MyElevatedButton(
title: 'Back'.tr, onPressed: () => Get.back()),
);
},
),
),
);
));
}
}