CarouselSlider Параметр options является обязательным.

В новом обновленном пакете требуются параметры и элементы, когда я пытаюсь реализовать «параметры», он дает мне еще одно предупреждение, требующее «элементов».

      CarouselSlider(                                "The parameter 'options' is required"
                  initialPage: _currentIndex,
                  height: carouselSliderHeight,
                  autoPlay: unit.images.length > 1,
                  enableInfiniteScroll: unit.images.length > 1,
                  pauseAutoPlayOnTouch: Duration(seconds: 10),
                  enlargeCenterPage: true,
                  viewportFraction:
                      _UnitCarouselSliderSettings.viewportFraction,
                  onPageChanged: (int index) {
                    _currentIndex = index;
                  },
                  items: List.generate(unit.images.length, (int index) {
                    return Container(
                      width: size.width,
                      margin: EdgeInsets.symmetric(
                          horizontal: _UnitCarouselSliderSettings
                              .unitHorizontalMargin),
                      child: Material(
                        child: InkWell(
                          onLongPress:
                              () {}, 
                          onTap: () async {
                            setState(() {
                              _isCarouselSlider = false;
                            });
                            navigator.push(
                              ZoomScreen(
                                unit,
                                tag: tag,
                                index: index,
                                onWillPop: _onWillPopForZoom,
                              ).getRoute(),
                            );
                          },
                          splashColor: Colors.white.withOpacity(0.4),
                          child: Ink.image(
                            fit: BoxFit.cover,
                            image: ExtendedImage.network(
                              unit.images[index].getDummyUrl(unit.id),
                              loadStateChanged: loadStateChanged,
                            ).image,
                          ),
                        ),
                      ),
                    );
                  }),
                ),

когда я добавляю это:

      CarouselSlider(               "The parameter 'items' is required"
                  options: CarouselOptions(
                  initialPage: _currentIndex,
                  height: carouselSliderHeight,
                  autoPlay: unit.images.length > 1,
                  enableInfiniteScroll: unit.images.length > 1,
                  pauseAutoPlayOnTouch: Duration(seconds: 10),
                  enlargeCenterPage: true,
                  viewportFraction:
                      _UnitCarouselSliderSettings.viewportFraction,
                  onPageChanged: (int index) {
                    _currentIndex = index;
                  },
                  items: List.generate(unit.images.length, (int index) {

Я получаю сообщение об ошибке в pauseAutoPlayOnTouch: Duration(секунд: 10) «Тип аргумента 'Duration' не может быть назначен типу параметра 'bool'»

и я получаю еще одну ошибку в этой строке: onPageChanged: (int index) {_currentIndex = index; «Тип аргумента 'Null Function (int)' не может быть назначен типу параметра 'dynamic Function (int, CarouselPageChangedReason)'»

0 ответов

Другие вопросы по тегам