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

Support Flutter 3.27 #4548

Open
1 task done
Sameri11 opened this issue Dec 12, 2024 · 2 comments · May be fixed by #4593
Open
1 task done

Support Flutter 3.27 #4548

Sameri11 opened this issue Dec 12, 2024 · 2 comments · May be fixed by #4593
Assignees
Labels
enhancement Improvement/Optimization

Comments

@Sameri11
Copy link

Duplicate Check

Describe the bug

In Flutter 3.27, API breaking change introduced, as a part of attempt to "normalize" Material's theme API. Reference is here for TabBarThemeThemeData's tabBarTheme property is now TabBarThemeData instead of TabBarTheme.

These changes breaks flet because theme utils now have incompatible types. Consider this example:

This method returns TabBarTheme? because it returns result of copyWith method. But this method now returns TabBarThemeData. Thus errors like this:

../../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:356:28: Error: A
           value of type 'TabBarThemeData' can't be returned from a function with return type 'TabBarTheme?'.
            - 'TabBarThemeData' is from 'package:flutter/src/material/tab_bar_theme.dart'
           ('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/tab_bar_theme.da
           rt').
            - 'TabBarTheme' is from 'package:flutter/src/material/tab_bar_theme.dart'
           ('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/tab_bar_theme.da
           rt').
             return theme.tabBarTheme.copyWith(
                                      ^

Sadly, there is already questions on SO on this matter, for example: https://stackoverflow.com/questions/79273727/materialtheme-normalization-breaks-tabbartheme-cardtheme-dialogtheme-api/79273907#79273907

Same for other API apart from TabBarTheme, such as DialogTheme, CardTheme, etc ....

Code sample

Code Considerr this code:
// Current TabBarTheme API in stable channel version: 3.24.5
final TabBarTheme tabTheme = Theme.of(context).tabBarTheme;

This will works on 3.24.5, but breaks on 3.27

To reproduce

See code sample

Expected behavior

No response

Screenshots / Videos

Captures

[Upload media here]

Operating System

macOS

Operating system details

Sonoma 14.7

Flet version

0.25.1

Regression

No, it isn't

Suggestions

Hard to say. Since it's hard breakage of public API of Flutter itself, maybe it'll require to set minimal flutter version for 3.27 for flet package and update usages accordingly in new version of flet

Logs

Logs
flet build macos
[22:01:43] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.25.1 ✅
           Customized app icons and splash images ✅
[22:01:45] Generated app icons ✅
[22:01:51] Packaged Python app ✅
[22:02:13]
           Updating project for Xcode compatibility.
           Upgrading project.pbxproj
           Upgrading Runner.xcscheme
           Running pod install...                                              4.3s
           Building macOS application...

           macos/Runner/AppDelegate.swift uses the deprecated @NSApplicationMain attribute, updating.
           macos/Runner/AppDelegate.swift does not override applicationSupportsSecureRestorableState.
           Updating.
           .gitignore does not ignore Swift Package Manager build directories, updating.
           --- xcodebuild: WARNING: Using the first of multiple matching destinations:
           { platform:macOS, arch:arm64, id:00008103-001C55920A33001E, name:My Mac }
           { platform:macOS, arch:x86_64, id:00008103-001C55920A33001E, name:My Mac }
           ../../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:356:28: Error: A
           value of type 'TabBarThemeData' can't be returned from a function with return type 'TabBarTheme?'.
            - 'TabBarThemeData' is from 'package:flutter/src/material/tab_bar_theme.dart'
           ('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/tab_bar_theme.da
           rt').
            - 'TabBarTheme' is from 'package:flutter/src/material/tab_bar_theme.dart'
           ('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/tab_bar_theme.da
           rt').
             return theme.tabBarTheme.copyWith(
                                      ^
           ../../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:438:28: Error: A
           value of type 'DialogThemeData' can't be returned from a function with return type 'DialogTheme?'.
            - 'DialogThemeData' is from 'package:flutter/src/material/dialog_theme.dart'
           ('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/dialog_theme.dar
           t').
            - 'DialogTheme' is from 'package:flutter/src/material/dialog_theme.dart'
           ('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/dialog_theme.dar
           t').
             return theme.dialogTheme.copyWith(
                                      ^
           ../../../../../.pub-cache/hosted/pub.dev/flet-0.25.1/lib/src/utils/theme.dart:482:26: Error: A
           value of type 'CardThemeData' can't be returned from a function with return type 'CardTheme?'.
            - 'CardThemeData' is from 'package:flutter/src/material/card_theme.dart'
           ('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/card_theme.dart'
           ).
            - 'CardTheme' is from 'package:flutter/src/material/card_theme.dart'
           ('/opt/homebrew/Caskroom/flutter/3.27.0/flutter/packages/flutter/lib/src/material/card_theme.dart'
           ).
             return theme.cardTheme.copyWith(
                                    ^
           Target kernel_snapshot_program failed: Exception

           Command PhaseScriptExecution failed with a nonzero exit code




           warning: Run script build phase 'Run Script' will be run during every build because it does not
           specify any outputs. To address this issue, either add output dependencies to the script phase, or
           configure it to run in every build by unchecking "Based on dependency analysis" in the script
           phase. (in target 'Flutter Assemble' from project 'Runner')
           ** BUILD FAILED **

           Build process failed

           Error building Flet app - see the log of failed command above.
[22:02:26] Doctor summary (to see all details, run flutter doctor -v):
           [✓] Flutter (Channel stable, 3.27.0, on macOS 15.1.1 24B91 darwin-arm64, locale en-US)
           [✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0-rc4)
           [✓] Xcode - develop for iOS and macOS (Xcode 16.1)
           [✓] Chrome - develop for the web
           [✓] Android Studio (version 2024.2)
           [✓] Connected device (3 available)
           [✓] Network resources

           • No issues found!

Additional details

No response

@ndonkoHenri
Copy link
Contributor

ndonkoHenri commented Dec 12, 2024

Thanks for letting know. Flet is not yet 3.27-ready. We will work on that.

For now, please make use of Flitter 3.24

@ndonkoHenri ndonkoHenri changed the title Flutter 3.27 breaks build because of breaking change in material's ThemeData Support Flutter 3.27 Dec 12, 2024
@ndonkoHenri ndonkoHenri added the enhancement Improvement/Optimization label Dec 12, 2024
@ndonkoHenri ndonkoHenri self-assigned this Dec 13, 2024
@ndonkoHenri ndonkoHenri moved this from 🆕 New to 🏗 In progress in Flet Development Dec 13, 2024
@Franky1
Copy link

Franky1 commented Dec 14, 2024

I can confirm this behaviour, i had to downgrade flutter to successfully build windows and apk targets:

cd \flutter\flutter\
git checkout 3.24.5
flutter doctor -v

@ndonkoHenri ndonkoHenri linked a pull request Dec 18, 2024 that will close this issue
@ndonkoHenri ndonkoHenri moved this from 🏗 In progress to 👀 In review in Flet Development Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement/Optimization
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

3 participants