Selectable Box
Use SelectableIcon
to create a selectable box in your flutter app, SelectableIcon
comes with a lot of customization options mentioned below.
Convert any widget into a selectable box.
Installation
Add selectable_icon: ^1.0.3
in your project's pubspec.yaml:
dependencies:
selectable_icon: ^1.0.3
Usage
Import selectable_icon
in your dart file:
import 'package:selectable_icon/selectable_icon.dart';
Then use SelectableIcon
in your widget tree:
bool isSelected = false;
int count = 0;
SelectableIcon(
onTap: () {
setState(() {
isSelected = !isSelected;
if (isSelected) {
count++;
} else {
count--;
}
});
},
isSelected: isSelected,
selectedIcon: Icons.thumb_up,
unSelectedIcon: Icons.thumb_up,
size: 70,
selectedColor: Colors.blue,
unSelectedColor: Colors.grey,
count: count,
showCount: true,
animationDuration: const Duration(milliseconds: 500),
padding: const EdgeInsets.all(10),
),