buildField method
Implementation
@override
Widget buildField(BuildContext context) {
return InputDecorator(
decoration: InputDecoration(
label: Text(widget.label),
),
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
children: [
Wrap(
children: files
.map((file) => Padding(
padding: const EdgeInsets.all(8.0),
child: Stack(
children: [
SizedBox(
width: 120,
child: Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
decoration: BoxDecoration(
borderRadius:
BorderRadius.circular(8)),
clipBehavior: Clip.antiAlias,
height: 120,
child: buildPreview(file)),
if (widget.showFileName)
Text(
file.name,
style: const TextStyle(fontSize: 10),
overflow: TextOverflow.ellipsis,
),
],
),
),
Positioned(
child: Container(
height: 13,
width: 13,
decoration: (BoxDecoration(
color: Colors.black.withOpacity(0.5),
shape: BoxShape.circle,
)),
child: GestureDetector(
onTap: () => setState(() {
files.remove(file);
updateFieldValue();
}),
child: const Icon(
Icons.close,
size: 12,
color: Colors.white,
),
),
))
],
),
))
.toList(),
),
FilledButton(
onPressed: canAddMore ? selectFileButtonHandler : null,
child: const Text("Add")),
],
),
),
);
}