Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/user-interface/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Flutter 如何为颤振中的ListWheelScrollView分配控制器?_Flutter_User Interface_Dart - Fatal编程技术网

Flutter 如何为颤振中的ListWheelScrollView分配控制器?

Flutter 如何为颤振中的ListWheelScrollView分配控制器?,flutter,user-interface,dart,Flutter,User Interface,Dart,我使用的是一个ListWheelScrollView,它使用的是physics:FixedExtentScrollPhysics(),。我在我的应用程序中使用了各种其他滚动控制器。我想为我的ListWheelScrollView提供一个参数,以便它使用与我的其余小部件相同的ScrollController。但是,它不允许我提供controller:mainController参数以及fixextentscrollphysics()。我怎样才能解决这个问题 这是mainController的声明,

我使用的是一个
ListWheelScrollView
,它使用的是
physics:FixedExtentScrollPhysics(),
。我在我的应用程序中使用了各种其他
滚动控制器。我想为我的
ListWheelScrollView
提供一个参数,以便它使用与我的其余小部件相同的ScrollController
。但是,它不允许我提供
controller:mainController
参数以及
fixextentscrollphysics()
。我怎样才能解决这个问题

这是mainController的声明,我试图在
ListWheelScrollView中调用它:

final mainController = ScrollController();
我的列表的代码是:

ListWheelScrollView.useDelegate(
              itemExtent: 90,
              perspective: 0.0025,
              magnification: 1.2,
              physics: FixedExtentScrollPhysics(),
              diameterRatio: 4,
              // controller: mainController,
              offAxisFraction: 0.42,
              useMagnifier: true,
              childDelegate: ListWheelChildBuilderDelegate(
                  builder: (
                    context,
                    index,
                  ) {
                    return Column(
                      children: [
                        ListTile(
                          isThreeLine: false,
                          trailing: indexTrailing(index, duration, true),
                          title: Row(
                            children: <Widget>[
                              Padding(
                                padding: EdgeInsets.only(
                                    right: 10, top: 5, bottom: 5),
                                child: ClipRRect(
                                  borderRadius: BorderRadius.circular(12.0),
                                  child: Container(
                                    height: 60,
                                    width: 60,
                                    child: Image.network(
                                        'https://www.ikea.com/in/en/images/products/smycka-artificial-flower-rose-red__0903311_PE596728_S5.JPG'),
                                  ),
                                ),
                              ),
                              Expanded(
                                child: Column(
                                  crossAxisAlignment: CrossAxisAlignment.start,
                                  children: [
                                    Text(
                                      'Hello',
                                      style: GoogleFonts.montserrat(
                                        wordSpacing: 0,
                                        letterSpacing: 0,
                                        textStyle: kTasksStyle.copyWith(
                                            fontSize: 15,
                                            color: kDarkBlue,
                                            fontWeight: FontWeight.w500),
                                      ),
                                    ),
                                    SizedBox(
                                      height: 5,
                                    ),
                                    SizedBox(
                                      width: MediaQuery.of(context).size.width *
                                          0.62,
                                      child: RichText(
                                        maxLines: 2,
                                        overflow: TextOverflow.ellipsis,
                                        text: TextSpan(
                                          text: "This is a rose",
                                          style: GoogleFonts.montserrat(
                                            textStyle: kTasksStyle.copyWith(
                                                fontSize: 12,
                                                color: kGrey,
                                                fontWeight: FontWeight.normal),
                                          ),
                                        ),
                                      ),
                                    )
                                  ],
                                ),
                              ),
                            ],
                          ),
                        ),
                        Padding(
                          padding: const EdgeInsets.only(
                              left: 18.0, right: 18, top: 5, bottom: 5),
                          child: Divider(
                            height: 1,
                            color: Colors.grey.withOpacity(0.2),
                            thickness: 1,
                          ),
                        ),
                      ],
                    );
                  },
                  childCount: 9),
            ),

只是使用

     FixedExtentScrollController();
而不是

     ScrollController();
只是使用

     FixedExtentScrollController();
而不是

     ScrollController();