[英]how to add current location like in picture in flutter using geo location
https://github.com/kardotinambunan12/tinambunan/blob/master/Screenshot%20from%202021-07-08%2017-03-51.png . https://github.com/kardotinambunan12/tinambunan/blob/master/Screenshot%20from%202021-07-08%2017-03-51.png 。
if I click the gps_fixed icon then my location will be displayed in the textfield.如果我单击 gps_fixed 图标,则我的位置将显示在文本字段中。
I'm still writing code for the template.我仍在为模板编写代码。 but the logic part I don't understand.
但逻辑部分我不明白。
template:模板:
Padding(
padding: const EdgeInsets.all(14.0),
child: TextField(
decoration: InputDecoration(
hintText: "sampel",
fillColor: whiteColor,
// enabled:false,
prefixIcon: Icon(
Icons.add_location_outlined,
color: primaryColor,
),
suffixIcon: IconButton(
onPressed: () {},
icon: Icon(Icons.gps_fixed),
color: primaryColor,
),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.circular(25.0),
borderSide: BorderSide(color: primaryColor),
),
),
),
),
SizedBox(
height: 2,
),
Padding(
padding: const EdgeInsets.all(25.0),
child: CustomRaiseButton(
"Clock In",
color: primaryColor,
textColor: whiteColor,
),
)
You can get the location name from its coordinate using Geocoding API which is well implemented by a plugin called geocoding您可以使用Geocoding API从其坐标中获取位置名称,该API由名为geocoding的插件很好地实现
it is as simple as就这么简单
import 'package:geocoding/geocoding.dart';
List<Placemark> placemarks = await placemarkFromCoordinates(52.2165157, 6.9437819);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.