|
|
|
|
@ -32,7 +32,7 @@ class FilesList extends StatelessWidget {
|
|
|
|
|
return showAsListView
|
|
|
|
|
? ListView.separated(
|
|
|
|
|
shrinkWrap: true,
|
|
|
|
|
padding: padding ?? const EdgeInsets.only(top: 0),
|
|
|
|
|
padding: padding ?? EdgeInsets.zero,
|
|
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
|
|
|
itemBuilder: (cxt, itemIndex) {
|
|
|
|
|
if (!images[itemIndex].contains(".")) {
|
|
|
|
|
@ -44,6 +44,7 @@ class FilesList extends StatelessWidget {
|
|
|
|
|
var isExcel = images[itemIndex].split(".").last.toLowerCase() == "xlsx";
|
|
|
|
|
|
|
|
|
|
return Row(
|
|
|
|
|
spacing: 8,
|
|
|
|
|
children: [
|
|
|
|
|
Container(
|
|
|
|
|
width: 48.toScreenWidth,
|
|
|
|
|
@ -69,7 +70,6 @@ class FilesList extends StatelessWidget {
|
|
|
|
|
: Image.asset("assets/images/${isPdf ? "pdf" : isExcel ? "excel" : "doc"}.png")),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
8.width,
|
|
|
|
|
Column(
|
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
|
children: [
|
|
|
|
|
@ -117,11 +117,19 @@ class FilesList extends StatelessWidget {
|
|
|
|
|
visualDensity: VisualDensity.compact,
|
|
|
|
|
tooltip: "Download",
|
|
|
|
|
onPressed: () async {
|
|
|
|
|
if (Utils.isLocalFile(images[itemIndex])) {
|
|
|
|
|
await OpenFile.open(images[itemIndex]);
|
|
|
|
|
} else {
|
|
|
|
|
await Utils.downloadFile(images[itemIndex], autoOpen: true, showToast: true);
|
|
|
|
|
try {
|
|
|
|
|
if (!await launchUrl(Uri.parse(images[itemIndex]), mode: LaunchMode.externalApplication)) {
|
|
|
|
|
Fluttertoast.showToast(msg: "UnExpected Error with file.");
|
|
|
|
|
throw Exception('Could not launch ');
|
|
|
|
|
}
|
|
|
|
|
} catch (ex) {
|
|
|
|
|
Fluttertoast.showToast(msg: "No Viewer found.");
|
|
|
|
|
}
|
|
|
|
|
// if (Utils.isLocalFile(images[itemIndex])) {
|
|
|
|
|
// await OpenFile.open(images[itemIndex]);
|
|
|
|
|
// } else {
|
|
|
|
|
// await Utils.downloadFile(images[itemIndex], autoOpen: true, showToast: true);
|
|
|
|
|
// }
|
|
|
|
|
},
|
|
|
|
|
),
|
|
|
|
|
],
|
|
|
|
|
|