mirror of
https://github.com/HChaZZY/PiliPlus.git
synced 2025-12-21 17:46:24 +08:00
@@ -6,11 +6,12 @@ class MultiSelectDialog<T> extends StatefulWidget {
|
||||
final String title;
|
||||
final Map<T, String> values;
|
||||
|
||||
const MultiSelectDialog(
|
||||
{super.key,
|
||||
required this.initValues,
|
||||
required this.values,
|
||||
required this.title});
|
||||
const MultiSelectDialog({
|
||||
super.key,
|
||||
required this.initValues,
|
||||
required this.values,
|
||||
required this.title,
|
||||
});
|
||||
|
||||
@override
|
||||
State<MultiSelectDialog<T>> createState() => _MultiSelectDialogState<T>();
|
||||
@@ -32,31 +33,33 @@ class _MultiSelectDialogState<T> extends State<MultiSelectDialog<T>> {
|
||||
clipBehavior: Clip.hardEdge,
|
||||
title: Text(widget.title),
|
||||
contentPadding: const EdgeInsets.only(top: 12),
|
||||
content: StatefulBuilder(builder: (context, StateSetter setState) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: widget.values.entries.map((i) {
|
||||
bool isChecked = _tempValues.contains(i.key);
|
||||
return CheckboxListTile(
|
||||
dense: true,
|
||||
value: isChecked,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
title: Text(
|
||||
i.value,
|
||||
style: theme.textTheme.titleMedium!,
|
||||
),
|
||||
onChanged: (value) {
|
||||
isChecked
|
||||
? _tempValues.remove(i.key)
|
||||
: _tempValues.add(i.key);
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}),
|
||||
content: StatefulBuilder(
|
||||
builder: (context, StateSetter setState) {
|
||||
return SingleChildScrollView(
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: widget.values.entries.map((i) {
|
||||
bool isChecked = _tempValues.contains(i.key);
|
||||
return CheckboxListTile(
|
||||
dense: true,
|
||||
value: isChecked,
|
||||
controlAffinity: ListTileControlAffinity.leading,
|
||||
title: Text(
|
||||
i.value,
|
||||
style: theme.textTheme.titleMedium!,
|
||||
),
|
||||
onChanged: (value) {
|
||||
isChecked
|
||||
? _tempValues.remove(i.key)
|
||||
: _tempValues.add(i.key);
|
||||
setState(() {});
|
||||
},
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
actionsPadding: const EdgeInsets.only(left: 16, right: 16, bottom: 12),
|
||||
actions: [
|
||||
TextButton(
|
||||
|
||||
Reference in New Issue
Block a user