simple_multiselect 0.1.1
simple_multiselect: ^0.1.1 copied to clipboard
A Flutter package for simple creating multi select widgets. The field refresh real-time on tap the list element.
Simple Multi Select #
Flutter package for multi-select UI widget
Features #
- Accepts custom input data
- Data is updated when selected
- BottomSheet
- Select all
- With or without checkbox
Getting started #
- Add the package into
pubspec.yaml
dependencies:
simple_multiselect:
- Import in your code
import 'package:flutter_multiselect/flutter_multiselect.dart';
Usage #
Create class with data and override method "toString()" If need to display only name, example:
class User {
final String id;
final String title;
final String email;
const User({required this.id, required this.title, required this.email});
@override
String toString() {
return title;
}
}
Decorate the widget as needed. Add the SimpleMultiselect widget to your build method:
Container(
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(10)),
border: Border.all(color: Colors.black),
),
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 2),
child: SimpleMultiselect<User>(
labelBackgroundColor: Colors.lightGreen.shade300,
labelStyle: const TextStyle(fontWeight: FontWeight.bold),
dataSource: users,
onChange: (value) => print(value),
closeButtonText: 'Close',
selectAllTitle: 'Select All',
checkBox: true,
),
)
}