如何使flutter整页滚动查看?

omtl5h9j  于 2022-11-17  发布在  Flutter
关注(0)|答案(1)|浏览(173)

我想创建一个滚动视图,我已经创建了这样的脚本算法脚本,
Scaffold ~〉SingleChildScrollView ~〉ConstrainedBox ~〉Row [ Expanded ~〉我容器将此设置为全屏大小,
Expanded ~〉我的容器将此设置为全尺寸屏幕,
],
但是当我向右滚动时,它并没有完全移动到一个屏幕,SingleChildScrollView如何移动到一个全屏?

kmbjn2e3

kmbjn2e31#

我用PageView替换了滚动小部件,它工作正常

PageView(
    onPageChanged: (int page) {},
    controller: pageController,
    children: List.generate(5, (index) {
      return Container(
        constraints: BoxConstraints(
          maxHeight: constraints.maxHeight / 1.5,
          minWidth: constraints.maxWidth,
          maxWidth: constraints.maxWidth,
        ),
        padding: const EdgeInsets.symmetric(
          vertical: 10,
        ),
        child: ProfilePicture(
          pathImage: "assets/debug/girl.jpg",
          width: constraints.maxWidth,
          height: constraints.maxHeight,
          borderRadius: BorderRadius.circular(0),
          onPressed: null,
        ),
      );
    }).toList().cast<Widget>(),
  );

相关问题