我目前正在使用carousel-slider库在 Flutter 中获取轮播。
该库基于 PageView,在 PageView 中,元素居中。
这是我得到的旋转木马:

这就是我想要的:

这是使用 CarouselSlider 的代码:
CarouselSlider(
height: 150,
viewportFraction: 0.5,
initialPage: 0,
enableInfiniteScroll: false,
items: widget.user.lastGamesPlayed.map((game) {
return Builder(
builder: (BuildContext context) {
return Padding(
padding: EdgeInsets.symmetric(horizontal: 10),
child: GestureDetector(
onTap: () {
game.presentGame(context, widget.user);
},
child: ClipRRect(
borderRadius: BorderRadius.all(Radius.circular(25)),
child: Container(
color: Theme.MyColors.lightBlue,
child: Center(
child: Padding(
padding: EdgeInsets.all(20),
child: AutoSizeText(game.name,
style: TextStyle(fontSize: 70),
maxLines: 1)),
),
))));
},
);
}).toList(),
)
Run Code Online (Sandbox Code Playgroud)
这是 CarouselSlider 库中的代码:
@override
Widget build(BuildContext context) { …Run Code Online (Sandbox Code Playgroud) 我正在编写一个受 Google Keep 启发的笔记应用程序。注释中的文本以一种相当特殊的方式格式化,如图所示。

你知道我如何重现这种格式(“网格”和文本大小根据单词及其大小而变化?这是我的应用程序的图片。

预先感谢您,并为我的英语不好而感到抱歉。