зависание мобильного телефона во время прокрутки listView.builder при использовании списка виджета googlemap - PullRequest
0 голосов
/ 04 апреля 2020

Я новичок ie в программировании флаттера. Я много искал, но не нашел ничего полезного для решения моей проблемы. Listview.builder показывает список виджетов карты Google в приложении флаттера, но у меня возникают следующие проблемы при прокрутке списка и повторной инициализации значения:

Unhandled Exception: MissingPluginException(No implementation found for method markers#update on channel plugins.flutter.io/google_maps_4

IllegalStateException: Trying to create an already created platform view

Я добавил «cacheExtent: 3 и addAutomaticKeepAlives: true» в представление списка в дополнение к предыдущим проблемам, возникла новая проблема! иногда мой мобильный телефон зависает во время прокрутки списка, и я должен перезагрузить телефон. код флаттера добавлен ниже:

ListView.builder(
                       cacheExtent: 3,
                       addAutomaticKeepAlives: true,
                       itemBuilder: (context, index) {
                       return listPublicCell(index);
                       },
                       itemCount: 10,
                       );
   return Padding(
          padding: EdgeInsets.all(12),
          child: Card(
              child: Column(
            mainAxisSize: MainAxisSize.min,
            children: <Widget>[
              Container(
                  width: mapWidth,
                  height: 180,
                  child: Stack(
                    children: <Widget>[
                      Positioned.fill(
                          child: GoogleMap(
                              initialCameraPosition: CameraPosition(
                                target: _center,
                                zoom: 16.0,
                                bearing: 30,
                              ),
                              onMapCreated: (GoogleMapController controller) {
                                curMapController?.complete(controller);
                              },
                              rotateGesturesEnabled: false,
                              scrollGesturesEnabled: true,
                              myLocationButtonEnabled: false,
                              myLocationEnabled: false,
                              onCameraMove: _onCameraMove,
                              gestureRecognizers: Set()
                                ..add(Factory<EagerGestureRecognizer>(
                                    () => EagerGestureRecognizer())) // use not to scroll the list view when touching map
                              )),
                      new Positioned(
                        top: (/*(_getSizes(_keyMap).height) */ 180 / 2 - iconMarkerHeight / 2),
                        right: (mapWidth / 2 - iconMarkerwidth),
                        child: Image(
                          image: AssetImage('assets/images/ic_map_marker.png'),
                          width: iconMarkerwidth,
                          height: iconMarkerHeight,
                        ),
                      ),
                      new Positioned(
                          bottom: 12,
                          right: 12,
                          child: GestureDetector(
                            onTap: () {
                            },
                            child: ClipOval(
                              //is fully customizable.
                              child: Container(
                                color: Colors.blue,
//                              height: 36.0, // height of the button
//                              width: 36.0, // width of the button
                                child: SizedBox(
                                    width: 36,
                                    height: 36,
                                    child: Icon(
                                      Icons.call,
                                      color: Colors.white,
                                    )),
                              ),
                            ),
                          )
                          ),
                      new Positioned(
                          top: 0,
                          right: 0,
                          left: 0,
                          child: Container(
                              color: Colors.white,
                              child: Padding(
                                child: Text(
                                  requestTitle,
                                  style: MyFonts.roboto16NormalScorpionContext(context),
                                ),
                                padding: EdgeInsets.fromLTRB(12, 10, 12, 10),
                              ))),
                    ],
                  )
              ),
              Column(
                children: <Widget>[
                  nameTextDesign(position),
                  SizedBox(
                    height: 8,
                  ),
                  addressTextDesign(position),
                  Visibility(
                    visible: !hasActiveOrder,
                    child: showRejectAcceptWidget(position),
                  ),
                ],
              )
            ],
          )
              ));

Я не тестировал приложение на ios, но проблемы возникают на android мобильных телефонах, спасибо за вашу помощь

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...