简体   繁体   English

你如何在 Flutter 中制作水平数字选择器小部件?

[英]How do you make a Horizontal Number Picker Widget in Flutter?

I want to make a horizontal number picker as shown in the image below:我想制作一个水平数字选择器,如下图所示:图像水平选择器

I tried using horizontal listview and pageview widgets but couldn't do it.我尝试使用水平列表视图和页面视图小部件,但无法做到。 I've even tried using some GitHub addons such as NumberPicker and Carousel but they don't show the number's on the side.我什至尝试使用一些 GitHub 插件,例如 NumberPicker 和 Carousel,但它们没有在侧面显示数字。

Thank you!谢谢!

Please look into [this] : https://github.com/andrezanna/NumberPicker请查看[这个]: https : //github.com/andrezanna/NumberPicker

This has all type of number picker.这具有所有类型的数字选择器。

In NumberPicker you can see the sample codeNumberPicker 中你可以看到示例代码

example:例子:

      new NumberPicker.integer(
                initialValue: _currentValue,
                minValue: 0,
                maxValue: 100,
                onChanged: (newValue) =>
                    setState(() => _currentValue = newValue)),
            new Text("Current number: $_currentValue"),

Just Change NumberPicker.Integer into NumberPicker.horizontal and it will work.只要改变NumberPicker.IntegerNumberPicker.horizontal ,它会工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM