Skip to content

Expansion panel top margin animation may be out of sync. #5848

Closed

Description

@dragostis

The top of the expansion panel has a margin that animates from 16dp and 24dp. By playing with it in slow mode, the margin animation appears to sometimes finish first which it shouldn't; they should be in perfect sync.

Activity

  1. added
    p: material_uimaterial_ui package in flutter/packages
    customer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.
    on Sep 13, 2016
  2. modified the milestone: on Nov 29, 2016
  3. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    on May 23, 2017
  4. modified the milestones: , on Jan 7, 2020
  5. TahaTesser commented on May 22, 2020

    @TahaTesser
    Contributor

    Top margin does animate sooner

    ezgif com-resize

    flutter doctor -v
    [✓] Flutter (Channel dev, 1.19.0-1.0.pre, on Mac OS X 10.15.4 19E287, locale
        en-GB)
        • Flutter version 1.19.0-1.0.pre at /Users/tahatesser/Code/flutter_dev
        • Framework revision 456d80b9dd (11 days ago), 2020-05-11 11:45:03 -0400
        • Engine revision d96f962ca2
        • Dart version 2.9.0 (build 2.9.0-7.0.dev 092ed38a87)
    
     
    [✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
        • Android SDK at /Users/tahatesser/Code/SDK
        • Platform android-29, build-tools 29.0.3
        • ANDROID_HOME = /Users/tahatesser/Code/SDK
        • Java binary at: /Applications/Android
          Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build
          1.8.0_212-release-1586-b4-5784211)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 11.5)
        • Xcode at /Applications/Xcode.app/Contents/Developer
        • Xcode 11.5, Build version 11E608c
        • CocoaPods version 1.9.1
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 3.6)
        • Android Studio at /Applications/Android Studio.app/Contents
        • Flutter plugin version 45.1.1
        • Dart plugin version 192.8052
        • Java version OpenJDK Runtime Environment (build
          1.8.0_212-release-1586-b4-5784211)
    
    [✓] VS Code (version 1.45.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.10.2
    
    [✓] Connected device (5 available)
        • Android SDK built for x86 • emulator-5554             • android-x86    •
          Android 10 (API 29) (emulator)
        • Taha’s iPhone             • 00008020-001059882212002E • ios            •
          iOS 13.5
        • macOS                     • macOS                     • darwin-x64     •
          Mac OS X 10.15.4 19E287
        • Web Server                • web-server                • web-javascript •
          Flutter Tools
        • Chrome                    • chrome                    • web-javascript •
          Google Chrome 81.0.4044.138
    
    • No issues found!
    

    Looks like there is no ExpansionPanel in https://gallery.flutter.dev/#/
    Removing gallery label

  6. added
    has reproducible stepsThe issue has been confirmed reproducible and is ready to work on
    and removed
    customer: galleryRelating to flutter/gallery repository. Please transfer non-framework issues there.
    on May 22, 2020
  7. 2 remaining items

  8. modified the milestone: on Jun 1, 2020
  9. removed this from the milestone on Jun 16, 2020
  10. removed this from the milestone on Jul 7, 2020
  11. modified the milestone: on Jul 22, 2020
  12. removed this from the milestone on Aug 17, 2020
  13. TahaTesser commented on Dec 29, 2020

    @TahaTesser
    Contributor
    code sample
    import 'package:flutter/material.dart';
    import 'package:flutter/scheduler.dart';
    
    void main() {
      timeDilation = 10;
      runApp(MaterialApp(
        debugShowCheckedModeBanner: false,
        home: Home(),
      ));
    }
    
    class Home extends StatefulWidget {
      @override
      _HomeState createState() => _HomeState();
    }
    
    class _HomeState extends State<Home> {
      @override
      Widget build(BuildContext context) {
        return Scaffold(
          appBar: AppBar(
            title: Text('Expansion Panel'),
          ),
          body: Container(
            padding: EdgeInsets.all(10),
            child: ListView.builder(
              itemCount: prepareData.length,
              itemBuilder: (BuildContext context, int index) {
                return ExpansionPanelList(
                  animationDuration: Duration(seconds: 1),
                  children: [
                    ExpansionPanel(
                      body: Container(
                        padding: EdgeInsets.all(10),
                        child: Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: <Widget>[
                            Text(
                              'PRICE: ${prepareData[index].bodyModel.price}',
                              style: TextStyle(
                                color: Colors.grey[700],
                                fontSize: 18,
                              ),
                            ),
                            Text(
                              'QUANTITY: ${prepareData[index].bodyModel.quantity}',
                              style: TextStyle(
                                color: Colors.grey[700],
                                fontSize: 18,
                              ),
                            )
                          ],
                        ),
                      ),
                      headerBuilder: (BuildContext context, bool isExpanded) {
                        return Container(
                          padding: EdgeInsets.all(10),
                          child: Text(
                            prepareData[index].header,
                            style: TextStyle(
                              color: Colors.black54,
                              fontSize: 18,
                            ),
                          ),
                        );
                      },
                      isExpanded: prepareData[index].isExpanded,
                    )
                  ],
                  expansionCallback: (int item, bool status) {
                    setState(() {
                      prepareData[index].isExpanded =
                          !prepareData[index].isExpanded;
                    });
                  },
                );
              },
            ),
          ),
        );
      }
    
      List<ItemModel> prepareData = <ItemModel>[
        ItemModel(header: 'Milk', bodyModel: BodyModel(price: 20, quantity: 10)),
        ItemModel(header: 'Coconut', bodyModel: BodyModel(price: 35, quantity: 5)),
        ItemModel(header: 'Watch', bodyModel: BodyModel(price: 800, quantity: 15)),
        ItemModel(header: 'Cup', bodyModel: BodyModel(price: 80, quantity: 150))
      ];
    }
    
    class ItemModel {
      bool isExpanded;
      String header;
      BodyModel bodyModel;
    
      ItemModel({this.isExpanded: false, this.header, this.bodyModel});
    }
    
    class BodyModel {
      int price;
      int quantity;
    
      BodyModel({this.price, this.quantity});
    }
    
    flutter doctor -v
    [✓] Flutter (Channel stable, 1.22.5, on macOS 11.1 20C69 darwin-x64, locale en-GB)
        • Flutter version 1.22.5 at /Users/tahatesser/Code/flutter_stable
        • Framework revision 7891006299 (3 weeks ago), 2020-12-10 11:54:40 -0800
        • Engine revision ae90085a84
        • Dart version 2.10.4
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Volumes/Extreme/sdk
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /Volumes/Extreme/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
        • Xcode 12.3, Build version 12C33
        • CocoaPods version 1.10.0
    
    [!] Android Studio (version 4.1)
        • Android Studio at /Applications/Android Studio.app/Contents
        ✗ Flutter plugin not installed; this adds Flutter specific functionality.
        ✗ Dart plugin not installed; this adds Dart specific functionality.
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
    
    [✓] VS Code (version 1.52.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.18.0
    
    [✓] Connected device (2 available)
        • Taha’s iPad (mobile) • 00008020-000255113EE8402E            • ios • iOS 14.3
        • iPhone 12 (mobile)   • 12D8FF8E-2815-436E-9951-B8A6A42E4ACF • ios • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
    
    ! Doctor found issues in 1 category.
    [✓] Flutter (Channel master, 1.26.0-2.0.pre.145, on macOS 11.1 20C69 darwin-x64, locale en-GB)
        • Flutter version 1.26.0-2.0.pre.145 at /Users/tahatesser/Code/flutter_master
        • Framework revision 38fe7e2b1c (9 hours ago), 2020-12-28 21:39:03 -0500
        • Engine revision 892034dc6a
        • Dart version 2.12.0 (build 2.12.0-179.0.dev)
    
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
        • Android SDK at /Volumes/Extreme/sdk
        • Platform android-30, build-tools 30.0.3
        • ANDROID_HOME = /Volumes/Extreme/sdk
        • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
        • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
        • All Android licenses accepted.
    
    [✓] Xcode - develop for iOS and macOS (Xcode 12.3)
        • Xcode at /Volumes/Extreme/Xcode.app/Contents/Developer
        • Xcode 12.3, Build version 12C33
        • CocoaPods version 1.10.0
    
    [✓] Chrome - develop for the web
        • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
    
    [✓] Android Studio (version 4.1)
        • 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 1.8.0_242-release-1644-b3-6915495)
    
    [✓] VS Code (version 1.52.1)
        • VS Code at /Applications/Visual Studio Code.app/Contents
        • Flutter extension version 3.18.0
    
    [✓] Connected device (4 available)
        • Taha’s iPad (mobile) • 00008020-000255113EE8402E            • ios            • iOS 14.3
        • iPhone 12 (mobile)   • 12D8FF8E-2815-436E-9951-B8A6A42E4ACF • ios            • com.apple.CoreSimulator.SimRuntime.iOS-14-3 (simulator)
        • macOS (desktop)      • macos                                • darwin-x64     • macOS 11.1 20C69 darwin-x64
        • Chrome (web)         • chrome                               • web-javascript • Google Chrome 87.0.4280.88
    
    • No issues found!
  14. morriskurz commented on May 31, 2022

    @morriskurz
    Contributor

    What seems to be the problem is that the first part of the header (i.e. the text) has a height of 48px, compared to the 56px height of the ExpandIcon. This leads to the following problem (zoomed in for clarity):
    2022-05-31 13-48-54
    When the margin of the container expands through the animation, it first fills the parent container evenly. Thus, the text does not move.

  15. github-actions commented on Mar 4, 2023

    @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.

  16. locked as resolved and limited conversation to collaborators on Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Issues that are less important to the Flutter projecta: animationAnimation APIsfound in release: 1.22Found to occur in 1.22found in release: 1.26Found to occur in 1.26frameworkflutter/packages/flutter repository. See also f: labels.has reproducible stepsThe issue has been confirmed reproducible and is ready to work onp: material_uimaterial_ui package in flutter/packages

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions