Enough-Software / enough_platform_widgets

More cross platform widgets for Flutter. Extends flutter_platform_widgets.
MIT License
18 stars 20 forks source link

flutter_platform_widgets fails to compile on Flutter 3.3.0 #6

Closed definitelyme closed 2 years ago

definitelyme commented 2 years ago

In flutter version 3.0.0, both FlatButton and RaisedButton were marked as deprecated and replaced with TextButton and ElevatedButton. As of flutter 3.3.0, both classes have been completely removed. This change was also effected in flutter_platform_widgets: ^2.0.0, but trying to compile my application using the latest version of enough_platform_widgets: ^0.4.0, fails with the error below:

...

Xcode's output:
↳
    Writing result bundle at path:
        /var/folders/7n/766r529d6_7d0ndd_x2hfyzh0000gn/T/flutter_tools.VfQgMY/flutter_ios_build_temp_dirZnGXVI/temporary_xcresult_bundle

    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_dialog_action.dart:171:14: Error: The method
    'FlatButton' isn't defined for the class 'PlatformDialogAction'.
     - 'PlatformDialogAction' is from 'package:flutter_platform_widgets/src/platform_dialog_action.dart'
     ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_dialog_action.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
          return FlatButton(
                 ^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart:269:14: Error: The method
    'FlatButton' isn't defined for the class 'PlatformButton'.
     - 'PlatformButton' is from 'package:flutter_platform_widgets/src/platform_button.dart'
     ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'FlatButton'.
          return FlatButton(
                 ^^^^^^^^^^
    ../../../.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart:302:12: Error: The method
    'RaisedButton' isn't defined for the class 'PlatformButton'.
     - 'PlatformButton' is from 'package:flutter_platform_widgets/src/platform_button.dart'
     ('../../../.pub-cache/hosted/pub.dartlang.org/flutter_platform_widgets-1.20.0/lib/src/platform_button.dart').
    Try correcting the name to the name of an existing method, or defining a method named 'RaisedButton'.
        return RaisedButton(
               ^^^^^^^^^^^^
    Failed to package /Users/brendan/Mobile/FlutterProjects/tempo.
    Command PhaseScriptExecution failed with a nonzero exit code
    note: Using new build system
    note: Planning

    ...
definitelyme commented 2 years ago

As a temporary workaround for anyone experiencing the same, put this

enough_platform_widgets:
  git:
    url: https://github.com/definitelyme/enough_platform_widgets.git
    ref: deps-update

under the dependency_overrides section of pubspec.yaml; until a fix is published on pub.dev.

robert-virkus commented 2 years ago

published as version v0.5.0, thanks a lot, Brendan!!