8-17/1
This commit is contained in:
@@ -1,147 +1,144 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/table_names.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/style.dart';
|
||||
import '../../../controller/home/map_page_controller.dart';
|
||||
import '../../../main.dart';
|
||||
import '../../../models/db_sql.dart';
|
||||
|
||||
GetBuilder<MapController> formSearchPlaces() {
|
||||
// DbSql sql = DbSql.instance;
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => Positioned(
|
||||
top: 5,
|
||||
// width: Get.width * .8,
|
||||
left: 50,
|
||||
right: 0,
|
||||
child: Column(
|
||||
children: [
|
||||
Container(
|
||||
height: controller.places.isNotEmpty ? controller.height : 0,
|
||||
color: AppColor.secondaryColor,
|
||||
child: ListView.builder(
|
||||
itemCount: controller.places.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var res = controller.places[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
controller.changeHeight();
|
||||
Get.defaultDialog(
|
||||
title: 'Are You sure to ride to ${res['name']}',
|
||||
middleText: '',
|
||||
onConfirm: () {
|
||||
controller.clearpolyline();
|
||||
controller.getMap(
|
||||
'${controller.mylocation.latitude.toString()},${controller.mylocation.longitude.toString()}',
|
||||
"${res['geometry']['location']['lat']},${res['geometry']['location']['lng']}");
|
||||
controller.places = [];
|
||||
controller.placeController.clear();
|
||||
Get.back();
|
||||
controller.bottomSheet();
|
||||
// Get.back();
|
||||
},
|
||||
);
|
||||
builder: (controller) => Column(
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Container(
|
||||
decoration:
|
||||
const BoxDecoration(color: AppColor.secondaryColor),
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: const Icon(Icons.search),
|
||||
hintText: 'Type here Place',
|
||||
hintMaxLines: 1,
|
||||
prefixIcon: IconButton(
|
||||
onPressed: () {
|
||||
controller.placeController.clear();
|
||||
controller.clearPlaces();
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Image.network(
|
||||
res['icon'],
|
||||
width: 20,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await sql.insertData({
|
||||
'latitude': res['geometry']
|
||||
['location']['lat'],
|
||||
'longitude': res['geometry']
|
||||
['location']['lng'],
|
||||
'name': res['name'].toString(),
|
||||
'rate': res['rating'].toString(),
|
||||
}, TableName.placesFavorite);
|
||||
},
|
||||
icon: const Icon(Icons.favorite_border),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
res['name'].toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
res['vicinity'].toString(),
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'rate',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
res['rating'].toString(),
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
thickness: 1,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Container(
|
||||
decoration:
|
||||
const BoxDecoration(color: AppColor.secondaryColor),
|
||||
child: TextField(
|
||||
decoration: InputDecoration(
|
||||
suffixIcon: const Icon(Icons.search),
|
||||
hintText: 'Type here Place',
|
||||
hintMaxLines: 1,
|
||||
prefixIcon: IconButton(
|
||||
onPressed: () {
|
||||
controller.placeController.clear();
|
||||
controller.clearPlaces();
|
||||
},
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
color: Colors.red[300],
|
||||
),
|
||||
icon: Icon(
|
||||
Icons.clear,
|
||||
color: Colors.red[300],
|
||||
),
|
||||
),
|
||||
controller: controller.placeController,
|
||||
onChanged: (value) {
|
||||
if (controller.placeController.text.length > 5) {
|
||||
controller.getPlaces();
|
||||
controller.changeHeight();
|
||||
}
|
||||
},
|
||||
// onEditingComplete: () => controller.changeHeight(),
|
||||
),
|
||||
controller: controller.placeController,
|
||||
onChanged: (value) {
|
||||
if (controller.placeController.text.length > 5) {
|
||||
controller.getPlaces();
|
||||
controller.changeHeight();
|
||||
}
|
||||
},
|
||||
// onEditingComplete: () => controller.changeHeight(),
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Container(
|
||||
height: controller.places.isNotEmpty ? controller.height : 0,
|
||||
color: AppColor.secondaryColor,
|
||||
child: ListView.builder(
|
||||
itemCount: controller.places.length,
|
||||
itemBuilder: (BuildContext context, int index) {
|
||||
var res = controller.places[index];
|
||||
return InkWell(
|
||||
onTap: () {
|
||||
controller.changeHeight();
|
||||
Get.defaultDialog(
|
||||
title: 'Are You sure to ride to ${res['name']}',
|
||||
middleText: '',
|
||||
confirm: MyElevatedButton(
|
||||
title: 'Confirm'.tr,
|
||||
onPressed: () {
|
||||
controller.clearpolyline();
|
||||
controller.getMap(
|
||||
'${controller.mylocation.latitude.toString()},${controller.mylocation.longitude.toString()}',
|
||||
"${res['geometry']['location']['lat']},${res['geometry']['location']['lng']}");
|
||||
controller.places = [];
|
||||
controller.placeController.clear();
|
||||
|
||||
Get.back();
|
||||
controller.changeButtomSheetShown();
|
||||
controller.bottomSheet();
|
||||
controller.changeMainBottomMenuMap();
|
||||
}),
|
||||
);
|
||||
},
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 10),
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
Column(
|
||||
children: [
|
||||
Image.network(
|
||||
res['icon'],
|
||||
width: 20,
|
||||
),
|
||||
IconButton(
|
||||
onPressed: () async {
|
||||
await sql.insertData({
|
||||
'latitude': res['geometry']
|
||||
['location']['lat'],
|
||||
'longitude': res['geometry']
|
||||
['location']['lng'],
|
||||
'name': res['name'].toString(),
|
||||
'rate': res['rating'].toString(),
|
||||
}, TableName.placesFavorite);
|
||||
},
|
||||
icon: const Icon(Icons.favorite_border),
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
res['name'].toString(),
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Text(
|
||||
res['vicinity'].toString(),
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Text(
|
||||
'rate',
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
Text(
|
||||
res['rating'].toString(),
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
const Divider(
|
||||
thickness: 1,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
)
|
||||
],
|
||||
));
|
||||
}
|
||||
|
||||
196
lib/views/home/map_widget.dart/main_bottom_Menu_map.dart
Normal file
196
lib/views/home/map_widget.dart/main_bottom_Menu_map.dart
Normal file
@@ -0,0 +1,196 @@
|
||||
import 'package:animated_text_kit/animated_text_kit.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:get/get.dart';
|
||||
import 'package:ride/constant/box_name.dart';
|
||||
import 'package:ride/constant/style.dart';
|
||||
import 'package:ride/controller/home/map_page_controller.dart';
|
||||
import 'package:ride/main.dart';
|
||||
import 'package:ride/views/home/map_widget.dart/form_search_places.dart';
|
||||
import 'package:ride/views/widgets/elevated_btn.dart';
|
||||
|
||||
import '../../../constant/colors.dart';
|
||||
import '../../../constant/table_names.dart';
|
||||
|
||||
class MainBottomMenuMap extends StatelessWidget {
|
||||
const MainBottomMenuMap({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
Get.put(MapController());
|
||||
return GetBuilder<MapController>(
|
||||
builder: (controller) => Positioned(
|
||||
bottom: 3,
|
||||
left: 5,
|
||||
right: 5,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 400),
|
||||
height: controller.mainBottomMenuMap,
|
||||
decoration: const BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor, offset: Offset(2, 2)),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor, offset: Offset(-2, -2))
|
||||
],
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.only(
|
||||
topLeft: Radius.circular(15),
|
||||
topRight: Radius.circular(15),
|
||||
)),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15),
|
||||
child: Container(
|
||||
width: Get.width * .8,
|
||||
height: Get.height * .1,
|
||||
decoration: const BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
blurRadius: 5,
|
||||
offset: Offset(2, 4)),
|
||||
BoxShadow(
|
||||
color: AppColor.accentColor,
|
||||
blurRadius: 5,
|
||||
offset: Offset(-2, -2))
|
||||
],
|
||||
color: AppColor.secondaryColor,
|
||||
borderRadius: BorderRadius.all(
|
||||
Radius.elliptical(15, 30),
|
||||
),
|
||||
),
|
||||
child: DefaultTextStyle(
|
||||
style: AppStyle.title,
|
||||
child: Center(
|
||||
child: AnimatedTextKit(
|
||||
animatedTexts: [
|
||||
ScaleAnimatedText(
|
||||
'Where to ${box.read(BoxName.name)}'),
|
||||
WavyAnimatedText(
|
||||
'Where to ${box.read(BoxName.name)}'),
|
||||
FlickerAnimatedText(
|
||||
'Where to ${box.read(BoxName.name)}'),
|
||||
WavyAnimatedText(
|
||||
'Where to ${box.read(BoxName.name)}'),
|
||||
],
|
||||
isRepeatingAnimation: true,
|
||||
onTap: () {
|
||||
print("Tap Event");
|
||||
controller.changeMainBottomMenuMap();
|
||||
},
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
controller.isMainBottomMenuMap
|
||||
? FavioratePlacesDialogu()
|
||||
: const SizedBox(),
|
||||
controller.isMainBottomMenuMap
|
||||
? const SizedBox()
|
||||
: Text('From : Current Location',style: AppStyle.subtitle,),
|
||||
controller.isMainBottomMenuMap
|
||||
? const SizedBox()
|
||||
: formSearchPlaces()
|
||||
],
|
||||
),
|
||||
),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
class FavioratePlacesDialogu extends StatelessWidget {
|
||||
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,
|
||||
),
|
||||
),
|
||||
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),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
cancel: MyElevatedButton(
|
||||
title: 'Back'.tr, onPressed: () => Get.back()),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -25,9 +25,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
right: 5,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
height: controller.places.isNotEmpty
|
||||
? 300
|
||||
: controller.heightPickerContainer,
|
||||
height: controller.heightPickerContainer,
|
||||
decoration: const BoxDecoration(
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
@@ -41,7 +39,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
topRight: Radius.circular(15),
|
||||
)),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.end,
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
controller.isPickerShown
|
||||
? const SizedBox()
|
||||
@@ -50,6 +48,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
style: AppStyle.title,
|
||||
),
|
||||
Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: [
|
||||
const SizedBox(
|
||||
height: 5,
|
||||
@@ -61,7 +60,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
controller.changeHeight();
|
||||
},
|
||||
child: Container(
|
||||
height: 4,
|
||||
height: 7,
|
||||
width: Get.width * .3,
|
||||
decoration: BoxDecoration(
|
||||
color: AppColor.accentColor,
|
||||
@@ -76,7 +75,7 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
? InkWell(
|
||||
onTap: () {},
|
||||
child: formSearchPlaces(),
|
||||
)
|
||||
)
|
||||
: Row(
|
||||
mainAxisAlignment:
|
||||
MainAxisAlignment.spaceEvenly,
|
||||
@@ -85,12 +84,10 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
onPressed: () {
|
||||
controller.changePickerShown();
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
return Text(
|
||||
"Pick your destination from Map".tr,
|
||||
style: AppStyle.subtitle,
|
||||
);
|
||||
}),
|
||||
child: Text(
|
||||
"Pick your destination from Map".tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
TextButton(
|
||||
onPressed: () async {
|
||||
@@ -181,37 +178,38 @@ class PickerAnimtionContainerFormPlaces extends StatelessWidget {
|
||||
},
|
||||
),
|
||||
),
|
||||
onCancel: () {},
|
||||
);
|
||||
},
|
||||
child: Builder(builder: (context) {
|
||||
return Text(
|
||||
"Go To Favorite Places".tr,
|
||||
style: AppStyle.subtitle,
|
||||
);
|
||||
}),
|
||||
child: Text(
|
||||
"Go To Favorite Places".tr,
|
||||
style: AppStyle.subtitle,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
),
|
||||
if (controller.isPickerShown &&
|
||||
controller.places.isEmpty)
|
||||
MyElevatedButton(
|
||||
title: 'Go to this Target',
|
||||
onPressed: () async {
|
||||
await controller.getMap(
|
||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||
'${controller.newMylocation.latitude},${controller.newMylocation.longitude}',
|
||||
);
|
||||
controller.changePickerShown();
|
||||
controller.changeButtomSheetShown();
|
||||
controller.bottomSheet();
|
||||
// await sql
|
||||
// .getAllData(TableName.placesFavorite)
|
||||
// .then((value) => print(value));
|
||||
},
|
||||
),
|
||||
if (controller.isPickerShown &&
|
||||
controller.places.isEmpty)
|
||||
const SizedBox(),
|
||||
],
|
||||
),
|
||||
if (controller.isPickerShown && controller.places.isEmpty)
|
||||
MyElevatedButton(
|
||||
title: 'Go to this Target',
|
||||
onPressed: () async {
|
||||
await controller.getMap(
|
||||
'${controller.mylocation.latitude},${controller.mylocation.longitude}',
|
||||
'${controller.newMylocation.latitude},${controller.newMylocation.longitude}',
|
||||
);
|
||||
controller.changePickerShown();
|
||||
controller.changeButtomSheetShown();
|
||||
controller.bottomSheet();
|
||||
// await sql
|
||||
// .getAllData(TableName.placesFavorite)
|
||||
// .then((value) => print(value));
|
||||
},
|
||||
),
|
||||
if (controller.isPickerShown && controller.places.isEmpty)
|
||||
const SizedBox(),
|
||||
],
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user