Skip to content

AnimatedSize needs an example #27386

Closed

Description

@Hixie

Especially because of the vsync argument.

Activity

  1. added
    frameworkflutter/packages/flutter repository. See also f: labels.
    d: api docsIssues with https://api.flutter.dev/
    on Feb 1, 2019
  2. added this to the milestone on Feb 1, 2019
  3. Kartik1607 commented on Feb 1, 2019

    @Kartik1607
    Contributor

    Will this code do? It shows how AnimatedSize can be used to animate inflating of images once loaded instead of simply popping them.

    import 'package:flutter/material.dart';
    
    void main() => runApp(MyApp());
    
    class MyApp extends StatelessWidget {
      // This widget is the root of your application.
      @override
      Widget build(BuildContext context) {
        return MaterialApp(
          title: 'Flutter Code Sample for AnimatedSize',
          theme: ThemeData(
            primarySwatch: Colors.blue,
          ),
          home: MyStatefulWidget(),
        );
      }
    }
    
    class MyStatefulWidget extends StatefulWidget {
      MyStatefulWidget({Key key}) : super(key: key);
    
      @override
      _MyStatefulWidgetState createState() => _MyStatefulWidgetState();
    }
    
    class _MyStatefulWidgetState extends State<MyStatefulWidget>
        with TickerProviderStateMixin {
      Widget build(BuildContext context) {
        return Scaffold(
          body: Center(
            child: AnimatedSize(
              vsync: this,
              duration: const Duration(milliseconds: 500),
              child: Image.network('https://picsum.photos/300/500'),
            ),
          ),
        );
      }
    }

    OUTPUT

    I'll send up a PR if it looks good.

  4. added
    P2Important issues not at the top of the work list
    on May 29, 2020
  5. self-assigned this
    on Jul 2, 2020
  6. modified the milestones: , 1.21 - July 2020 on Jul 2, 2020
  7. agueroveraalvaro commented on Aug 5, 2021

    @agueroveraalvaro

    Someone did use this with stateless widget or only with a single widget? thanks

  8. github-actions commented on Aug 19, 2021

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

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

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listd: api docsIssues with https://api.flutter.dev/frameworkflutter/packages/flutter repository. See also f: labels.waiting for PR to land (fixed)A fix is in flight

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions