在Press上更改Flutter Map标记中的模式底部工作表的内容

时间:2020-05-23 16:45:57

标签: flutter dart mapbox

我是Flutter / Dart的新手,正在玩我的第一个应用程序,因此这可能是一个简单的问题,需要解决... 我正在将Flutter Map与MapBox一起使用,以在屏幕上显示许多标记,然后按,它们像这样打开modalBottomSheet ...

MarkerLayerOptions(
        markers: [
          Marker(
            height: 40.0,
            width: 40.0,
            point: LatLng(40.297428, -83.067546),
            builder: (context) => MarkerBottomSheet()

我将“标记底表”设置为从单独的列表(即图像,标题,文本和带有url的按钮)返回数据。

Widget build(BuildContext context) {
return Container(
  child: IconButton(
    icon: Icon(FontAwesomeIcons.mapMarkerAlt),
    color: Color(0xff000000),
    iconSize: 15.0,
    onPressed: () {
      showModalBottomSheetCustom(
          context: context,
          builder: (builder) {
            return SingleChildScrollView(
              child: Container(
                color: Colors.black,
                child: Padding(
                  padding: const EdgeInsets.all(12.0),
                  child: Column(
                    children: <Widget>[
                      Image(
                        image:
                        AssetImage(
                          markerBank[markerID].mPhoto,
                        ),
                        width: double.infinity,
                      ),
                      Text(
                      markerBank[markerID].mTitle,
                          style: kModalTextTitle
                      ),
                      SizedBox(
                        height: 16.0,
                      ),
                      Text(
                        markerBank[markerID].mBottom,
                          style: kModalTextBottom
                      ),
                      SizedBox(
                        height: 16.0,
                      ),
                      RaisedButton(
                        onPressed: () {
                          launch(markerBank[markerID].mRbutton);
                        },
                        child: const Text(
                          'Request a Copy',
                          style: TextStyle(fontSize: 16, fontFamily: 'Abril'),
                        ),
                      ),
                    ],
                  ),
                ),
              ),
            );
          });
    },
  ),
);

当我在当前标记为“ markerID”的位置中从列表中手动输入资产编号时,底部页面会发生变化,但是我想将每个标记分配给列表中正确的markerID,这让我很困惑。 Flutter Map似乎没有识别单个标记的固有方法。有什么办法可以让我不知道吗? 预先感谢您的帮助!

0 个答案:

没有答案