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'; GetBuilder formSearchPlaces() { return GetBuilder( 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 = []; Get.back(); controller.bottomSheet(); // Get.back(); }, ); }, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 10), child: Column( children: [ Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ Image.network( res['icon'], width: 30, ), 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], ), ), ), controller: controller.placeController, onChanged: (value) { if (controller.placeController.text.length > 5) { controller.getPlaces(); controller.changeHeight(); } }, // onEditingComplete: () => controller.changeHeight(), ), ), ) ], ), )); }