Flutter中Cupertino Picker的样式

时间:2019-12-05 18:54:58

标签: flutter layout picker

我尝试使用flutter实现这样的布局。 The desired layout

我为此使用了Cupertino Picker类。 但这看起来并不像我想要的那样好。 My actual layout

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

我的代码如下:

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)),
      ],
    ))));

} }

0 个答案:

没有答案