id
stringlengths
14
17
text
stringlengths
23
1.11k
source
stringlengths
35
114
780aabbc9676-0
Adopt a Widget Contributions How to contribute Discord Guidelines Ways to contribute Adding code Snippets Sample DartPad sample Adding References Adding more explanation to the documentation Quickstart Get the code Open the code in your IDE Make the change Analyzing and Generating API Docs Commit the change Make a pull request Resources Note: The Adopt a Widget program ran during the month of November 2020. Thanks so much for your participation! We may do something similar in the future.
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-1
Flutter is an open source project hosted on GitHub and the API docs (generated from the source code) are hosted on api.flutter.dev. Adopting a widget and improving its documentation helps everyone! So, for the month of November, we’re extending a special invitation to contribute to the Flutter project by choosing a Widget and improving its API documentation. Contributions (Updated Feb 14, 2021) Chinmay-KB contributed to the WillPopScope docs (pull request) chihempat contributed to the SliverWithKeepAliveWidget docs (pull request) obitodarky contributed to the Stepper docs (pull request) Sameerkash found an issue with the StatusTransitionWidget docs (issue) tadaspetra contributed to the MaterialBanner docs (pull request)
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-2
tadaspetra contributed to the MaterialBanner docs (pull request) IsmailAbdirahman contributed to the NotificationListener docs (pull request) Aneesh Rao contributed to the CircularProgressIndicator docs (pull request) Abhishek Ghaskata contributed to the Hero docs (pull request) singhsuryanshu contributed to the FittedBox docs (pull request) parzuko contributed to the Draggable docs (pull request) Oscar Robles contributed to the ActionListener docs (pull request) arps18 contributed to the Shortcuts docs (pull request) Sanjoli Goyal contributed to the ReorderableListView docs (pull request) Amitpatil215 contributed to the AspectRatio docs (pull request) CaptainIRS contributed to the AbsorbPointer docs (pull request)
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-3
CaptainIRS contributed to the AbsorbPointer docs (pull request) Yazeed AlKhalaf contributed to the IgnorePointer docs (pull request) abd99 contributed to the Dismissible docs (pull request) Mitesh Singh contributed to the PageView docs (pull request) redsolver contributed to the Table docs (pull request) tsvillain contributed to the Tooltip docs (pull request) Thesmader contributed to the SnackBar docs (pull request) Muskan Jain contributed to the ColorFiltered docs (pull request) Sergio Eric contributed to the PreferredSizeWidget docs (pull request) How to contribute Go to this list of issues and choose one. You can only be assigned one Adopt A Widget issue at a time, so choose your favorite!
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-4
Leave a comment on the issue, asking to be assigned. The first person to respond will be assigned. For example: Once you are assigned, set up your environment, make the change, and submit the pull request. If you’re not sure how to do this, see the Quickstart guide below. The CONTRIBUTING doc has details on contributing to Flutter. Discord Join the #AdoptAWidget channel on the Flutter Discord server to ask questions and get help. Guidelines Wait to be assigned If you aren’t assigned to the issue, let the assignee fix it. Don’t submit a pull request for someone else’s issue. Respond within three days after being assigned If we don’t hear back from you, we might need to assign it to someone else. One issue at a time
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-5
One issue at a time If you’re already working on an issue, wait until it’s closed before requesting another. Don’t create “Adopt A Widget” issues We are limiting AdoptAWidget to this list of issues. Don’t worry if you don’t get assigned There are plenty of other issues that can be fixed. You can also take a look for issues with the “d: api docs” label that need attention. Be original Don’t copy code snippets or text from other sources like StackOverflow. Ways to contribute Each issue specifies what type of contribution we are looking for: Adding code (either a snippet, sample, or DartPad) Adding references (for example, under “See also”) Adding more explanation to the documentation Adding code
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-6
Adding more explanation to the documentation Adding code There are three ways to contribute code: a snippet, a dartpad, or a sample. For more details, see the Dartdoc Generation README. Please be cognizant that writing sample code has a different goal (and some additional constraints) compared to writing production code. Mozilla has a good overview (the article is about the web, but 95% of it applies to any platform). Snippets Snippets can be added using the following syntax: /// {@tool snippet} /// /// This is a comment explaining the snippet below: /// /// ```dart /// MyWidget( /// color: Colors.green, /// ) /// ``` /// {@end-tool} Sample
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-7
/// ``` /// {@end-tool} Sample Samples are snippets of code that are wrapped with a template, so you don’t have to write boilerplate code. The --template can be any of the templates found in the snippet tool’s templates directory. /// {@tool sample --template=stateless_widget_scaffold_center} /// /// This is a comment explaining the snippet below: /// /// ```dart /// Widget build(BuildContext context) { /// return MyWidget( /// color: Colors.green, /// ); /// } /// ``` /// {@end-tool} DartPad sample
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-8
/// {@end-tool} DartPad sample To add a sample that runs in DartPad, use {@tool dartpad} and provide the same templates found in the templates directory: /// {@tool dartpad --template=stateless_widget_material} /// /// This is a comment explaining the snippet below: /// /// ```dart /// Widget build(BuildContext context) { /// return MyWidget( /// color: Colors.green, /// ); /// } /// ``` /// {@end-tool} Adding References If a Widget needs references, add a See also: section to the end of a widget’s documentation comment: /// Creates a route for the given route settings. ///
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-9
/// Creates a route for the given route settings. /// /// Used by [Navigator.onGenerateRoute]. /// /// See also: /// /// * [Navigator], which is where all the [Route]s end up. Adding more explanation to the documentation If a widget doesn’t provide enough explanation, you can add more! You can explain: What it is What it enables you to do How to use it The behavior of the widget in certain situations Other important information about the widget See the documentation section of the Flutter Style Guide and Effective Dart - Documentation for details on how to write great documentation. Quickstart Use the following instructions to get started. Get the code
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-10
Use the following instructions to get started. Get the code To get started, fork the SDK and use git to fetch a local copy: Install dependencies listed in Setting up the Framework development environment. Fork the Flutter repo. For more information, see GitHub’s official instructions. Clone your fork: `git clone https://github.com//flutter.git`</nobr> Change directory into the repo: cd flutter Add an upstream remote: `git remote add upstream [email protected]:flutter/flutter.git` Run flutter update-packages to fetch all the Dart packages that Flutter uses. Open the code in your IDE In IntelliJ or VSCode, open packages/flutter, where most of the Flutter framework code lives. Make the change
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-11
Make the change Open the file listed in the issue and update the documentation. See “Ways to contribute” for examples. Analyzing and Generating API Docs Running this command from the root directory analyzes and generates the documentation. This command can take up to 20 minutes to complete, so double check your changes first. If you want, you can also analyze snippets directly. To view the generated docs, open dev/docs/doc/api/index.html. Note: Flutter API docs cannot be generated on Windows. If you are using Windows, you may need to download the Linux version of the SDK and use the Windows Subsystem for Linux. For more information, see the Dartdoc Generation README. Commit the change Modify the documentation and commit the change: b update-builder-widget git add A git commit m
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-12
A git commit m "Update Builder API Docs" git push origin update-builder-widget Make a pull request Make a pull request with AdoptAWidget: WidgetName in the title, and fill out this template: <!-- Provide an explanation of the change --> <!-- Specify what this pull request does --> This pull request is: [x] A code sample [ ] More references [ ] More explanation <!-- Add the AdoptAWidget issue that is assigned to you: --> closes #1234 Note: If you are a first-time contributor to this repo, you will be asked to sign Google’s Contributor License Agreement. Resources Setting up the Framework development environment CONTRIBUTING Dartdoc Generation README
https://docs.flutter.dev/adoptawidget/index.html
780aabbc9676-13
CONTRIBUTING Dartdoc Generation README Flutter Style Guide - Documentation Effective Dart - Documentation
https://docs.flutter.dev/adoptawidget/index.html
7ef9fa334f60-0
Fall 2021 Flutter Apprentice event The Flutter Apprentice event has ended. Thanks to all who participated! If you missed the event, you can purchase the Flutter Apprentice book from raywenderlich.com, and watch the free book club replay videos. Book club replay videos You can find replays of the book club videos on YouTube. Chapters covered Topic Video replay 1, 2 Getting started week 1 replay 3, 4 Widgets week 2 replay 5, 6 More widgets week 3 replay 7, 8 Navigation week 4 replay 9, 15
https://docs.flutter.dev/apprentice-giveaway/index.html
7ef9fa334f60-1
week 4 replay 9, 15 Data persistence week 5 replay 10, 11 Networking & serialization week 6 replay 12, 14 Chopper & streams week 7 replay 13 State management week 8 replay 19 Firebase week 9 replay 16, 17, 18 Deployment week 10 replay
https://docs.flutter.dev/apprentice-giveaway/index.html
d01d7ce9d703-0
Flutter Brand Guidelines General Rules That Govern the Use of the Flutter Trademarks Specific Rules for Proper Usage of the Flutter Trademarks Community Use Exceptions The “Flutter” name and logo are trademarks owned by Google. These Brand Guidelines describe the appropriate uses of the Flutter trademarks by members of the developer community who have obtained our consent to use the trademarks pursuant to the Flutter Terms of Service. These guidelines will ensure that the Flutter trademarks are used in a manner that promotes Google’s mission to provide a free and open source SDK for crafting high-quality native interfaces on iOS and Android in record time, and are not associated with objectionable material, as determined by Google. Use of the Flutter trademarks that is not expressly permitted by these guidelines is prohibited absent written permission from Google.
https://docs.flutter.dev/brand/index.html
d01d7ce9d703-1
The official Flutter assets and further guidelines on representing the brand can be found at Representing the Flutter Brand. General Rules That Govern the Use of the Flutter Trademarks You are free to use the Flutter trademarks: (i) in connection with your download and use of the Flutter SDK to build and develop apps, (ii) in training materials (e.g., video tutorials, online publications, etc.) that provide instructions or tips regarding how to use the Flutter SDK to build and develop apps, and (iii) to show your support for the use of the Flutter SDK by members of the developer community. These guidelines do not restrict your right to use the “Flutter” name in connection with descriptions of the Flutter SDK that would be considered “fair use.” For example, you may use the “Flutter” name to make truthful factual statements (e.g., “built with the Flutter SDK”) or to accurately describe a feature of the Flutter SDK.
https://docs.flutter.dev/brand/index.html
d01d7ce9d703-2
You may use the Flutter trademarks on your personal website, personal blog, or social media account to show your support for the Flutter SDK, provided you do not use the Flutter trademarks in a way that could confuse people into thinking that your site is an official Google site or that Google has sponsored or endorsed your site. In the case of websites or personal blogs, this means you should not use the Flutter trademarks as the primary element on the webpage (e.g., in the masthead of the webpage or the title of the blog). In the case of social media accounts, this means you should not use the Flutter trademarks in the background, in your profile image or in your social media username. Specific Rules for Proper Usage of the Flutter Trademarks In addition to the general rules discussed above, below are specific rules governing the proper use of the Flutter trademarks. DO:
https://docs.flutter.dev/brand/index.html
d01d7ce9d703-3
DO: Use the “Flutter” name as an adjective, never as a noun or verb, and never in the plural or possessive form. Use a generic term following the “Flutter” name, for example, “the Flutter SDK” or “the Flutter UI toolkit.” Distinguish the “Flutter” name from the surrounding text in some way. Capitalize the first letter, capitalize or italicize the entire mark, place the mark in quotes, use a different type style or font for the mark. Use the trademark symbol TM for the first or most prominent time the “Flutter” name appears in text on your website or blog. Make sure to always use the TM symbol, not the ® symbol. Include the following text near the first or most prominent use of the Flutter marks on your website or blog: “Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.”
https://docs.flutter.dev/brand/index.html
d01d7ce9d703-4
Keep some distance between the Flutter trademarks and any other trademarks, logos, or icons that are displayed on the webpage. DON’T: Don’t alter, distort, or modify the Flutter trademarks in any way. This includes varying the spelling of the “Flutter” name, or displaying the Flutter logo with color variations or unapproved visual elements. Don’t combine the Google name with the “Flutter” name to form a unitary brand (e.g., don’t use the phrases “Google Flutter” or “Google’s Flutter”). You may use the Google name in full text to accurately describe the Flutter SDK (e.g., “The Flutter SDK by Google”). Don’t register the Flutter trademarks or any trademarks, logos, or domain names that are confusingly similar to them.
https://docs.flutter.dev/brand/index.html
d01d7ce9d703-5
Don’t incorporate the Flutter trademarks into your own product names, service names, trademarks, logos, or company names. Don’t display the Flutter trademarks in a manner that is misleading, unfair, defamatory, infringing, libelous, disparaging, obscene or otherwise objectionable to Google. Don’t use the Flutter trademarks on or in connection with the sale of any non-software goods or services (e.g., merchandise such as clothing, pens, and stickers). Community Use Exceptions To allow for the use of the Flutter trademarks by the Flutter community, below are specific exceptions to the rules described above:
https://docs.flutter.dev/brand/index.html
d01d7ce9d703-6
Local Flutter user groups may: (i) use the “Flutter” name as part of their social media username in the following format: “Flutter + [name of country/city]” (e.g., “Flutter France”); and (ii) use the Flutter logo in the national colors of the country where the user group is based (e.g., for a user group based in France, the colors blue, white and red), provided the Flutter logo is otherwise unaltered. Such social media accounts should include a disclaimer that clarifies that it is not an official Google account.
https://docs.flutter.dev/brand/index.html
d01d7ce9d703-7
You may use the Flutter trademarks as part of the name of a newsletter or related community content (e.g., Flutter training courses, Flutter community forums) whose purpose is to promote the use of the Flutter SDK by members of the developer community. Where the Flutter trademarks are displayed on a website as part of a community site name, you should use the trademark symbol TM after the most prominent appearance of the “Flutter” name and include the following text: “Flutter and the related logo are trademarks of Google LLC. We are not endorsed by or affiliated with Google LLC.” Where the Flutter trademarks are displayed on a social media account as part of a community site name, you should include a disclaimer that clarifies that it is not an official Google account.
https://docs.flutter.dev/brand/index.html
d01d7ce9d703-8
[Unofficial Flutter Events] You may use the Flutter trademarks as part of the name of a community event (e.g. conference), but please make sure to include the following disclaimer on the event website in a prominent and easy-to-see spot: “Flutter and the related logo are trademarks of Google LLC. [Title of event] is not affiliated with or otherwise sponsored by Google LLC.”
https://docs.flutter.dev/brand/index.html
fbbe27f7bffb-0
Looking for inspiration? See examples of what developers built with Flutter! Flutter Clock Challenge Share #FlutterClock with friends Watch video Results Create a beautiful clock face UI Build a beautiful clock face UI with Flutter for the Lenovo Smart Clock for a chance to win an iMac Pro, Lenovo Smart Display, or Lenovo Smart Clock. Submissions period has ended on January 20, 2020. Please scroll down to see the results. Flutter Clock Highlight Reel Flutter Clock contest is brought to you in partnership with Google Assistant and Lenovo. All Winners Check out this article to read more about this year's results. Grand Prize Winner Particle Clock by Mickel Andersson Category Winners
https://docs.flutter.dev/clock/index.html
fbbe27f7bffb-1
Particle Clock by Mickel Andersson Category Winners Visual Beauty Cloom Clock by Filipe Barroso and Francisco Frutuoso Code Quality Creative Creator Or Maybe Not Clock by Hubert Henkemeier Overall Execution Humanbeans Clock by Boris Brestnichki Novelty Sunset Reflections Clock by Victor Morilla Honorable Mentions Agent Clock by Thomas Krueger Animal Clock by Sei Lee Ants Clock by Pau Picas Sans BarBar Clock by Aleksandr Troshkov Boating Clock by Yi He Circle Clock by Max Bowser DJ Clock by Bao Hui Huang
https://docs.flutter.dev/clock/index.html
fbbe27f7bffb-2
DJ Clock by Bao Hui Huang Dots Clock by Tran Duy Khanh Steffen Flutter Clock by Dezso Meszaros Flutter Clock by Dominik Roszkowski Flutter Clock by Helge Wieding Flutter Clock by Masayuki Ono Flutter Clock by Vyacheslav Ryabinin Freehand Clock by Tyler Hayes Generative Clock by Fabian Stein Infinity Clock by Akash Divya Iso Clock by Scott Cook Lofi Clock by Michael Wilson Matches Clock by Mikołaj Lenart Paper Clock by Ryan Taylor Scenery Clock by Valerii Kuznietsov Snake Clock by Gilles Devillers
https://docs.flutter.dev/clock/index.html
fbbe27f7bffb-3
Snake Clock by Gilles Devillers Star Clock by Philipp Bauer Steampunk Clock by Roman Cinis Tetris Time Clock by Michael Jentsch
https://docs.flutter.dev/clock/index.html
508c079ecf33-0
Explicit animations What are explicit animations? Animation concepts What is animation? Example: bouncing ball (starter code 1) Frame rate Example: bouncing ball (starter code 2) Interpolation Example: bouncing ball (starter code 3) AnimationController What is an AnimationController? Create your first explicit animation with AnimationController 1. Use a TickerProvider mixin 2. Instantiate and dispose of AnimationController in lifecycle methods 3. Pass AnimationController parameters 4. Add listener(s) 5. Trigger the animation AnimationController concepts The Animation object AnimationController interpolates frame values AnimationController doesn’t know anything about the UI Curves Tweens AnimatedBuilder AnimatedWidget
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-1
Tweens AnimatedBuilder AnimatedWidget Welcome to the explicit animations codelab, where you learn how to create animations with more complex and custom features than can be achieved using implicit animations. Note: This codelab is not yet complete. Note: This codelab uses embedded DartPads to display examples and exercises. If you see empty boxes instead of DartPads, check out Troubleshooting DartPad. To get the most out of this codelab, you should have basic knowledge of the following: How to make a Flutter app. How to use stateful widgets. This codelab covers the following material: Animation concepts Using AnimationController to implement explicit animations Choosing between implicit and explicit animations What are explicit animations?
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-2
Choosing between implicit and explicit animations What are explicit animations? Explicit animations are a set of controls for telling Flutter how to rapidly rebuild the widget tree while changing widget properties to create animation effects. This approach enables you to create effects that you can’t achieve using implicit animations. Animation concepts Learning to create explicit animations can be daunting if you are new to animation in general. The following section equips you with animation concepts that help you better grasp how explicit animations work in Flutter. The subsequent sections relate these concepts to the corresponding tools and methods of explicit animations. If you are already experienced with animation, you can skip this section and move on to the AnimationController section. What is animation?
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-3
What is animation? Think about how animations work in a flip-book, or cartoons on TV, or a movie reel. What do these animation technologies have in common? They create the illusion of motion by rapidly transitioning a single frame that you are viewing to other frames within a pre-defined sequence. Suppose you want to create your own Flutter animation without using the animations library. Start with the simplest case possible: Your goal is to animate a ball so that it repeatedly bounces up and down. The following example demonstrates a first attempt using a naive approach. Can you spot the lines of code that create the effect? Example: bouncing ball (starter code 1)
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-4
Example: bouncing ball (starter code 1) The preceding example uses the container’s margin property to alternate the position of the ball on the screen, and a periodic timer to control how frequently the ball changes its position (once every second). As a viewer, this approach leaves a lot to be desired. The ball only has two positions, so the animation looks pretty choppy—you could easily mistake the animation for a glitch. To describe this problem in animation terms, you would say that the animation alternates between only two frames: Note: In this example, you are creating an animation effect that only looks like it is running at two frames per second. In reality, Flutter is running this example at ~60 frames per second. frame # position movement direction top margin: 0 top margin: 100 down top margin: 0 up
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-5
down top margin: 0 up Most importantly, this example demonstrates at a basic level how frames are used to create animations: A frame is a single still image that can be used within a sequence of other still images to create the illusion of motion. In this case, the first frame consists of a ball centered on the screen, and the second frame consists of the same ball placed further down on the screen using the top margin property. PENDING: # image: a frame in Flutter
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-6
PENDING: # image: a frame in Flutter Even this though example doesn’t use Flutter’s animation library, it creates an animation in fundamentally the same way: by telling Flutter to rebuild its widget tree so as to rapidly move between frames over a specified period of time. This is an important takeaway to keep in mind while creating explicit animations. At a fundamental level, explicit animations provide you with controls for telling Flutter how to quickly rebuild a widget tree to create the illusion of motion. You’ll learn more about these controls later in this codelab. Given what you’ve learned so far, can you think of a way to improve the bouncing ball effect in the preceding example? Try to come up with an answer before diving into the next section. Quick review: A frame is a single still image that can be used within a sequence of other still images to create the illusion of motion.
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-7
In Flutter, you can think of a single frame as a static configuration of a widget tree. An animation is a sequence of frames that, when rapidly displayed over time, creates the illusion of motion. In Flutter, an animation changes a widget property value between frames to create the illusion of motion. You can create an animation by telling Flutter to rapidly rebuild a widget tree while gradually changing a widget property on each iteration of the widget tree. The first example uses a timer to trigger a change in the top margin of the bouncing ball once every second. Frame rate
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-8
Frame rate The previous example represents a naive approach to animating a bouncing ball: it alternates the position of the ball between only two frames, switching frames once every second. One way to improve this animation is to use more frames, which smoothes out the animation and provides a more convincing illusion of movement. Consider what changes you need to make to the example so that, instead of having just two positions, the ball has five: frame # position movement direction top margin: 0 top margin: 25 down top margin: 50 down top margin: 75 down top margin: 100 down top margin: 75 up top margin: 50 up
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-9
up top margin: 50 up top margin: 25 up top margin: 0 up Now that you are using more frames, in order to keep the ball bouncing at the same rate (one bounce per second) you need to increase the frame rate. The frame rate is the rate of frames per second (fps). In this case, you are increasing the frame rate from 2 frames per second to 4 fps. Even though you are using five total frames, the first frame gets re-used for the downward and upward motion of the ball, so you only need to count it once for the purpose of determining the frame rate.
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-10
Now that you have increased the frame rate for this animation, you can also calculate the new value that the margin should change in each frame. As the preceding chart makes clear, now that there are 5 frames instead of 2, and since the top margin value remains between 0 and 100 throughout the animation, each frame either increases or decreases the ball’s top margin value by 25. Change in margin value between each frame = total change in margin / # of frames In this case, the top margin changes by 100 over 4 frames, so each frame changes the top margin value by 25. (Even though there are 5 total frames, in this example you are reusing one frame for both the downward and upward motion of the ball, so you only need to count 4 frames for the margin change.)
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-11
That’s it! With the updated frame rate and the top margin values needed for each frame, you now have enough information to update the preceding example by doubling the frame rate that the animation uses. Before diving into the following example, think about how you might refactor the preceding example using these updated parameters. You can use the DartPad editor in the preceding example to try out your solution. When you’re ready, run the next example to view the updated animation: Example: bouncing ball (starter code 2) Quick Review: Frame rate is measured as the number of frames per second (fps). Flutter aims to provide 60 fps performance, or 120 fps performance on devices capable of 120Hz updates. For 60fps, frames need to render approximately every 16ms. See performance profiling page for more information. Interpolation
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-12
Interpolation Have you ever wondered how computer graphics animators draw each and every frame of your favorite CGI movies? Well, they don’t! Instead, animators set an initial position and a final position for the object they are animating. Next, they rely on software to compute all of the positions for the object between the initial and the final position that they defined. The process of computing animation values between a starting and ending position is called interpolation. As a developer, interpolation vastly simplifies how you reason about and create your animations. Instead of thinking of an animation in terms of hundreds (or thousands) of frames, you can think of an animation as a starting value and an ending value, and allow interpolation to take care of the rest!
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-13
The preceding example uses an imperative approach for calculating the values for each frame in the animation: you explicitly provide values for the frame rate as well as the value needed to increment the top margin property for each frame. Can you think of a way to refactor this example so that you only need to provide a starting and ending value for top margin, and leave the rest to an interpolation function the generates the values for the frames in between? Here’s a few hints: Don’t worry about animating the ball up and down. Just focus on the first downward motion of the ball (from a top margin of 0 to top margin of 100). Try using 60 fps for the frame rate. For any starting or ending position of the ball, you can express the amount to increment top margin between each frame as the difference between the margin’s starting and ending values divided by the total number of frames.
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-14
The following example contains one way to implement these updates to the bouncing ball example. Run the example to the see the difference that these updates make to your animation: Example: bouncing ball (starter code 3) At 60 fps, this updated version of the bouncing ball animation looks smoother than in all prior examples! This example only creates half of the animation—the ball moves down, but not back up again. Wouldn’t it be nice to have a declarative interface for controlling the direction that the animation proceeds across the sequence of frames, and the conditions for starting and stopping it? This way, you could easily represent when to start the animation, pause it, play forward, play backward, end it, or repeat it indefinitely. In the next section, you’ll learn how Flutter’s animation library provides an interface for doing all of these things. Quick review:
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-15
Quick review: Interpolation is the process of computing all animation values between a starting and ending value. Instead of thinking about an animation in terms of hundreds (or thousands) of frames, interpolation allows you to reason about and define an animation in terms of its starting and ending value. Bonus questions! In the prior example, the rate of change for the bouncing ball’s top margin value is linear (the margin changes by the same amount between each frame). How would you change this example to make it possible to interpolate values between 0 and 100 at a changing rate? The prior example only animates a single downward motion of the bouncing ball. Can you think of a way to: Continue the animation so that the ball bounces back up again? Repeat the animation indefinitely? AnimationController
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-16
AnimationController The AnimationController is a special Animation object that generates a new value whenever the hardware is ready for a new frame. All explicit animations require an AnimationController. What is an AnimationController? Whether the animation should progress forward or backward through the range of values once triggered. The amount(s) that an animation’s value changes between each frame. The following sections demonstrate how to use AnimationController by providing step-by-step instructions for creating your first explicit animation with AnimationController[] and by covering the underlying concepts of AnimationController. Create your first explicit animation with AnimationController The following example begins with no animation code—it consists of a Material app home screen containing a green ball shape. PENDING: Insert DartPad here
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-17
PENDING: Insert DartPad here This section provides guided steps for building the same bouncing ball animation created in the Animation concepts section— the difference is that this example uses an explicit animation, whereas the animation concepts section uses a naive approach in order to introduce fundamental animation concepts. PENDING : bouncing ball example Use the following instructions to create an explicit animation of a bouncing ball: 1. Use a TickerProvider mixin {explicit1 → explicit2}/lib/main.dart @@ -9,7 +9,8 @@ 9 9 State<BouncingBallDemo> createState() => _BouncingBallDemoState(); 10 10 11 class _BouncingBallDemoState extends State<BouncingBallDemo> { 11
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-18
11 + class _BouncingBallDemoState extends State<BouncingBallDemo> 12 + with SingleTickerProviderStateMixin { 12 13 @override 13 14 void initState() { 14 15 super.initState(); This step uses the SingleTickerProviderStateMixin with _BouncingBallDemoState, but you can also use TickerProviderStateMixin to make your widget available as a TickerProvider for AnimationController. Here are some considerations for deciding between the two: If you are only creating a single AnimationController from a State object (as in this example) you can use the SingleTickerProviderStateMixin.
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-19
If you need to create more than one AnimationController over the lifetime of a State object, use the TickerProviderStateMixin instead. The SingleTickerProviderStateMixin is slightly more efficient than TickerProviderStateMixin in the case of the class only ever needing one Ticker. 2. Instantiate and dispose of AnimationController in lifecycle methods Instantiate AnimationController in a widget lifecycle method, and call the AnimationController.dispose() within the State.dispose() lifecycle method: {explicit2 → explicit3}/lib/main.dart @@ -1,3 +1,5 @@ + // ignore_for_file: missing_required_argument 1 3 import 'dart:async'; 2 4 import 'package:flutter/material.dart';
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-20
2 4 import 'package:flutter/material.dart'; @@ -11,9 +13,12 @@ 11 13 class _BouncingBallDemoState extends State<BouncingBallDemo> 12 14 with SingleTickerProviderStateMixin { 15 + late AnimationController controller; 16 13 17 @override 14 18 void initState() { 15 19 super.initState(); 20 + controller = AnimationController(); 16 21 17 22 @override
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-21
17 22 @override @@ -30,6 +35,12 @@ 30 35 ), 31 36 ); 32 37 38 39 + @override 40 + void dispose() { 41 + controller.dispose(); 42 + super.dispose(); 43 + } 33 44 34 45 class MyApp extends StatelessWidget { This code is not yet valid because it passes no arguments to AnimationController’s constructor.
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-22
Remember the following observations whenever performing this step with AnimationController: You can instantiate AnimationController in several different lifecycle methods, but it is most common to use initState(). You should dispose of an AnimationController when it is no longer needed—this reduces the likelihood of memory leaks. Always dispose of AnimationController within the dispose() lifecycle method. 3. Pass AnimationController parameters Pass arguments for vsync, duration, lowerBound, and upperBound to the AnimationController constructor: {explicit3 → explicit4}/lib/main.dart @@ -1,5 +1,3 @@ // ignore_for_file: missing_required_argument 3 1 import 'dart:async'; 4 2 import 'package:flutter/material.dart';
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-23
4 2 import 'package:flutter/material.dart'; @@ -18,7 +16,12 @@ 18 16 @override 19 17 void initState() { 20 18 super.initState(); 21 controller = AnimationController(); 19 + controller = AnimationController( 20 + vsync: this, // the SingleTickerProviderStateMixin 21 + duration: const Duration(seconds: 1), 22 + lowerBound: 0, 23 + upperBound: 100,
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-24
+ upperBound: 100, 24 + ); 22 25 23 26 @override The vsync parameter makes use of the SingleTickerProviderStateMixin you added in step 1: vsync: Remember from step 1 that vsync is a required parameter that takes a TickerProvider. By passing this for the vsync parameter, you are passing _BouncingBallDemoState as the TickerProvider object to the AnimationController constructor. _BouncingBallDemoState implements the TickerProvider interface because step 1 adds the SingleTickerProviderStateMixin with _BouncingBallDemoState. The duration, upperBound, and lowerBound parameters define the following parts of your animation: duration: The duration of the animation is 1 second.
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-25
duration: The duration of the animation is 1 second. upperBound and lowerBound: Since the bouncing ball animation moves the ball by transitioning its top-margin value from 0 to 100, this step passes 0 as the lowerBound and 100 as the upperBound. 4. Add listener(s) {explicit4 → explicit5}/lib/main.dart @@ -22,12 +22,16 @@ 22 22 lowerBound: 0, 23 23 upperBound: 100, 24 24 ); 25 26 + controller.addListener(() { 27 + setState(() {}); 28
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-26
+ setState(() {}); 28 + }); 25 29 26 30 @override 27 31 Widget build(BuildContext context) { 28 32 return Container( 29 margin: const EdgeInsets.only(top: 0), 33 + margin: EdgeInsets.only(top: controller.value), 30 34 child: Container( 31 35 decoration: const BoxDecoration( 32 36 shape: BoxShape.circle, 5. Trigger the animation
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-27
shape: BoxShape.circle, 5. Trigger the animation To start the bouncing ball animation so that it repeats indefinitely, call AnimationController.repeat(): {explicit5 → explicit6}/lib/main.dart @@ -26,6 +26,8 @@ 26 26 controller.addListener(() { 27 27 setState(() {}); 28 28 }); 29 30 + controller.repeat(reverse: true); 29 31 30 32 @override This step calls repeat() within initState() because the bouncing ball animation can begin immediately when this view is
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-28
AnimationController provides several methods for “driving” an animation: repeat() forward() reverse() stop() reset() Run the following example to see this explicit animation in action! AnimationController concepts As the name suggests, the AnimationController controls the animation. The Animation object Lifecycle of an animation (completed, dismissed) An Animation has a status and a value. The value depends on what the user wants, and can be of any type, such as or . The controller’s status has four possible values: dismissed, forward, reverse, and completed. AnimationController is the central class that you use to create explicit animations; its capabilities fall into four categories: defining animations, generating animation values, registering listeners, and play or sequence controls:
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-29
AnimationController makes it easy to access the current value of the animation—just use the value property. To “play” an animation, you can use one of several methods that initiate the sequence of changes to value. For example, to “play” an animation from its starting value to its ending value, simply call forward(). Use .addListener() to register a callback invoked whenever AnimationController changes its value property. Most commonly, you register setState() with AnimationController. This tells Flutter to rebuild the widget tree whenever AnimationController’s value changes. AnimationController needs a TickerProvider to synchronize the animation’s behavior to the device’s display. AnimationController interpolates frame values PENDING: Image of values in AnimationController In this example, the AnimationController constructor takes the optional parameters lowerBound, upperBound, and duration: Instantiate AnimationController: controller
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-30
Instantiate AnimationController: controller AnimationController lowerBound: upperBound: 100 duration: const Duration seconds: ), vsync: this // Don't worry about vsync for now. ); When you instantiate AnimationController, you define an animation in terms of its starting value (lowerBound), its ending value (upperBound), and the amount of time it takes to change from one to the other (duration). The default values for lowerBound and upperBound are 0 and 1, respectively; duration doesn’t have a default value. Animation concepts section uses an
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-31
Animation concepts section uses an AnimationController abstracts away the work of interpolation, allowing you to reason about and create an animation in terms of its duration, and the starting and ending values of the property that you are animating: AnimationController doesn’t know anything about the UI Access animation values with controller.value AnimationController provides a value property. You can access this property directly—there is no getter method for value: print controller value ); Curves Use CurvedAnimation you can use presets, or create your own Tweens To use a Tween call animate() passing in the controller. (example) AnimatedBuilder AnimatedWidget TODO: Explain that setState listener boilerplate isn’t normal.
https://docs.flutter.dev/codelabs/explicit-animations/index.html
508c079ecf33-32
Explain that setState listener boilerplate isn’t normal. Add section that uses AnimatedBuilder/AnimatedWidget Refactor all DartPad samples to use non-working defaults, & offer solution Update vanilla bouncing ball final example to use both upward and downward motion “Why TickerProvider?” in animationController concepts section How to choose between AnimatedBuilder and AnimatedWidget. Answer question: when to use a Tween, if you can just use upper and lower bound args for AnimationController? when we need something other than a double? Add margin-bottom to DartPads Add diffs between each solution in the introduction section
https://docs.flutter.dev/codelabs/explicit-animations/index.html
0593b336d361-0
Implicit animations What are implicit animations? Example: Fade-in text effect Fade-in (starter code) Animate opacity with AnimatedOpacity widget 1. Pick a widget property to animate 2. Initialize a state variable for the animated property 3. Set the duration of the animation 4. Set up a trigger for the animation, and choose an end value Fade-in (complete) Putting it all together Example: Shape-shifting effect Shape-shifting (starter code) Animate color, borderRadius, and margin with AnimatedContainer 1. Add an implicit animation 2. Set starting values for animated properties 3. Set up a trigger for the animation 4. Set duration Shape-shifting (complete) Using animation curves Putting it all together What’s next?
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-1
What’s next? Welcome to the implicit animations codelab, where you learn how to use Flutter widgets that make it easy to create animations for a specific set of properties. Note: This codelab uses embedded DartPads to display examples and exercises. If you see empty boxes instead of DartPads, check out Troubleshooting DartPad. To get the most out of this codelab, you should have basic knowledge about: How to make a Flutter app. How to use stateful widgets. This codelab covers the following material: Using AnimatedOpacity to create a fade-in effect. Using AnimatedContainer to animate transitions in size, color, and margin. Overview of implicit animations and techniques for using them. Estimated time to complete this codelab: 15-30 minutes.
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-2
Estimated time to complete this codelab: 15-30 minutes. What are implicit animations? With Flutter’s animation library, you can add motion and create visual effects for the widgets in your UI. One widget set in the library manages animations for you. These widgets are collectively referred to as implicit animations, or implicitly animated widgets, deriving their name from the ImplicitlyAnimatedWidget class that they implement. With implicit animations, you can animate a widget property by setting a target value; whenever that target value changes, the widget animates the property from the old value to the new one. In this way, implicit animations trade control for convenience—they manage animation effects so that you don’t have to. Example: Fade-in text effect
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-3
Example: Fade-in text effect The following example shows how to add a fade-in effect to existing UI using an implicitly animated widget called AnimatedOpacity. The example begins with no animation code—it consists of a Material App home screen containing: A photograph of an owl. One Show details button that does nothing when clicked. Description text of the owl in the photograph. Fade-in (starter code) Click the Run button to run the example: Animate opacity with AnimatedOpacity widget This section contains a list of steps you can use to add an implicit animation to the fade-in starter code. After the steps, you can also run the fade-in complete code with the changes already made. The steps outline how to use the AnimatedOpacity widget to add the following animation feature: The owl’s description text remains hidden until the user clicks the Show details button.
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-4
The owl’s description text remains hidden until the user clicks the Show details button. When the user clicks the Show details button, the owl’s description text fades in. 1. Pick a widget property to animate To create a fade-in effect, you can animate the opacity property using the AnimatedOpacity widget. Change the Column widget to an AnimatedOpacity widget: {opacity1 → opacity2}/lib/main.dart @@ -2,6 +2,8 @@ 2 2 // Use of this source code is governed by a BSD-style license 3 3 // that can be found in the LICENSE file. + // ignore_for_file: missing_required_argument 4 6 import 'package:flutter/material.dart'; 5 7
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-5
import 'package:flutter/material.dart'; 5 7 const owlUrl = @@ -25,12 +27,14 @@ 25 27 style: TextStyle(color: Colors.blueAccent), 26 28 ), 27 29 onPressed: () => {}), 28 Column( 29 children: const [ 30 Text('Type: Owl'), 31 Text('Age: 39'), 32 Text('Employment: None'), 33 ], 30 + AnimatedOpacity(
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-6
30 + AnimatedOpacity( 31 + child: Column( 32 + children: const [ 33 + Text('Type: Owl'), 34 + Text('Age: 39'), 35 + Text('Employment: None'), 36 + ], 37 + ), 34 38 35 39 ]); 36 40 You can reference the line numbers in the example code to help track where to make these changes.
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-7
2. Initialize a state variable for the animated property To hide the text before the user clicks Show details, set the starting value for opacity to zero: {opacity2 → opacity3}/lib/main.dart @@ -2,8 +2,6 @@ 2 2 // Use of this source code is governed by a BSD-style license 3 3 // that can be found in the LICENSE file. // ignore_for_file: missing_required_argument 6 4 import 'package:flutter/material.dart'; 7 5 const owlUrl = @@ -17,6 +15,8 @@ 17 15 18 16
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-8
17 15 18 16 class _FadeInDemoState extends State<FadeInDemo> { 17 + double opacity = 0.0; 18 19 19 @override 20 20 Widget build(BuildContext context) { 21 21 return Column(children: <Widget>[ @@ -28,6 +28,8 @@ 28 28 ), 29 29 onPressed: () => {}), 30 30 AnimatedOpacity( 31 + duration: const Duration(seconds: 3),
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-9
+ duration: const Duration(seconds: 3), 32 + opacity: opacity, 31 33 child: Column( 32 34 children: const [ 33 35 Text('Type: Owl'), 3. Set the duration of the animation In addition to an opacity parameter, AnimatedOpacity requires a duration to use for its animation. For this example, you can start with 2 seconds: {opacity3 → opacity4}/lib/main.dart @@ -28,7 +28,7 @@ 28 28 ), 29 29 onPressed: () => {}), 30 30
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-10
onPressed: () => {}), 30 30 AnimatedOpacity( 31 duration: const Duration(seconds: 3), 31 + duration: const Duration(seconds: 2), 32 32 opacity: opacity, 33 33 child: Column( 34 34 children: const [ 4. Set up a trigger for the animation, and choose an end value {opacity4 → opacity5}/lib/main.dart @@ -22,11 +22,14 @@ 22 22 return Column(children: <Widget>[ 23 23 Image.network(owlUrl),
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-11
23 23 Image.network(owlUrl), 24 24 TextButton( 25 child: const Text( 26 'Show Details', 27 style: TextStyle(color: Colors.blueAccent), 28 ), 29 onPressed: () => {}), 25 + child: const Text( 26 + 'Show Details', 27 + style: TextStyle(color: Colors.blueAccent), 28 + ), 29
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-12
+ ), 29 + onPressed: () => setState(() { 30 + opacity = 1; 31 + }), 32 + ), 30 33 AnimatedOpacity( 31 34 duration: const Duration(seconds: 2), 32 35 opacity: opacity, Notice that you only need to set the start and end values of opacity. The AnimatedOpacity widget manages everything in between. Fade-in (complete) Here’s the example with the completed changes you’ve made—run this example and click the Show details button to trigger the animation. Putting it all together
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-13
Putting it all together The Fade-in text effect example demonstrates the following features of AnimatedOpacity: AnimatedOpacity listens for state changes in its opacity property. Whenever opacity changes, AnimatedOpacity automatically animates the widget’s transition to the new value for opacity. AnimatedOpacity requires a duration parameter to define the time it takes to animate the transition between an old opacity value and a new one. Note that Implicit animations can only animate properties of a parent StatefulWidget, so this example begins with the FadeInDemo widget that extends StatefulWidget. Notice also that AnimatedOpacity animates a single property: opacity. Some implicitly animated widgets can animate many properties, as the following example illustrates. Example: Shape-shifting effect AnimatedContainer widget to animate multiple properties ( Material App home screen that contains:
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-14
Material App home screen that contains: A Container with borderRadius, margin, and color properties that are different each time you run the example. A Change button that does nothing when clicked. Shape-shifting (starter code) Click the Run button to run the example: Animate color, borderRadius, and margin with AnimatedContainer This section contains a list of steps you can use to add an implicit animation to the shape-shifting starter code. After the steps, you can also run the shape-shifting complete example with the changes already made. shape-shifting starter code, each property in the Generate new values for color, borderRadius, and margin whenever the user clicks the Change button. Animate the transition to the new values for color, borderRadius, and margin whenever they are set. 1. Add an implicit animation
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-15
1. Add an implicit animation Change the Container widget to an AnimatedContainer widget: {container1 → container2}/lib/main.dart @@ -2,6 +2,8 @@ 2 2 // Use of this source code is governed by a BSD-style license 3 3 // that can be found in the LICENSE file. + // ignore_for_file: missing_required_argument 4 6 import 'dart:math'; 5 7 import 'package:flutter/material.dart'; @@ -47,7 +49,7 @@ 47 49 SizedBox( 48 50 width: 128,
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-16
48 50 width: 128, 49 51 height: 128, 50 child: Container( 52 + child: AnimatedContainer( 51 53 margin: EdgeInsets.all(margin), 52 54 decoration: BoxDecoration( 53 55 color: color, You can reference the line numbers in the example code to help track where to make these changes in shape-shifting starter code 2. Set starting values for animated properties {container2 → container3}/lib/main.dart @@ -40,6 +40,14 @@ 40 40
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-17
40 40 margin = randomMargin(); 41 41 42 + void change() { 43 + setState(() { 44 + color = randomColor(); 45 + borderRadius = randomBorderRadius(); 46 + margin = randomMargin(); 47 + }); 48 + } 49 42 50 @override 43 51 Widget build(BuildContext context) { 44 52 return Scaffold(
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-18
44 52 return Scaffold( 3. Set up a trigger for the animation To set the animation to trigger whenever the user presses the Change button, invoke the change() method in the onPressed() handler: {container3 → container4}/lib/main.dart @@ -67,7 +67,7 @@ 67 67 ), 68 68 ElevatedButton( 69 69 child: const Text('change'), 70 onPressed: () => {}, 70 + onPressed: () => change(), 71 71 ), 72 72 ],
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-19
), 72 72 ], 73 73 ), 4. Set duration Finally, set the duration of the animation that powers the transition between the old and new values: {container4 → container5}/lib/main.dart @@ -2,12 +2,12 @@ 2 2 // Use of this source code is governed by a BSD-style license 3 3 // that can be found in the LICENSE file. // ignore_for_file: missing_required_argument 6 4 import 'dart:math'; 7 5 import 'package:flutter/material.dart'; + const _duration = Duration(milliseconds: 400);
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-20
+ const _duration = Duration(milliseconds: 400); 8 8 double randomBorderRadius() { 9 9 return Random().nextDouble() * 64; 10 10 @@ -63,6 +63,7 @@ 63 63 color: color, 64 64 borderRadius: BorderRadius.circular(borderRadius), 65 65 ), 66 + duration: _duration, 66 67 ), 67 68 ), 68 69 ElevatedButton( Shape-shifting (complete)
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-21
ElevatedButton( Shape-shifting (complete) Here’s the example with the completed changes you’ve made—run the code and click the Change button to trigger the animation. Notice that each time you click the Change button, the shape animates to its new values for margin, borderRadius, and color. Using animation curves The preceding examples show how implicit animations allow you to animate changes in values for specific widget properties, and how the duration parameter allows you to set the amount of time an animation takes to complete. Implicit animations also allow you to control changes to the rate of an animation within the duration. The parameter you use to define this change in rate is curve. linear animation curve by default. Add a shape-shifting complete and watch how the animation changes when you pass the easeInOutBack constant for {container5 → container6}/lib/main.dart
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-22
{container5 → container6}/lib/main.dart @@ -64,6 +64,7 @@ 64 64 borderRadius: BorderRadius.circular(borderRadius), 65 65 ), 66 66 duration: _duration, 67 + curve: Curves.easeInOutBack, 67 68 ), 68 69 ), 69 70 ElevatedButton( The easeInOutBack constant is only one of many that you can pass for the curve parameter. Explore the list of curve constants to discover more ways to use curve to modify the look and feel of your animations. Putting it all together
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-23
Putting it all together shape-shifting complete example animates transitions between values for shape-shifting complete example builds upon fade-in complete by showing additional capabilities of implicit animations: Some implicit animations (for example, AnimatedOpacity) only animate a single property, while others (like AnimatedContainer) can animate many properties. Implicit animations automatically animate between the old and new values of properties when they change using the provided curve and duration. If you do not specify a curve, implicit animations default to a linear curve. What’s next? Congratulations, you’ve finished the codelab! If you’d like to learn more, here are some suggestions for where to go next: Try the animations tutorial. Learn about hero animations and staggered animations. Checkout the animation library.
https://docs.flutter.dev/codelabs/implicit-animations/index.html
0593b336d361-24
Checkout the animation library. Try another codelab.
https://docs.flutter.dev/codelabs/implicit-animations/index.html
03e56c9b600e-0
Codelabs & workshops Good for beginners Next steps Designing a Flutter UI Using Flutter with… Monetizing Flutter Flutter and Firebase Flutter and TensorFlow Flutter and other technologies Testing Writing platform-specific code Other resources The Flutter codelabs provide a guided, hands-on coding experience. Some codelabs run in DartPad—no downloads required! Flutter workshops are similar to the codelabs, but are instructor led and always use DartPad. The provided workshop link takes you to the relevant YouTube video, which tells you where to find the associated DartPad link. You might want to check out the workshops created by our Google Developer Experts (GDEs). You can find them on the Flutter community blog. Good for beginners
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-1
Good for beginners If you’re new to Flutter, we recommend starting with one of the following codelabs: Your first Flutter app Create a simple app that automatically generates cool-sounding names, such as “newstay”, “lightstream”, “mainbrake”, or “graypine”. This app is responsive and runs on mobile, desktop, and web. (This also replaces the previous “write your first Flutter app” for mobile, part 1 and part 2 codelabs.) Write your first Flutter app on the web Implement a simple web app in DartPad (no downloads required!) that displays a sign-in screen containing three text fields. As the user fills out the fields, a progress bar animates along the top of the sign-in area. This codelab is written specifically for the web, but if you have downloaded and configured Android and iOS tooling, the completed app works on Android and iOS devices, as well. Next steps
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-2
Next steps Building scrolling experiences in Flutter (workshop) Start with an app that performs simple, straightforward scrolling and enhance it to create fancy and custom scrolling effects by using slivers. Dart null safety in Action (workshop) An instructor-led workshop based on the Null safety codelab on the dart.dev site. How to manage application states using inherited widgets (workshop) Learn how to manage the state of your app’s data by using the InheritedWidget class, one of the low-level state management classes provided by Flutter. Designing a Flutter UI Learn about Material Design and basic Flutter concepts, like layout and animations: Basic Flutter layout concepts Use DartPad in a browser (no downloads required!) to learn the basics of creating a Flutter layout.
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-3
How to debug layout issues with the Flutter Inspector Not an official codelab, but step-by-step instructions on how to debug common layout problems using the Flutter Inspector and Layout Explorer. Implicit animations Use DartPad (no downloads required!) to learn how to use implicit animations to add motion and create visual effects for the widgets in your UI. Building Beautiful Transitions with Material Motion for Flutter Learn how to use the Material animations package to add pre-built transitions to a Material app called Reply. Take your Flutter app from boring to beautiful Learn how to use some of the features in Material 3 to make your app more beautiful and more responsive.
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-4
MDC-101 Flutter: Material Components (MDC) Basics Learn the basics of using Material Components by building a simple app with core components. The four MDC codelabs guide you through building an e-commerce app called Shrine. You’ll start by building a login page using several of MDC Flutter’s components. MDC-102 Flutter: Material Structure and Layout Learn how to use Material for structure and layout in Flutter. Continue building the e-commerce app, introduced in MDC-101, by adding navigation, structure, and data. MDC-103 Flutter: Material Theming with Color, Shape, Elevation, and Type Discover how Material Components for Flutter make it easy to differentiate your product, and express your brand through design. Continue building your e-commerce app by adding a home screen that displays products.
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-5
MDC-104 Flutter: Material Advanced Components Improve your design and learn to use our advanced component backdrop menu. Finish your e-commerce app by adding a backdrop with a menu that filters products by the selected category. Adaptive Apps in Flutter Learn how to build a Flutter app that adapts to the platform that it’s running on, be that Android, iOS, the web, Windows, macOS, or Linux. Using Flutter with… Learn how to use Flutter with other technologies. Monetizing Flutter Adding AdMob Ads to a Flutter app Learn how to add an AdMob banner, an interstitial ad, and a rewarded ad to an app called Awesome Drawing Quiz, a game that lets players guess the name of the drawing.
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-6
Adding an AdMob banner and native inline ads to a Flutter app Learn how to implement inline banner and native ads to a travel booking app that lists possible flight destinations. Adding in-app purchases to your Flutter app Extend a simple gaming app that uses the Dash mascot as currency to offer three types of in-app purchases: consumable, non-consumable, and subscription. Flutter and Firebase Add a user authentication flow to a Flutter app using FirebaseUI Learn how to add Firebase authentication to a Flutter app with only a few lines of code. Get to know Firebase for Flutter (workshop) An instructor-led version of our popular “Get to know Firebase for Flutter” codelab (listed below). Get to know Firebase for Flutter Build an event RSVP and guestbook chat app on both Android and iOS using Flutter, authenticating users with Firebase Authentication, and sync data using Cloud Firestore.
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-7
Local development for your Flutter apps using the Firebase Emulator Suite Learn how to use the Firebase Emulator Suite when developing with Flutter. You will also learn to use the Auth and Firestore emulators. Flutter and TensorFlow Create a custom text-classification model with TensorFlow Lite Model Maker Create a Flutter app to classify texts with TensorFlow Learn how to run a text-classification inference from a Flutter app with TensorFlow Serving through REST and gRPC. Train a comment-spam detection model with TensorFlow Lite Model Maker Learn how to install the TensorFlow Lite Model Maker with Colab, How to use a data loader, and how to build a model. Flutter and other technologies Adding Google Maps to a Flutter app Display a Google map in an app, retrieve data from a web service, and display the data as markers on the map.
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-8
Adding WebView to your Flutter app With the WebView Flutter plugin you can add a WebView widget to your Android or iOS Flutter app. Build voice bots for mobile with Dialogflow and Flutter (workshop) An instructor-led version of the Dialogflow and Flutter codelab (listed below). Build voice bots for Android with Dialogflow and Flutter Learn how to build a mobile FAQ bot that can answer most common questions about the tool Dialogflow. End users can interact with the text interface or stream a voice interaction via the built-in microphone of a mobile device. Building a game with Flutter and Flame NEW Learn how to create a platform game (featuring Dash or Sparky), using the Flame package. Using FFI in a Flutter plugin NEW Learn how to use Dart’s FFI (foreign function interface) library, ffigen, allowing you to leverage existing native libraries that provide a C interface.
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-9
Testing Learn how to test your Flutter application. How to test a Flutter app Start with a simple app that manages state with the Provider package. Unit test the provider package. Write widget tests for two of the widgets. Use Flutter Driver to create an integration test. Writing platform-specific code Learn how to write code that’s targeted for specific platforms, like iOS, Android, desktop, or the web. Building a Cupertino app with Flutter Build a version of the Shrine shopping app (used in the Material Design codelabs) using the Cupertino package to create an iOS style look and feel. Create multiple tabs and navigate between them. Use the provider package to manage state between screens. How to write a Flutter plugin Learn how to write a plugin by creating a music plugin for iOS and Android that processes audio on the host platform. Then make an example app that uses your plugin to make a music keyboard.
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-10
Using a plugin with a Flutter web app Finish an app that reports the number of stars on a GitHub repository. use Dart DevTools to do some simple debugging, and Host your app on Firebase and, finally, use a Flutter plugin to launch the app and open the hosted privacy policy. Write a Flutter desktop application Build a Flutter desktop app (Windows, Linux, or macOS) that accesses GitHub APIs to retrieve your repositories, assigned issues, and pull requests. As part of this task, create and use plugins to interact with native APIs and desktop applications, and use code generation to build type-safe client libraries for GitHub’s APIs. Other resources For Dart-specific codelabs, see the codelabs page on the Dart site. We also recommend the following online class: The Complete Flutter Development Bootcamp Using Dart
https://docs.flutter.dev/codelabs/index.html
03e56c9b600e-11
The Complete Flutter Development Bootcamp Using Dart Note: If you have trouble viewing any of the codelabs on codelabs.developers.google.com, try this mirror of the Flutter codelabs.
https://docs.flutter.dev/codelabs/index.html
770dd48484f7-0
Basic Flutter layout concepts Row and Column classes Axis size and alignment mainAxisSize property mainAxisAlignment property crossAxisAlignment property Flexible widget Expanded widget SizedBox widget Spacer widget Text widget Icon widget Image widget Putting it all together What’s next? Welcome to the Flutter layout codelab, where you learn how to build a Flutter UI without downloading and installing Flutter or Dart! Note: This codelab uses embedded DartPads to display examples and exercises. If you see empty boxes instead of DartPads, check out Troubleshooting DartPad.
https://docs.flutter.dev/codelabs/layout-basics/index.html
README.md exists but content is empty. Use the Edit dataset card button to edit it.
Downloads last month
44
Edit dataset card

Models trained or fine-tuned on limcheekin/flutter-website-3.7