Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

packages depending on fluttertoast are being a blocker for the apps/widgets which use file_picker/image_picker in iOS #443

Open
yahu1031 opened this issue Jul 5, 2022 · 17 comments
Labels
bug Something isn't working Widget Widgets are building blocks for Apps

Comments

@yahu1031
Copy link
Member

yahu1031 commented Jul 5, 2022

Which at_widget package you find issue with?

at_location_flutter

On what platforms did you experience the issue?

iOS

What version are you using?

at_location_flutter: ^3.1.6

What happened?

Because of the fluttertoast used in at_location_flutter, we cannot pick any file from iCloud. Either the fluttertoast can be a direct dependency or a transitive dependency the issue exists. I have raised a ticket regarding this issue. miguelpruivo/flutter_file_picker#1003,
flutter/flutter#105919

Steps to reproduce

  1. Create an at_app.
  2. Add at_location_flutter package.
  3. Add any file upload/file picking functionality.
  4. Run flutter pub get and cd ios && pod install.
  5. Run flutter run

Additional info

fluttertoast is the culprit. Happened in the new Buzz application.

Relevant log output

Launching lib/main.dart on iPhone 13 in debug mode...
Xcode build done.                                           42.8s
Failed to build iOS app
Error output from Xcode build:

    2022-07-05 14:03:52.884 xcodebuild[70039:1351108] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionSentinelHostApplications for extension Xcode.DebuggerFoundation.AppExtensionHosts.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    2022-07-05 14:03:52.884 xcodebuild[70039:1351108] Requested but did not find extension point with identifier Xcode.IDEKit.ExtensionPointIdentifierToBundleIdentifier for extension Xcode.DebuggerFoundation.AppExtensionToBundleIdentifierMap.watchOS of plug-in com.apple.dt.IDEWatchSupportCore
    ** BUILD FAILED **
Xcode's output:

    Writing result bundle at path:
    	/var/folders/pc/8zz9zy_d5jxctzt7xq13z6740000gn/T/flutter_tools.RzbbZx/flutter_ios_build_temp_dirKj7Uvl/temporary_xcresult_bundle
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:39:52: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDataSource: class {
                                                       ^~~~~
                                                       AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:55:50: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDelegate: class {
                                                     ^~~~~
                                                     AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:39:52: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDataSource: class {
                                                       ^~~~~
                                                       AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:55:50: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDelegate: class {
                                                     ^~~~~
                                                     AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:39:52: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDataSource: class {
                                                       ^~~~~
                                                       AnyObject
    /Users/minnu/Desktop/buzz/ios/Pods/DKPhotoGallery/DKPhotoGallery/DKPhotoGalleryContentVC.swift:55:50: warning: using 'class' keyword to define a class-constrained protocol is deprecated; use 'AnyObject' instead
    internal protocol DKPhotoGalleryContentDelegate: class {
                                                     ^~~~~
                                                     AnyObject
    /Users/minnu/Desktop/buzz/ios/Runner/GeneratedPluginRegistrant.m:72:9: fatal error: module 'fluttertoast' not found
    @import fluttertoast;
     ~~~~~~~^~~~~~~~~~~~
    1 error generated.
    note: Using new build system
    note: Planning
    note: Build preparation complete
    note: Building targets in dependency order
    /Users/minnu/Desktop/buzz/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'Toast' from project 'Pods')
    /Users/minnu/Desktop/buzz/ios/Pods/Pods.xcodeproj: warning: The iOS Simulator deployment target 'IPHONEOS_DEPLOYMENT_TARGET' is set to 8.0, but the range of supported deployment target versions is 9.0 to 15.5.99. (in target 'FMDB' from project 'Pods')
    Result bundle written to path:
    	/var/folders/pc/8zz9zy_d5jxctzt7xq13z6740000gn/T/flutter_tools.RzbbZx/flutter_ios_build_temp_dirKj7Uvl/temporary_xcresult_bundle
Parse Issue (Xcode): Module 'fluttertoast' not found
/Users/minnu/Desktop/buzz/ios/Runner/GeneratedPluginRegistrant.m:71:8
Could not build the application for the simulator.
Error launching application on iPhone 13.
Exited

Flutter analyze output

No response

Flutter doctor output

No response

@yahu1031 yahu1031 added the bug Something isn't working label Jul 5, 2022
@yahu1031 yahu1031 changed the title fluttertoast is being a blocker for the apps/widgets which use file_picker/image_picker packages depending on fluttertoast are being a blocker for the apps/widgets which use file_picker/image_picker Jul 5, 2022
@yahu1031
Copy link
Member Author

yahu1031 commented Jul 5, 2022

Solution I propose

Make use of ScaffoldMessenger and make custom toasts.

Additional Info

I see them in

  • at_theme_flutter
  • at_events_flutter
  • at_location_flutter
  • at_contacts_group_flutter

@yahu1031 yahu1031 changed the title packages depending on fluttertoast are being a blocker for the apps/widgets which use file_picker/image_picker packages depending on fluttertoast are being a blocker for the apps/widgets which use file_picker/image_picker in iOS Jul 5, 2022
@gkc
Copy link
Contributor

gkc commented Jul 5, 2022

I see you raised an issue on the fluttertoast repo. Let's wait to hear back from the fluttertoast maintainer if they can resolve the issue. Alternatively, if you know how to resolve the issue, you could do the fix and test it and submit a PR to FlutterToast

@yahu1031
Copy link
Member Author

yahu1031 commented Jul 5, 2022

@gkc Yes, I did raise it in the rest of the repos that were being blocked by this package. Sadly I don't know the solution cause no traces were being found. So need to wait. And also this is a blocker for all the apps that use the above packages I mentioned. They can't move forward. They will get stuck on onboarding itself. I will wait for it and need to be discussed what to do in this scenario. Thanks.

@gkc
Copy link
Contributor

gkc commented Jul 25, 2022

What's latest on this @yahu1031 ?

@yahu1031
Copy link
Member Author

@gkc Currently, no work is seen on that ticket. And also no activity was found. There was a solution that needs to be done from our side.
That is, Remove the fluttertoast from the packages and create our own custom toasts with ScaffoldMessanger. We can create a package and use it.

@ksanty
Copy link
Member

ksanty commented Jul 28, 2022

@yahu1031 I'm reassigning priority to high, so we can add to PR43 or PR44

@ksanty ksanty added the Widget Widgets are building blocks for Apps label Jul 28, 2022
@yahu1031
Copy link
Member Author

yahu1031 commented Aug 9, 2022

@sonle-geekyants @sachins-geekyants @nitesh2599 Any idea or updates?

@yahu1031
Copy link
Member Author

yahu1031 commented Aug 9, 2022

void showToast(BuildContext? context, String msg,
        {double? width, bool isError = false}) =>
    ScaffoldMessenger.of(context!).showSnackBar(
      SnackBar(
        content: Text(
          msg,
          textAlign: TextAlign.center,
          style: TextStyle(
            fontSize: 12,
            color: isError ? Colors.white : Colors.black,
          ),
        ),
        duration: const Duration(milliseconds: 3000),
        elevation: 0,
        margin: width != null
            ? null
            : EdgeInsets.symmetric(
                horizontal: MediaQuery.of(context).size.width * 0.2),
        backgroundColor: isError
            ? Colors.red[700]
            : Colors.white,
        padding: const EdgeInsets.all(10),
        width: width,
        behavior: SnackBarBehavior.floating,
        shape: RoundedRectangleBorder(
          borderRadius: Platform.isAndroid
              ? BorderRadius.circular(50)
              : BorderRadius.circular(10),
        ),
      ),
    );

This code block will show the toast same as now. So we can get rid of flutter toast package. LMK what do you think.

@sachins-geekyants
Copy link
Contributor

@yahu1031 Are we replacing toast message with snackbar ?

@yahu1031
Copy link
Member Author

yahu1031 commented Aug 9, 2022

May be. I suggest to do so.

@sachins-geekyants
Copy link
Contributor

@Pritam-deb please test this branch by Minnu : https://github.com/atsign-foundation/at_widgets/tree/toast_fix

Where flutter toast is replaced by snackbar.

@yahu1031
Copy link
Member Author

Moving this ticket requires validation

@yahu1031 yahu1031 self-assigned this Aug 11, 2022
@Pritam-deb
Copy link
Member

The text can be a bit bigger.
The toast could also pop a bit higher.

@sachins-geekyants
Copy link
Contributor

@Pritam-deb can you share screenshots of both the UI? it will be easier to compare.

yahu1031 added a commit that referenced this issue Aug 14, 2022
@yahu1031
Copy link
Member Author

@Pritam-deb Toast has fontSize and gravity properties now.

@Pritam-deb
Copy link
Member

minnu customToast.webm
This is branch on which @yahu1031 worked in.
flutterToast.webm
Here, I have used FlutterToast here

Hence, looks good enough.

@yahu1031 yahu1031 removed their assignment Oct 7, 2022
@yahu1031
Copy link
Member Author

@Pritam-deb This issue from the fluttertoast seems fixed, Cross check this with fluttertoast package, If it works, use it. ponnamkarthik/FlutterToast#391 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Widget Widgets are building blocks for Apps
Projects
None yet
Development

No branches or pull requests

5 participants