Changed permission request api in attachment picker
This commit is contained in:
@@ -426,12 +426,12 @@ class _PickerWidget extends StatefulWidget {
|
|||||||
}
|
}
|
||||||
|
|
||||||
class _PickerWidgetState extends State<_PickerWidget> {
|
class _PickerWidgetState extends State<_PickerWidget> {
|
||||||
Future<bool>? requestPermission;
|
Future<PermissionState>? requestPermission;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void initState() {
|
void initState() {
|
||||||
super.initState();
|
super.initState();
|
||||||
requestPermission = PhotoManager.requestPermission();
|
requestPermission = PhotoManager.requestPermissionExtend();
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -440,14 +440,15 @@ class _PickerWidgetState extends State<_PickerWidget> {
|
|||||||
return widget.customAttachmentTypes[widget.filePickerIndex - 1]
|
return widget.customAttachmentTypes[widget.filePickerIndex - 1]
|
||||||
.pickerBuilder(context);
|
.pickerBuilder(context);
|
||||||
}
|
}
|
||||||
return FutureBuilder<bool>(
|
return FutureBuilder<PermissionState>(
|
||||||
future: requestPermission,
|
future: requestPermission,
|
||||||
builder: (context, snapshot) {
|
builder: (context, snapshot) {
|
||||||
if (!snapshot.hasData) {
|
if (!snapshot.hasData) {
|
||||||
return const Offstage();
|
return const Offstage();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (snapshot.data!) {
|
if ([PermissionState.authorized, PermissionState.limited]
|
||||||
|
.contains(snapshot.data)) {
|
||||||
if (widget.containsFile ||
|
if (widget.containsFile ||
|
||||||
!widget.allowedAttachmentTypes
|
!widget.allowedAttachmentTypes
|
||||||
.contains(DefaultAttachmentTypes.image)) {
|
.contains(DefaultAttachmentTypes.image)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user