i selected multiple files inside listview now i want to copy them. And then want to create input filed to make folder and zip files there. List view builder
ListView.builder(
itemCount: files?.length ?? 0,
itemBuilder: (context, index) {
return InkWell(
onTap: () {},
child: Container(
child: MultiSelectItem(
isSelecting: myMultiSelectController.isSelecting,
onSelected: () {
setState(() {
myMultiSelectController.toggle(index);
});
},
child: Card(
color: myMultiSelectController.isSelected(index)
? Colors.blueAccent
: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(Radius.circular(7)),
),
child: Center(
child: Text(files[index].path,
),
),
),
)
),
);
},
),
function to copy files
void copy() {
setState(() {
myMultiSelectController.set(files?.length ?? 0);
});
}
Solution ^^: get the selected files by using controller.isSelected inside the for loop
Example