8-15/3
This commit is contained in:
@@ -1,24 +1,28 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/models/db_sql.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../widgets/elevated_btn.dart';
|
||||
import 'form_search_places.dart';
|
||||
|
||||
class PickerAnimtionContainer extends StatelessWidget {
|
||||
PickerAnimtionContainer({
|
||||
class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
PickerAnimtionContainerFormPlaces({
|
||||
super.key,
|
||||
});
|
||||
final controller = MapController();
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
// DbSql sql = DbSql.instance;
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 60,
|
||||
right: 5,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
height: controller.places.isNotEmpty
|
||||
@@ -52,8 +56,10 @@ class PickerAnimtionContainer extends StatelessWidget {
|
||||
),
|
||||
controller.isPickerShown
|
||||
? InkWell(
|
||||
onTapDown: (details) =>
|
||||
controller.changePickerShown(),
|
||||
onTapDown: (details) {
|
||||
controller.changePickerShown();
|
||||
controller.changeHeight();
|
||||
},
|
||||
child: Container(
|
||||
height: 4,
|
||||
width: Get.width * .3,
|
||||
@@ -71,16 +77,120 @@ class PickerAnimtionContainer extends StatelessWidget {
|
||||
onTap: () {},
|
||||
child: formSearchPlaces(),
|
||||
)
|
||||
: TextButton(
|
||||
onPressed: () {
|
||||
controller.changePickerShown();
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
return Text(
|
||||
"Pick your destination from Map".tr,
|
||||
style: AppStyle.subtitle,
|
||||
);
|
||||
}),
|
||||
: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
children: [
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
controller.changePickerShown();
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
return Text(
|
||||
"Pick your destination from Map".tr,
|
||||
style: AppStyle.subtitle,
|
||||
);
|
||||
}),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () 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,
|
||||
),
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
return Text(
|
||||
"Go To Favorite Places".tr,
|
||||
style: AppStyle.subtitle,
|
||||
);
|
||||
}),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
),
|
||||
@@ -95,6 +205,9 @@ class PickerAnimtionContainer extends StatelessWidget {
|
||||
controller.changePickerShown();
|
||||
controller.changeButtomSheetShown();
|
||||
controller.bottomSheet();
|
||||
// await sql
|
||||
// .getAllData(TableName.placesFavorite)
|
||||
// .then((value) => print(value));
|
||||
},
|
||||
),
|
||||
if (controller.isPickerShown && controller.places.isEmpty)
|
||||
|
||||
Reference in New Issue
Block a user