使用默认大小自动调整第三方颤振小部件的大小

时间:2021-05-18 15:14:07

标签: flutter dart flutter-dependencies

我正在使用 flutter numberpicker 来构建移动应用程序。小部件的默认大小为 50 像素 x 100 像素。尺寸对于小屏幕来说太大了。如何通过指定正确的高度和宽度使其自动调整大小?

谢谢。任何想法和想法表示赞赏。

1 个答案:

答案 0 :(得分:1)

您可以结合使用 date_createdSizedBox 来实现对 FittedBox 的任何类型的缩放操作。

对于你的情况,你可以这样使用,

Widget

如果你正常使用或者没有在上面的代码中给出SizedBox( width: 75, child: FittedBox( fit: BoxFit.contain, child: NumberPicker( value: _currentValue, minValue: 0, maxValue: 100, onChanged: (value) => setState(() => _currentValue = value), ), ), ), 参数,tt看起来像这样。

enter image description here

但是,如果您像上面的代码一样给出 widthwidth,它看起来像这样。

enter image description here