You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
its not showing all pdf file from phone storages
here is my code it just showing me only two file form this location
/storage/emulated/0 while i have lot pdf file please tell me what issue in this code or plugin?
its not showing all pdf file from phone storages
here is my code it just showing me only two file form this location
/storage/emulated/0 while i have lot pdf file please tell me what issue in this code or plugin?
import 'dart:io';
import 'package:file_manager/file_manager.dart';
import 'package:flutter/material.dart';
import 'package:path/path.dart' as path;
import 'package:permission_handler/permission_handler.dart';
class Pdflist extends StatefulWidget {
const Pdflist({Key? key}) : super(key: key);
@OverRide
State createState() => _PdflistState();
}
class _PdflistState extends State {
final FileManagerController controller = FileManagerController();
@OverRide
void initState() {
super.initState();
checkPermissionStatus();
}
Future checkPermissionStatus() async {
final status = await Permission.storage.status;
setState(() {
if (status.isGranted) {
print('PERMISSION Access');
} else if (status.isDenied) {
requestPermission();
}
});
}
Future requestPermission() async {
final status = await Permission.storage.request();
setState(() {});
}
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
centerTitle: true,
title: Text('All PDFs'),
),
body: Container(
child: FileManager(
controller: controller,
builder: (context, snapshot) {
final List entities = snapshot;
final List pdfFiles = entities
.where((entity) =>
FileManager.isFile(entity) &&
path.extension(entity.path).toLowerCase() == '.pdf')
.toList();
return ListView.builder(
itemCount: pdfFiles.length,
itemBuilder: (context, index) {
return Card(
child: ListTile(
leading: Icon(Icons.file_present),
title: Text(FileManager.basename(pdfFiles[index])),
onTap: () {
// Perform file-related tasks.
},
),
);
},
);
},
),
),
);
}
}
The text was updated successfully, but these errors were encountered: