Skip to content

AnimatedCrossFade clips CircularProgressIndicator #25950

Description

@pushqrdx

Steps to Reproduce

  1. Create a Text widget.
  2. Create a CircularProgressIndicator widget, Increase strokeWidth to 10 to better see the issue.
  3. Use AnimatedCrossFade widget to toggle between the two.
  4. Check out the CircularProgressIndicator sides you will find that it's clipped

Note: Adding padding resulted in a skewed indicator, Which is even more strange.

Detailed issue demonstration

2019-01-02 22 01 06

Code to reproduce

In a stateful widget

import 'package:flutter/material.dart';

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

class MyApp extends StatefulWidget {
  // This widget is the root of your application.
  @override
  MyAppState createState() {
    return new MyAppState();
  }
}

class MyAppState extends State<MyApp> {
  CrossFadeState xFadeState = CrossFadeState.showFirst;

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Issue Demo',
      home: Scaffold(
        body: Center(
          child: Container(
            color: Colors.red,
            width: 50,
            height: 50,
            child: GestureDetector(
              onTap: () {
                setState(() {
                  xFadeState == CrossFadeState.showSecond ? xFadeState = CrossFadeState.showFirst : xFadeState = CrossFadeState.showSecond;
                });
              },
              child: Center(
                child: AnimatedCrossFade(
                  firstChild: Text('data'),
                  secondChild: SizedBox(
                    height: 20,
                    width: 20,
                    child: CircularProgressIndicator(),
                  ),
                  duration: Duration(milliseconds: 250),
                  crossFadeState: xFadeState,
                ),
              ),
            ),
          ),
        ),
      ),
    );
  }
}

Without the SizedBox

2019-01-02 22 06 05

With padding around the CircularProgressIndicator, Issue seems to be fixed but during transition the indicator is skewed as demonstrated by this gif, Surrounding the padding with a SizedBox shows that the AnimatedCrossFade doesn't respect the SizedBox's Size and skews the indicator while animating the size transition anyway.

2019-01-02 22 07 28

I hope this is enough detail to reproduce, I'll be glad to provide more if needed.

flutter doctor -v

[✓] Flutter (Channel stable, v1.0.0, on Mac OS X 10.13.6 17G4015, locale en-EG)
    • Flutter version 1.0.0 at /Users/pushqrdx/Library/Developer/Flutter
    • Framework revision 5391447fae (5 weeks ago), 2018-11-29 19:41:26 -0800
    • Engine revision 7375a0f414
    • Dart version 2.1.0 (build 2.1.0-dev.9.4 f9ebf21297)

[✓] Android toolchain - develop for Android devices (Android SDK 28.0.0)
    • Android SDK at
      /Users/pushqrdx/Library/Developer/Xamarin/android-sdk-macosx/
    • Android NDK at
      /Users/pushqrdx/Library/Developer/Xamarin/android-sdk-macosx/ndk-bundle
    • Platform android-28, build-tools 28.0.0
    • ANDROID_HOME =
      /Users/pushqrdx/Library/Developer/Xamarin/android-sdk-macosx/
    • Java binary at:
      /Users/pushqrdx/Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Ho
      me/bin/java
    • Java version OpenJDK Runtime Environment (build 9.0.4+11)
    • All Android licenses accepted.

[✓] iOS toolchain - develop for iOS devices (Xcode 10.1)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 10.1, Build version 10B61
    • ios-deploy 1.9.4
    • CocoaPods version 1.5.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2Important issues not at the top of the work lista: animationAnimation APIsf: material designflutter/packages/flutter/material repository.found in release: 3.3Found to occur in 3.3found in release: 3.5Found to occur in 3.5frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onteam-designOwned by Design Languages teamtriaged-designTriaged by Design Languages team

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions