引入以來后直接這樣寫代碼就好了!當成一個widget使用:
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
NumberPicker.integer(
initialValue: _currentValue,
minValue: 0,
maxValue: 100,
onChanged: (newValue) =>
setState(() => _currentValue = newValue)),
Text("Current number: $_currentValue"),
],
),