showAttachmentModal method
void
showAttachmentModal()
Show the attachment modal, making the user choose where to pick a media from
Implementation
void showAttachmentModal() {
if (_focusNode.hasFocus) {
_focusNode.unfocus();
}
if (!kIsWeb) {
setState(() {
_openFilePickerSection = true;
});
} else {
showModalBottomSheet(
clipBehavior: Clip.hardEdge,
shape: const RoundedRectangleBorder(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(32),
topRight: Radius.circular(32),
),
),
context: context,
isScrollControlled: true,
builder: (_) => Column(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
ListTile(
title: Text(
context.translations.addAFileLabel,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
),
),
ListTile(
leading: const Icon(Icons.image),
title: Text(context.translations.uploadAPhotoLabel),
onTap: () {
pickFile(DefaultAttachmentTypes.image);
Navigator.pop(context);
},
),
ListTile(
leading: const Icon(Icons.video_library),
title: Text(context.translations.uploadAVideoLabel),
onTap: () {
pickFile(DefaultAttachmentTypes.video);
Navigator.pop(context);
},
),
ListTile(
leading: const Icon(Icons.insert_drive_file),
title: Text(context.translations.uploadAFileLabel),
onTap: () {
pickFile(DefaultAttachmentTypes.file);
Navigator.pop(context);
},
),
],
),
);
}
}