|
|
|
|
@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
|
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:flutter_svg/flutter_svg.dart';
|
|
|
|
|
import 'package:path_provider/path_provider.dart';
|
|
|
|
|
import 'package:permission_handler/permission_handler.dart';
|
|
|
|
|
import 'package:syncfusion_flutter_pdfviewer/pdfviewer.dart';
|
|
|
|
|
import 'package:tangheem/api/tangheem_user_api_client.dart';
|
|
|
|
|
import 'package:tangheem/app_state/app_state.dart';
|
|
|
|
|
@ -83,6 +84,11 @@ class _PdfListScreenState extends State<PdfListScreen> {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<bool> _requestStoragePermission() async {
|
|
|
|
|
Map<Permission, PermissionStatus> statuses = await [Permission.storage].request();
|
|
|
|
|
return statuses[Permission.storage].isGranted;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
|
return SizedBox(
|
|
|
|
|
@ -114,8 +120,12 @@ class _PdfListScreenState extends State<PdfListScreen> {
|
|
|
|
|
"assets/icons/new/download_pdf.svg",
|
|
|
|
|
width: 44,
|
|
|
|
|
height: 50,
|
|
|
|
|
).onPress(() {
|
|
|
|
|
startFileDownload(contentList[index].exposeFilePath, contentList[index].fileName);
|
|
|
|
|
).onPress(() async {
|
|
|
|
|
if (await _requestStoragePermission()) {
|
|
|
|
|
startFileDownload(contentList[index].exposeFilePath, contentList[index].fileName);
|
|
|
|
|
} else {
|
|
|
|
|
Utils.showToast("يجب أن تعطي الإذن للتنزيل.");
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
7.width,
|
|
|
|
|
ClipRRect(
|
|
|
|
|
@ -194,6 +204,5 @@ class PdfViewerScreen extends StatelessWidget {
|
|
|
|
|
pageSpacing: 0,
|
|
|
|
|
// pageLayoutMode:PdfPageLayoutMode.single
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|