flutter_multi_select_items
๋ค์ค ์ ํ ์์ ฏ์ ์์ฑํ๊ธฐ ์ํ ๊ฐ๋จํ Flutter ํจํค์ง์
๋๋ค.
โข
๋ค๋ฃจ๊ธฐ ์ฝ์ต๋๋ค.
โข
๋์ ์์ค์ ๋ง์ถค ์ค์ ์ด ๊ฐ๋ฅํฉ๋๋ค.
flutter_multi_select_items ๋ผ์ด๋ธ๋ฌ๋ฆฌ
๋ผ์ด๋ธ๋ฌ๋ฆฌ ๊ฐ๋
Multi Select = ์ฌ๋ฌ ๊ฐ ์ ํ
์:
โข
์ทจ๋ฏธ ์ ํ โ ์ด๋, ์์
, ์ํ, ์ฌํ
โข
์์ ์ ํ โ ํผ์, ์นํจ, ํ๋ฒ๊ฑฐ
โข
๊ธฐ์ ์คํ ์ ํ โ Flutter, Spring, Django
โข
ํํฐ ์ ํ โ ๊ฐ๊ฒฉ, ๊ฑฐ๋ฆฌ, ํ์
์ค์น ๋ฐฉ๋ฒ
dependencies:
flutter_multi_select_items: ^0.4.2
YAML
๋ณต์ฌ
flutter pub get
Bash
๋ณต์ฌ
import 'package:flutter_multi_select_items/flutter_multi_select_items.dart';
Dart
๋ณต์ฌ
๊ธฐ๋ณธ ์ฌ์ฉ ๋ฐฉ๋ฒ
MultiSelectContainer(
items: [
MultiSelectCard(value: 'Flutter', label: 'Flutter'),
MultiSelectCard(value: 'Spring', label: 'Spring'),
MultiSelectCard(value: 'Django', label: 'Django'),
],
onChange: (allSelectedItems, selectedItem) {
print(allSelectedItems);
},
)
Dart
๋ณต์ฌ
์ฃผ์ ๊ตฌ์ฑ ์์
MultiSelectContainer
MultiSelectCard
onChange
onChange: (allSelectedItems, selectedItem) {
print("์ ์ฒด ์ ํ: $allSelectedItems");
print("๋ฐฉ๊ธ ์ ํ: $selectedItem");
}
Dart
๋ณต์ฌ
๋ณ์ | ์ค๋ช
|
allSelectedItems | ์ ์ฒด ์ ํ๋ ๋ฆฌ์คํธ |
selectedItem | ๋ฐฉ๊ธ ์ ํ/ํด์ ๋ ์์ดํ
|
์ ์ฒด ์์
class MultiSelectExample extends StatefulWidget {
State<MultiSelectExample> createState() => _MultiSelectExampleState();
}
class _MultiSelectExampleState extends State<MultiSelectExample> {
List<String> selectedItems = [];
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("๋ฉํฐ ์ ํ ์์ ")),
body: Column(
children: [
MultiSelectContainer(
items: [
MultiSelectCard(value: '์ด๋', label: '์ด๋'),
MultiSelectCard(value: '์ํ', label: '์ํ'),
MultiSelectCard(value: '์ฌํ', label: '์ฌํ'),
MultiSelectCard(value: '๋
์', label: '๋
์'),
],
onChange: (allSelectedItems, selectedItem) {
setState(() {
selectedItems = List<String>.from(allSelectedItems);
});
},
),
SizedBox(height: 20),
Text("์ ํ๋ ํญ๋ชฉ: ${selectedItems.join(', ')}"),
],
),
);
}
}
Dart
๋ณต์ฌ
๋์์ธ ์ปค์คํฐ๋ง์ด์ง
MultiSelectContainer(
itemsDecoration: MultiSelectDecorations(
decoration: BoxDecoration(
color: Colors.grey[200],
borderRadius: BorderRadius.circular(10),
),
selectedDecoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(10),
),
),
items: [
MultiSelectCard(value: 'A', label: 'A'),
MultiSelectCard(value: 'B', label: 'B'),
],
)
Dart
๋ณต์ฌ
๊ฐ๊ฒฉ ์กฐ์
MultiSelectContainer(
spacing: 10,
runSpacing: 10,
items: [...]
)
Dart
๋ณต์ฌ
์ต์
| ์ค๋ช
|
spacing | ๊ฐ๋ก ๊ฐ๊ฒฉ |
runSpacing | ์ธ๋ก ๊ฐ๊ฒฉ |
์ค๋ฌด์์ ๋ง์ด ์ฌ์ฉํ๋ ์์
๊ด์ฌ์ฌ ์ ํ ํ๋ฉด
โข
์ด๋
โข
์ฌํ
โข
์์
โข
์ํ
โข
๋
์
โข
๊ฒ์
์์ ์ ํ
โข
ํ์
โข
์ค์
โข
์ผ์
โข
์์
โข
ํจ์คํธํธ๋
๊ธฐ์ ์คํ ์ ํ
โข
Flutter
โข
React
โข
Spring
โข
Django
โข
Node.js
Checkbox vs MultiSelect ๋น๊ต
Checkbox | MultiSelect |
์ธ๋ก ๋ฆฌ์คํธ | ํ๊ทธ ํํ |
๊ณต๊ฐ ๋ง์ด ์ฌ์ฉ | ๊ณต๊ฐ ํจ์จ |
๊ธฐ๋ณธ UI | ์ปค์คํ
UI |
๋จ์ ์ค์ | ๋์์ธ ์ฑ์ ์ ํฉ |
ํ์ค ์ ๋ฆฌ
์ํ๋ฉด ๋ค์ ๊ฐ์๋
ธํธ๋ ์ด์ด์ ์ ๋ฆฌํด์ค๊ฒ:
โข
table_calendar
โข
flutter_slidable
โข
file_picker
โข
image_picker
โข
sqflite
โข
hive
โข
shared_preferences





