0

我对如何实现标记列表有疑问?还是其他东西?就像,将此代码分成不同的文件以解决此问题。我在我的应用程序上使用 Flutter Map。

这是我的代码,只有两个标记:

代码

MarkerLayerOptions(
            markers: [
              Marker(
                width: 96,
                height: 96,
                point: mainPoint,
                builder: (ctx) => Container(
                    child: Column(
                  children: [
                    Text(
                      'IFCE Campus Acaraú',
                      textAlign: TextAlign.center,
                      style: TextStyle(color: Colors.pink.shade700),
                    ),
                    IconButton(
                      icon: Icon(Icons.location_on),
                      color: Colors.pink.shade700,
                      onPressed: () {
                        showModalBottomSheet(
                          shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(20.0),
                          ),
                          context: context,
                          backgroundColor: Colors.transparent,
                          builder: (context) => BackdropFilter(
                            filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                Container(
                                  decoration: BoxDecoration(
                                      borderRadius: BorderRadius.only(
                                          topLeft: Radius.circular(20),
                                          topRight: Radius.circular(20)),
                                      gradient: LinearGradient(
                                          begin: Alignment.topCenter,
                                          end: Alignment.bottomCenter,
                                          colors: <Color>[
                                            Color(0XFFFAEBE8),
                                            Colors.green.shade100
                                          ])),
                                  height: 480,
                                  width: MediaQuery.of(context).size.width,
                                  child: SingleChildScrollView(
                                    child: Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Container(
                                          margin: EdgeInsets.only(
                                              bottom: 1, top: 4),
                                          height: 300,
                                          width: 300,
                                          decoration: BoxDecoration(
                                            image: DecorationImage(
                                              image: NetworkImage(
                                                  'https://images.even3.com.br/wtw3LCAjTLmxbRQwr6KI2H-FIKw=/1300x536/smart/even3.blob.core.windows.net/banner/fachadavalendo.a060ab6b7f8d4bf2a52c.jpg'),
                                              fit: BoxFit.cover,
                                            ),
                                            borderRadius:
                                                BorderRadius.circular(20),
                                          ),
                                        ),
                                        SizedBox(
                                          height: 10,
                                        ),
                                        Text(
                                          'IFCE Campus Acaraú \nlaboratório do Ecomangueando',
                                          textAlign: TextAlign.center,
                                          style: TextStyle(
                                              fontWeight: FontWeight.bold,
                                              color: Colors.green,
                                              fontSize: 15),
                                        ),
                                        SizedBox(
                                          height: 10,
                                        ),
                                        Text(
                                          'Alguma descrição sobre',
                                          textAlign: TextAlign.center,
                                          style: TextStyle(
                                              fontWeight: FontWeight.normal,
                                              color: Colors.green.shade300),
                                        ),
                                        SizedBox(
                                          height: 10,
                                        ),
                                        Container(
                                          margin: EdgeInsets.only(
                                              bottom: 4, top: 4),
                                          height: 300,
                                          width: 300,
                                          decoration: BoxDecoration(
                                            color: Colors.black,
                                            borderRadius:
                                                BorderRadius.circular(20),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                )
                              ],
                            ),
                          ),
                        );
                      },
                    ),
                  ],
                )),
              ),
              Marker(
                width: 96,
                height: 96,
                point: LatLng(-9.83284607465564, -35.90767696029337),
                builder: (ctx) => Container(
                    child: Column(
                  children: [
                    Text(
                      'Reserva Ecológica \ndos Manguezais \nda Lagoa do Roteiro',
                      textAlign: TextAlign.center,
                      style: TextStyle(color: Colors.pink.shade700),
                    ),
                    IconButton(
                      icon: Icon(Icons.location_on),
                      color: Colors.pink.shade700,
                      onPressed: () {
                        showModalBottomSheet(
                          shape: RoundedRectangleBorder(
                            borderRadius: BorderRadius.circular(20.0),
                          ),
                          context: context,
                          backgroundColor: Colors.transparent,
                          builder: (context) => BackdropFilter(
                            filter: ImageFilter.blur(sigmaX: 5, sigmaY: 5),
                            child: Column(
                              mainAxisAlignment: MainAxisAlignment.center,
                              children: [
                                Container(
                                  decoration: BoxDecoration(
                                      borderRadius: BorderRadius.only(
                                          topLeft: Radius.circular(20),
                                          topRight: Radius.circular(20)),
                                      gradient: LinearGradient(
                                          begin: Alignment.topCenter,
                                          end: Alignment.bottomCenter,
                                          colors: <Color>[
                                            Color(0XFFFAEBE8),
                                            Colors.green.shade100
                                          ])),
                                  height: 480,
                                  width: MediaQuery.of(context).size.width,
                                  child: SingleChildScrollView(
                                    child: Column(
                                      mainAxisAlignment:
                                          MainAxisAlignment.center,
                                      children: [
                                        Container(
                                          margin: EdgeInsets.only(
                                              bottom: 1, top: 4),
                                          height: 300,
                                          width: 300,
                                          decoration: BoxDecoration(
                                            image: DecorationImage(
                                              image: NetworkImage(
                                                  'https://images.even3.com.br/wtw3LCAjTLmxbRQwr6KI2H-FIKw=/1300x536/smart/even3.blob.core.windows.net/banner/fachadavalendo.a060ab6b7f8d4bf2a52c.jpg'),
                                              fit: BoxFit.cover,
                                            ),
                                            borderRadius:
                                                BorderRadius.circular(20),
                                          ),
                                        ),
                                        SizedBox(
                                          height: 10,
                                        ),
                                        Text(
                                          'IFCE Campus Acaraú \nlaboratório do Ecomangueando',
                                          textAlign: TextAlign.center,
                                          style: TextStyle(
                                              fontWeight: FontWeight.bold,
                                              color: Colors.green,
                                              fontSize: 15),
                                        ),
                                        SizedBox(
                                          height: 10,
                                        ),
                                        Text(
                                          'Alguma descrição sobre',
                                          textAlign: TextAlign.center,
                                          style: TextStyle(
                                              fontWeight: FontWeight.normal,
                                              color: Colors.green.shade300),
                                        ),
                                        SizedBox(
                                          height: 10,
                                        ),
                                        Container(
                                          margin: EdgeInsets.only(
                                              bottom: 4, top: 4),
                                          height: 300,
                                          width: 300,
                                          decoration: BoxDecoration(
                                            color: Colors.black,
                                            borderRadius:
                                                BorderRadius.circular(20),
                                          ),
                                        ),
                                      ],
                                    ),
                                  ),
                                )
                              ],
                            ),
                          ),
                        );
                      },
                    ),
                  ],
                ),
               ),
              ),
            ],
          ),

看到问题了吗?我必须制作近 20 个标记。而且只有两个这么大。此外,在某些时候,甚至我自己也会感到困惑。你们推荐什么解决方案?提前谢谢回答我的人。

4

0 回答 0