flutter_multicheck_value 0.0.2
flutter_multicheck_value: ^0.0.2 copied to clipboard
A dynamic multi-check Flutter widget with JSON serialization and customizable items.Add, remove,and manage checkable items with ease.
example/lib/main.dart
import 'package:flutter/material.dart';
import 'package:flutter_multicheck_value/dynamic_multicheck.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Dynamic MultiCheck Example',
theme: ThemeData(primarySwatch: Colors.blue),
home: const ExamplePage(),
);
}
}
class ExamplePage extends StatefulWidget {
const ExamplePage({Key? key}) : super(key: key);
@override
_ExamplePageState createState() => _ExamplePageState();
}
class _ExamplePageState extends State<ExamplePage> {
final List<CheckItem> initialItems = [
CheckItem(name: 'Item 1', value: '34'),
CheckItem(name: 'Item 2', value: '34'),
CheckItem(name: 'Item 3', value: '34'),
CheckItem(name: 'Item 4', value: '34'),
CheckItem(name: 'Item 5', value: '34'),
CheckItem(name: 'Item 6', value: '34'),
];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Dynamic MultiCheck Example')),
body: DynamicMultiCheck(
initialItems: initialItems,
showAddButton: true,
showDeleteButton: true,
showJsonButton: true,
activeColor: Colors.blue,
onItemsChanged: () {
print('Items changed!');
},
onCheckedItemsChanged: (checkedItems) {
print('Checked items: ${checkedItems.length}');
},
),
);
}
}