Skip to content

CupertinoSlidingSegmentedControl causes rendering issues on Android #174100

Closed

Description

@Limatationz

Steps to reproduce

Using CupertinoSlidingSegmentedControl in an MaterialApp causes rendering issues.
If you run the sample code on an Android Device (this one was an emulator using api 35) and changing the slider you can see smaller issues. When pushing a new route that includes a CupertinoSlidingSegmentedControl (with the + button of the sample) it leads to major rendering issues.
The sample is working fine with flutter 3.32.8.
On IOS the sample is working with flutter 3.35.1. Seems like this is an Android only problem.

Expected results

UI should render correctly.

Actual results

Rendering issues when using the CupertinoSlidingSegmentedControl on Android.

Code sample

Code sample
import 'package:flutter/cupertino.dart';
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(
      title: 'Flutter Demo',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
      ),
      home: const TestView(),
    );
  }
}

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

  @override
  State<TestView> createState() => _TestViewState();
}

class _TestViewState extends State<TestView> {
  int selectedSegment = 0;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Test View"),
        actions: [
          IconButton(
            onPressed: () {
              Navigator.of(
                context,
              ).push(MaterialPageRoute(builder: (_) => TestView()));
            },
            icon: Icon(Icons.add),
          ),
        ],
      ),
      body: Padding(
        padding: EdgeInsets.zero,
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            CupertinoSlidingSegmentedControl<int>(
              children: {
                0: Text(
                  'site 1',
                  style: Theme.of(context).textTheme.bodyMedium,
                ),
                1: Text(
                  'site 2',
                  style: Theme.of(context).textTheme.bodyMedium,
                ),
              },
              onValueChanged: (selected) {
                setState(() {
                  selectedSegment = selected ?? 0;
                });
              },
              backgroundColor: Colors.grey.withValues(alpha: 0.3),
              // Set the background color,
              thumbColor: Colors.white,
              groupValue: selectedSegment,
            ),
            const SizedBox(height: 12),
            Expanded(
              child: (selectedSegment == 0) ? _testView() : _testView2(),
            ),
          ],
        ),
      ),
    );
  }

  Widget _testView() {
    return ListView(
      children: List.generate(
        100,
        (index) => ListTile(title: Text("Site 1. Index $index")),
      ),
    );
  }

  Widget _testView2() {
    return ListView(
      children: List.generate(
        50,
        (index) => ListTile(title: Text("Site 2. Index $index")),
      ),
    );
  }
}

Screenshots or Video

Screenshots / Video demonstration
3.32.8 3.35.1
Image Image

Logs

Logs
[Paste your logs here]

Flutter Doctor output

Doctor output
flutter doctor --verbose
[✓] Flutter (Channel stable, 3.35.1, on macOS 15.6 24G84 darwin-arm64, locale de-DE) [407ms]
    • Flutter version 3.35.1 on channel stable at /Volumes/ExternErik/fvm_versions/3.35.1
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 20f8274939 (6 days ago), 2025-08-14 10:53:09 -0700
    • Engine revision 1e9a811bf8
    • Dart version 3.9.0
    • 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-swift-package-manager, enable-lldb-debugging

[✓] Android toolchain - develop for Android devices (Android SDK version 35.0.0) [1.487ms]
    • Android SDK at /Users/erik/Library/Android/sdk
    • Emulator version 35.6.11.0 (build_id 13610412) (CL:N/A)
    • Platform android-36, build-tools 35.0.0
    • Java binary at: /Users/erik/.sdkman/candidates/java/current/bin/java
      This JDK is specified in your Flutter configuration.
      To change the current JDK, run: `flutter config --jdk-dir="path/to/jdk"`.
    • Java version OpenJDK Runtime Environment Temurin-21.0.7+6 (build 21.0.7+6-LTS)
    • All Android licenses accepted.

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

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

[✓] Android Studio (version 2025.1) [7ms]
    • Android Studio at /Users/erik/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 21.0.6+-13391695-b895.109)

[✓] VS Code (version 1.103.0) [5ms]
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.116.0

[✓] Connected device (6 available) [6,3s]
    • sdk gphone16k arm64 (mobile) • emulator-5554                            • android-arm64  • Android 15 (API 35) (emulator)
    • macOS (desktop)              • macos                                    • darwin-arm64   • macOS 15.6 24G84 darwin-arm64
    • Chrome (web)                 • chrome                                   • web-javascript • Google Chrome 139.0.7258.128
    ! Error: Browsing on the local area network for Test Watch. Ensure the device is unlocked and discoverable via Bluetooth. (code -27)

[✓] Network resources [291ms]
    • All expected network resources are available.

• No issues found!
Process finished with exit code 0

Activity

  1. jason-simmons commented on Aug 20, 2025

    @jason-simmons
    Member

    Bisected this to the Cupertino RSuperellipse change (df5f865)

  2. tirth-patel-nc commented on Aug 21, 2025

    @tirth-patel-nc
    Member

    thanks for the report. I'm seeing the same behavior on the Emulator with the latest SDK versions when impeller is enabled, while it works fine with Skia. I also couldn’t reproduce it on a Pixel 6a with impeller enabled.

    I couldn’t replicate this on 3.32. Hence marking it as a regression.

    stable : 3.35.1
    master : 3.33.0-1.0.pre-1511
    beta   : 3.36.0-0.1.pre
    

    @jason-simmons thanks for bisecting.

  3. added
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    c: regressionIt was better in the past than it is now
    engineflutter/engine related. See also e: labels.
    e: impellerImpeller rendering backend issues and features requests
    platform-androidAndroid applications specifically
    p: cupertino_uicupertino_ui package in flutter/packages
    frameworkflutter/packages/flutter repository. See also f: labels.
    fyi-designFor the attention of Design Languages team
    and removed
    in triagePresently being triaged by the triage team
    on Aug 21, 2025
  4. 4 remaining items

  5. github-actions commented on Sep 9, 2025

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  6. locked as resolved and limited conversation to collaborators on Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P1High-priority issues at the top of the work listc: regressionIt was better in the past than it is nowe: impellerImpeller rendering backend issues and features requestsengineflutter/engine related. See also e: labels.found in release: 3.33Found to occur in 3.33found in release: 3.35Found to occur in 3.35frameworkflutter/packages/flutter repository. See also f: labels.fyi-designFor the attention of Design Languages teamhas reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: cupertino_uicupertino_ui package in flutter/packagesplatform-androidAndroid applications specificallyr: fixedIssue is closed as already fixed in a newer versionteam-engineOwned by Engine teamtriaged-engineTriaged by Engine teamwaiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions