-1

"Hello, Android users with version 13 are not able to view the photo gallery, either to change the user's photo or to post a photo on the app's timeline. Once the load is set to true, it remains in that state. Here is a block of code for better contextuation of the implementation, if anyone has an idea that helps me solve it, I thank you all"

return Container(
      color: TecnoColors.theme().white,
      child: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: <Widget>[
          Container(
            height: w(180),
            child: Stack(
              alignment: Alignment.topCenter,
              children: <Widget>[
                FlavorProvider.instance.isWhiteLabelLight()
                    ? ColorFiltered(
                        colorFilter: tintMatrix(tintColor: TecnoColors.theme().blue2), child: profileBackgroundImage)
                    : profileBackgroundImage,
                Positioned(
                  bottom: 0,
                  child: GestureDetector(
                    onTap: () async {
                      if (!getUserBLoC(context).getSelectedCompany()!.canChangeProfilePicture!) {
                        showTecnoInfoAlert(context,
                            alertType: AlertType.error,
                            title: FlutterI18n.translate(context, "global.error"),
                            desc: FlutterI18n.translate(context, "profile.profilePicturePermission"),
                            buttonText: FlutterI18n.translate(context, "global.ok"), onTap: () {
                          Navigator.of(context).pop();
                        });
                      } else {
                        if (!getUserBLoC(context).getSelectedCompany()!.canChangeProfilePicture!) {
                          showTecnoInfoAlert(context,
                              alertType: AlertType.error,
                              title: FlutterI18n.translate(context, "global.error"),
                              desc: FlutterI18n.translate(context, "profile.profilePicturePermission"),
                              buttonText: FlutterI18n.translate(context, "global.ok"), onTap: () {
                            Navigator.of(context).pop();
                          });
                        } else {
                          if (widget.isCompanyProfile) return;
                          getLoadingBLoC(context).setLoading(true);
                          try {
                            File? image = await (MediaPicker.show(context, null,
                                justReturnFile: true, hideVideo: true, oneByOne: true));
                            if (image != null) {
                              await getUserBLoC(context).setPictureProfile(
                                  file: image, companyId: getUserBLoC(context).getSelectedCompany()!.id);
                              if (image.path.contains('.tecnotmp')) {
                                image.delete();
                              }
                            }
                            //Navigator.of(context).pop();
                          } on PlatformException catch (e) {
                            getLoadingBLoC(context).setLoading(false);

I tried updating the plugins, I did testing and debugging but the code seems to be working correctly because when I test on other versions of Android it works perfectly

Vivek Chib
  • 837
  • 1
  • 2
  • 13

1 Answers1

0

Answer found

Android 13 (Api 33) extra configs When targeting Android 13 (API level 33), the following extra configs needs to be added to the manifest:

<manifest>
    <uses-permission android:name="android.permission.READ_MEDIA_IMAGES" /> <!-- If you want to read images-->
    <uses-permission android:name="android.permission.READ_MEDIA_VIDEO" /> <!-- If you want to read videos-->
    <uses-permission android:name="android.permission.READ_MEDIA_AUDIO" /> <!-- If you want to read audio-->
</manifest>

Fonte: https://pub.dev/packages/photo_manager