Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Prefer TabBarTheme normalization migration guideΒ #160018

Closed
@rydmike

Description

@rydmike

Steps to reproduce

Create a TabBarTheme instance with type declaration.

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

Expected results

Expect the current API usage to compile on beta/master channels OR expect the API to be documented as a totally breaking none compiling change in the coming breaking not-yet-released changes lists here: https://docs.flutter.dev/release/breaking-changes#not-yet-released-to-stable

Actual results

Using

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

on beta channel version 3.27.0-0.2.pre or master 3.27.0-1.0.pre.763 the line does not compile.

There is no documentation (yet) about the coming breaking changes that causes this API to break in a manner that does not even compile.

Related PR #156253

To compile the line on beta channel version 3.27.0-0.2.pre or master 3.27.0-1.0.pre.763 you have to use:

// New TabBar API in latest beta channel version: 3.27.0-0.2.pre and
// master channel version: 3.27.0-1.0.pre.763
final TabBarThemeData tabTheme = Theme.of(context).tabBarTheme;

The change is a part of "normalizing" component theme efforts, but the none compiling breaking change needs to be documented before it is released, which is expected to happen soon. This is just a friendly reminder to document the breaking change! πŸ˜ƒ

Code sample

Code sample
import 'package:flutter/material.dart';

void main() => runApp(const MyApp());

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const MaterialApp(
      debugShowCheckedModeBanner: false,
      home: HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});
  @override
  Widget build(BuildContext context) {
    // Current TabBar API in stable channel version: 3.24.5
    final TabBarTheme tabTheme = Theme.of(context).tabBarTheme;
    // The above current API in stable is broken in beta and master,
    // meaning in coming next stable, it will not even compile!

    // New TabBarTheme API in latest beta channel version: 3.27.0-0.2.pre and
    // master channel version: 3.27.0-1.0.pre.763
    // final TabBarThemeData tabTheme = Theme.of(context).tabBarTheme;

    // Expect to find information about the TabBarThemeData class in the
    // Flutter documentation about coming none compiling breaking changes!
    // https://docs.flutter.dev/release/breaking-changes

    return Scaffold(
      appBar: AppBar(title: const Text('Home screen')),
      body: const Center(child: Text('Just some text')),
    );
  }
}

Flutter Doctor output

Doctor output
[βœ“] Flutter (Channel master, 3.27.0-1.0.pre.763, on macOS 15.1.1 24B91 darwin-arm64, locale en-US)
    β€’ Flutter version 3.27.0-1.0.pre.763 on channel master at /Users/rydmike/fvm/versions/master
    β€’ Upstream repository https://github.com/flutter/flutter.git
    β€’ Framework revision 0104a81f55 (4 hours ago), 2024-12-10 00:31:10 -0500
    β€’ Engine revision 0338d1c7d7
    β€’ Dart version 3.7.0 (build 3.7.0-226.0.dev)
    β€’ DevTools version 2.41.0

[βœ“] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
    β€’ Android SDK at /Users/rydmike/Library/Android/sdk
    β€’ Platform android-34, build-tools 34.0.0
    β€’ Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
      This is the JDK bundled with the latest Android Studio installation on this machine.
      To manually set the JDK path, use: `flutter config --jdk-dir="path/to/jdk"`.
    β€’ Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)
    β€’ All Android licenses accepted.

[βœ“] Xcode - develop for iOS and macOS (Xcode 16.1)
    β€’ Xcode at /Applications/Xcode.app/Contents/Developer
    β€’ Build 16B40
    β€’ CocoaPods version 1.16.2

[βœ“] Chrome - develop for the web
    β€’ Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[βœ“] Android Studio (version 2023.2)
    β€’ Android Studio at /Applications/Android Studio.app/Contents
    β€’ Flutter plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/9212-flutter
    β€’ Dart plugin can be installed from:
      πŸ”¨ https://plugins.jetbrains.com/plugin/6351-dart
    β€’ Java version OpenJDK Runtime Environment (build 17.0.9+0-17.0.9b1087.7-11185874)

[βœ“] IntelliJ IDEA Community Edition (version 2024.2.5)
    β€’ IntelliJ at /Applications/IntelliJ IDEA CE.app
    β€’ Flutter plugin version 83.0.3
    β€’ Dart plugin version 242.24931

[βœ“] VS Code (version 1.95.3)
    β€’ VS Code at /Applications/Visual Studio Code.app/Contents
    β€’ Flutter extension version 3.102.0

[βœ“] Connected device (4 available)
    β€’ Pixel 7 Pro (mobile)            β€’ 28131FDH300NJG        β€’ android-arm64  β€’ Android 15 (API 35)
    β€’ macOS (desktop)                 β€’ macos                 β€’ darwin-arm64   β€’ macOS 15.1.1 24B91 darwin-arm64
    β€’ Mac Designed for iPad (desktop) β€’ mac-designed-for-ipad β€’ darwin         β€’ macOS 15.1.1 24B91 darwin-arm64
    β€’ Chrome (web)                    β€’ chrome                β€’ web-javascript β€’ Google Chrome 131.0.6778.109
    ! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for hype’s iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local
      area network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)
    ! Error: Browsing on the local area network for MrPinkPro. Ensure the device is unlocked and attached with a cable or associated with the same local area
      network as this Mac.
      The device must be opted into Developer Mode to connect wirelessly. (code -27)

[βœ“] Network resources
    β€’ All expected network resources are available.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listf: material designflutter/packages/flutter/material repository.f: themingStyling widgets with a themefound in release: 3.27Found to occur in 3.27frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: solvedIssue is closed as solvedteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions