Files
tripz/lib/views/home/map_widget.dart/picker_animation_container.dart
Hamza-Ayed f0c90127fe 8-10
2023-08-10 18:01:47 +03:00

109 lines
4.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../constant/colors.dart';
import '../../../constant/style.dart';
import '../../../controller/home/map_page_controller.dart';
import '../../widgets/elevated_btn.dart';
import 'buttom_sheet_map_show.dart';
import 'form_search_places.dart';
class PickerAnimtionContainer extends StatelessWidget {
PickerAnimtionContainer({
super.key,
});
final controller = MapController();
@override
Widget build(BuildContext context) {
return GetBuilder<MapController>(
builder: (controller) => Positioned(
bottom: 0,
left: 0,
right: 60,
child: AnimatedContainer(
duration: const Duration(milliseconds: 300),
height: controller.places.isNotEmpty
? 300
: controller.heightPickerContainer,
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.end,
children: [
controller.isPickerShown
? const SizedBox()
: Text(
'Hi, Where to ',
style: AppStyle.title,
),
Column(
children: [
const SizedBox(
height: 5,
),
controller.isPickerShown
? InkWell(
onTapDown: (details) =>
controller.changePickerShown(),
child: Container(
height: 4,
width: Get.width * .3,
decoration: BoxDecoration(
color: AppColor.accentColor,
borderRadius: BorderRadius.circular(10),
border: Border.all(
color: AppColor.accentColor,
)),
),
)
: const SizedBox(),
controller.isPickerShown
? InkWell(
onTap: () {},
child: formSearchPlaces(),
)
: TextButton(
onPressed: () {
controller.changePickerShown();
},
child: Builder(builder: (context) {
return Text(
"Pick your destination from Map".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();
},
),
if (controller.isPickerShown && controller.places.isEmpty)
const SizedBox(),
],
),
),
));
}
}