Skip to content

TabBar ignores Theme's iconTheme.size #155518

@NoBrainer

Description

@NoBrainer

Steps to reproduce

Open dartpad.dev with the latest version of Dart & Flutter. For me, that was:

  • Dart 3.5.3
  • Flutter 3.24.3

Paste my code sample from below.

Expected results

The icon gets its size from the theme in the TabBar and in the TabBarView.

Actual results

  • For TabBarView, the icon gets its size from the theme, as expected.
  • For TabBar, the icon ignores the theme. (Bad.)

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 MaterialApp(
      theme: ThemeData(
        iconTheme: IconThemeData(size: 64),
      ),
      home: const Scaffold(
        body: DefaultTabController(
          length: 2,
          child: Column(
            children: [
              TabBar(
                tabs: [
                  // The icon theme is ignored for both:
                  Icon(Icons.backpack_outlined),
                  Tab(icon: Icon(Icons.map_outlined)),
                ],
              ),
              Expanded(
                child: TabBarView(
                  children: [
                    // The icon theme is respected for both:
                    Icon(Icons.backpack_outlined),
                    Icon(Icons.map_outlined),
                  ],
                ),
              ),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

No response

Logs

No response

Flutter Doctor output

Doctor output
[√] Flutter (Channel stable, 3.24.1, on Microsoft Windows [Version 10.0.19045.4894], locale en-US)
    • Flutter version 3.24.1 on channel stable at C:\Users\Vinnie\flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 5874a72aa4 (5 weeks ago), 2024-08-20 16:46:00 -0500
    • Engine revision c9b9d5780d
    • Dart version 3.5.1
    • DevTools version 2.37.2

[√] Windows Version (Installed version of Windows is version 10 or higher)

[√] Android toolchain - develop for Android devices (Android SDK version 35.0.0)
    • Android SDK at C:\Users\Vinnie\AppData\Local\Android\sdk
    • Platform android-35, build-tools 35.0.0
    • Java binary at: C:\Program Files\Android\Android Studio\jbr\bin\java
    • Java version OpenJDK Runtime Environment (build 17.0.11+0--11852314)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.9.1)
    • Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
    • Dart plugin version 242.22855.32

[√] Connected device (4 available)
    • sdk gphone64 x86 64 (mobile) • emulator-5554 • android-x64    • Android 15 (API 35) (emulator)
    • Windows (desktop)            • windows       • windows-x64    • Microsoft Windows [Version 10.0.19045.4894]
    • Chrome (web)                 • chrome        • web-javascript • Google Chrome 128.0.6613.138
    • Edge (web)                   • edge          • web-javascript • Microsoft Edge 128.0.2739.42

[√] Network resources
    • All expected network resources are available.

• No issues found!

Metadata

Metadata

Assignees

Labels

f: material designflutter/packages/flutter/material repository.found in release: 3.24Found to occur in 3.24found in release: 3.26Found to occur in 3.26frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onr: fixedIssue is closed as already fixed in a newer versionteam-designOwned by Design Languages team

Type

No type

Projects

Status

Done (PR merged)

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions