Skip to content

Material 3 LinearProgressIndicator paints track outside of bounds when trackGap is greater than zero. #173096

@ksokolovskyi

Description

@ksokolovskyi

Steps to reproduce

  1. Display LinearProgressIndicator widget on screen
  2. Set trackGap to a value higher than the default (e.g., 20) (this is not necessary, but it helps to see the issue)
  3. Set value to any number in the range [0.96, 0.99]

Expected results

LinearProgressIndicator doesn't paint the track outside of bounds.

Actual results

LinearProgressIndicator paints the track outside of bounds.

Code sample

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

void main() {
  runApp(const App());
}

class App extends StatefulWidget {
  const App({super.key});

  @override
  State<App> createState() => _AppState();
}

class _AppState extends State<App> {
  final _value = ValueNotifier(0.0);

  @override
  void dispose() {
    _value.dispose();
    super.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        body: Directionality(
          textDirection: TextDirection.ltr,
          child: Padding(
            padding: const EdgeInsets.symmetric(horizontal: 20),
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              spacing: 20,
              children: [
                ValueListenableBuilder(
                  valueListenable: _value,
                  builder: (context, value, child) {
                    return LinearProgressIndicator(
                      year2023: false,
                      value: value,
                      trackGap: 20,
                    );
                  },
                ),
                ValueListenableBuilder(
                  valueListenable: _value,
                  builder: (context, value, child) {
                    return Slider(
                      value: value,
                      onChanged: (value) => _value.value = value,
                    );
                  },
                ),
              ],
            ),
          ),
        ),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
bug.mov

Flutter Doctor output

Doctor output
[✓] Flutter (Channel master, 3.33.0-1.0.pre-1201, on macOS 15.5 24F74 darwin-arm64, locale en-US) [2.7s]
    • Flutter version 3.33.0-1.0.pre-1201 on channel master at /Users/ksokolovskyi/development/flutter_master
    • Upstream repository [email protected]:ksokolovskyi/flutter.git
    • FLUTTER_GIT_URL = [email protected]:ksokolovskyi/flutter.git
    • Framework revision 5f6fbe2275 (27 hours ago), 2025-07-30 22:21:26 -0700
    • Engine revision 5f6fbe2275
    • Dart version 3.10.0 (build 3.10.0-49.0.dev)
    • DevTools version 2.48.0
    • Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios, cli-animations,
      enable-native-assets

[!] Android toolchain - develop for Android devices (Android SDK version 36.0.0) [4.2s]
    • Android SDK at /Users/ksokolovskyi/Library/Android/sdk
    • Emulator version 35.4.9.0 (build_id 13025442) (CL:N/A)
    • Platform android-36, build-tools 36.0.0
    • ANDROID_HOME = /Users/ksokolovskyi/Library/Android/sdk
    • 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 21.0.5+-13047016-b750.29)
    ! Some Android licenses not accepted. To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 16.4) [1,764ms]
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 16F6
    • CocoaPods version 1.16.2

[✓] Chrome - develop for the web [4ms]
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Connected device (2 available) [5.9s]
    • macOS (desktop) • macos  • darwin-arm64   • macOS 15.5 24F74 darwin-arm64
    • Chrome (web)    • chrome • web-javascript • Google Chrome 138.0.7204.184

[✓] Network resources [1,442ms]
    • 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.found in release: 3.32Found to occur in 3.32found in release: 3.33Found to occur in 3.33frameworkflutter/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 teamtriaged-designTriaged 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