multiSelect static method
dynamic
multiSelect({
- required BuildContext context,
- required ValueChanged<
bool> onSelectAll, - required List<
Widget> children, - bool? show,
- VoidCallback? onClose,
- bool? allSelected,
- bool showAllSelect = true,
- int? totalCount,
- int? selectedCount,
多选
Implementation
static multiSelect({
required BuildContext context,
required ValueChanged<bool> onSelectAll,
required List<Widget> children,
bool? show,
VoidCallback? onClose,
bool? allSelected,
bool showAllSelect = true,
int? totalCount,
int? selectedCount,
}) {
bool isAllSelected = allSelected ?? (totalCount != null && selectedCount != null && selectedCount == totalCount);
bool isShow = show ?? (totalCount != null && selectedCount != null && selectedCount > 0);
return CustomBottomFloatBar(
show: isShow,
child: Wrap(
children: [
CustomTextButton(
onPressed: onClose ?? () => onSelectAll(false),
color: Theme.of(context).colorScheme.outline,
child: Text('cancel'.tr()),
),
if (showAllSelect)
CustomTextButton(
onPressed: () => onSelectAll(!isAllSelected),
child: AnimatedSize(
duration: const Duration(milliseconds: 200),
child: Text(isAllSelected ? 'deselectAll'.tr() : 'selectAll'.tr()),
),
),
...children,
],
),
);
}