Last updated:
0 purchases
scroll picker
The package scroll_picker is to help in picking an option out of String array/list.
It shows wheel scroll view on top of your view like a modal. The cursor moves to the current selection. Picking a new option is either by clicking the "confirm" button or directly clicking the item desired.
The selected item is returned via the callback function.
https://buymeacoffee.com/jeffk388
Features #
Easy iplementation to pick an item from a list of String.
Support multiple item lines, 5 is default, 7, 9 are options.
The pack inclue a funtion returning Color.fromRGBO from hex string like '#F0605Ff0',
color: stringToRGBO('#FFFFFFff'),
copied to clipboard
YouTube link: https://www.youtube.com/watch?v=YWt3sW1uuZ0
Getting started #
Github provide an example.
Usage #
Add to the pubspec.yaml:
flutter pub add scroll_picker
copied to clipboard
Import the package:
import 'package:scroll_picker/scroll_picker.dart';
copied to clipboard
The parent widget calling the package should be STATEFUL
declare your local currentPick and String List:
_ eg:
List<String> options=['Apple','Kiwi', 'Tomato','Pear'];
String? currentOption;
copied to clipboard
make and pass a callback funtion to take the selected item (val) from the package:
void callbackString(val) {
setState((){
currentOption =val;
});
}
copied to clipboard
Initialize the currentOption
@override
void initState(){
setState((){
currentOption=currentOption ?? options[0];
});
super.initState();
}
copied to clipboard
_ when an item on the wheel is clicked or the confirm button is clicked,
currentOption is updated in the parent Widget, and the currentOption appear on the box the ScrollPicker() is located.
...
Column(chidren:[
...
ScrollPicker(dataArray: options, currentSelection: currOption!, fontSizeList: 20, fontSizeTitle:18, callback: callbackString),
...
]),
...
copied to clipboard
The button-like currentPick is displayed at the spot of ScrollPicker().
Additional information #
Please refer my Github site for details.
scroll_picker #
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.