simple_item_selector 0.0.5
simple_item_selector: ^0.0.5 copied to clipboard
A Flutter package which contains ItemSelector(). ItemSelector() is a simple scrollable item selector widget. when developers have a list of items or widgets, then they can use ItemSelector() widget to [...]
This package contains ItemSelector(), a simple scrollable item selector widget. when developers have a list of items or widgets, then they can use ItemSelector() widget to build a simple and beautiful item selector in Flutter App.
Preview #
Horizontal | Vertical |
---|---|
Features #
Developers can pass any arbitrary list of widgets as items in horizontal or vertical axis directions. And Users can iteract with items and they can select one of them with a simple tap. Developer have access to the index of the selected item with onSelected attribute.
Getting started #
To use this package, add simple_item_selector as a dependency in your pubspec.yaml file. Then import the package like this:
import 'package:simple_item_selector/simple_item_selector.dart';
Usage #
This is Simple example:
ItemSelector(
direction: Direction.horizontal,
activeBackgroundColor: Colors.amberAccent,
inactiveBackgroundColor: Colors.grey[300],
itemMargin: const EdgeInsets.all(2.0),
itemPadding: const EdgeInsets.all(15.0),
itemBorderRadius: const BorderRadius.all(Radius.circular(5.0)),
itemsCount: 4, // should be <= items.length
items: const [Text('a1'), Text('a2'), Text('a3'), Text('a4')], // any arbitrary widget list
onSelected: (index) {
// you can access selected item index here!
print(index);
},
)