首页 > 解决方案 > Flutter 中 Cupertino Picker 的样式

问题描述

我曾尝试使用颤振来实现这样的布局。想要的布局

为此,我使用了 Cupertino Picker Class。但它看起来并没有我想要的那么好。我的实际布局

我试图通过使用颤振网站上列出的属性来修复它,但我没有找到更好的解决方案。我该如何解决这个问题,或者在这种情况下是否还有另一个更好的小部件?

我的代码如下所示:

Widget build(BuildContext context) {
return CupertinoPageScaffold(
    navigationBar: CupertinoNavigationBar(
      backgroundColor: Colors.red,
    ),
    child: Container(
      child: Center(
        child: CupertinoPicker(
      itemExtent: 40,
      diameterRatio: 5,
      offAxisFraction: 10,
      backgroundColor: Colors.black54,
      onSelectedItemChanged: (int index) {
        print(index);
      },
      children: <Widget>[
        Text('Tap', style: TextStyle(color:Colors.white)),
        Text('Colorbattle',style: TextStyle(color:Colors.white)),
        Text('Patience',style: TextStyle(color:Colors.white)),
      ],
    ))));

} }

标签: flutterlayoutpicker

解决方案


推荐阅读