|
|
|
@ -1,9 +1,13 @@
|
|
|
|
import 'dart:io';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
|
|
|
import 'package:fluttertoast/fluttertoast.dart';
|
|
|
|
|
|
|
|
import 'package:open_file/open_file.dart';
|
|
|
|
|
|
|
|
import 'package:test_sa/extensions/widget_extensions.dart';
|
|
|
|
import 'package:test_sa/views/app_style/colors.dart';
|
|
|
|
import 'package:test_sa/views/app_style/colors.dart';
|
|
|
|
import 'package:test_sa/views/app_style/sizing.dart';
|
|
|
|
import 'package:test_sa/views/app_style/sizing.dart';
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
|
|
|
import 'package:test_sa/views/widgets/buttons/app_back_button.dart';
|
|
|
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart';
|
|
|
|
|
|
|
|
|
|
|
|
class MultiFilesPickerItem extends StatelessWidget {
|
|
|
|
class MultiFilesPickerItem extends StatelessWidget {
|
|
|
|
final File file;
|
|
|
|
final File file;
|
|
|
|
@ -31,7 +35,7 @@ class MultiFilesPickerItem extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
child: MaterialButton(
|
|
|
|
child: MaterialButton(
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
padding: EdgeInsets.zero,
|
|
|
|
onPressed: () {
|
|
|
|
onPressed: () async {
|
|
|
|
if (isImage) {
|
|
|
|
if (isImage) {
|
|
|
|
Navigator.of(context).push(
|
|
|
|
Navigator.of(context).push(
|
|
|
|
MaterialPageRoute(
|
|
|
|
MaterialPageRoute(
|
|
|
|
@ -39,7 +43,7 @@ class MultiFilesPickerItem extends StatelessWidget {
|
|
|
|
body: SafeArea(
|
|
|
|
body: SafeArea(
|
|
|
|
child: Stack(
|
|
|
|
child: Stack(
|
|
|
|
children: [
|
|
|
|
children: [
|
|
|
|
Center(child: isImage ? InteractiveViewer(child: Image(image: (_isLocalUrl(file.path) ? FileImage(file) : NetworkImage(file.path)))) : const SizedBox.shrink()),
|
|
|
|
InteractiveViewer(child: Image(image: (_isLocalUrl(file.path) ? FileImage(file) : NetworkImage(file.path)))).center,
|
|
|
|
const ABackButton(),
|
|
|
|
const ABackButton(),
|
|
|
|
],
|
|
|
|
],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
@ -47,6 +51,13 @@ class MultiFilesPickerItem extends StatelessWidget {
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
);
|
|
|
|
);
|
|
|
|
|
|
|
|
} else if (_isLocalUrl(file.path)) {
|
|
|
|
|
|
|
|
OpenFile.open(file.path);
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
if (!await launchUrl(Uri.parse(file.path), mode: LaunchMode.externalApplication)) {
|
|
|
|
|
|
|
|
Fluttertoast.showToast(msg: "UnExpected Error with file.");
|
|
|
|
|
|
|
|
throw Exception('Could not launch ');
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
},
|
|
|
|
child: Align(
|
|
|
|
child: Align(
|
|
|
|
|