Amaraa0404/AI-First
Question Answering • Updated
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
... | 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 Wid... | 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
Fi... | 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... | 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 contribut... | 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 f... | 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 ... | 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 co... | 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(BuildContex... | 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 i... | 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 clo... | 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 chan... | 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 cod... | 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 ... | 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 member... | 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... | 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... | 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 lett... | 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 una... | 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 trad... | 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... | 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 ... | 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 n... | 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... | 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
Nov... | 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 A... | 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 ani... | 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 ... | 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 im... | 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... | 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 ... | 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 scre... | 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... | 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 ... | 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... | 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... | 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 eit... | 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 updat... | 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 bet... | 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... | 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 e... | 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 que... | 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 v... | 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 animati... | 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 TickerP... | 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 Animat... | 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
+... | 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 ye... | 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 ... | 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
+
... | 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 ... | 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... | 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
decoratio... | 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
+
contro... | 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
Lifec... | 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().
... | 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 val... | 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
Acc... | 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 conc... | 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, ... | 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
Troubles... | 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,
... | 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 not... | 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 th... | 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
+
... | 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... | 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 ... | 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
+
... | 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. F... | 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... | 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(colo... | 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 s... | 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 re... | 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 A... | 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_argu... | 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 i... | 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
+
... | 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('ch... | 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.... | 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
... | 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
T... | 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... | 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... | 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. S... | 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.... | 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.... | 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... | 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 Flut... | 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 tha... | 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 ... | 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 ... | 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 Dial... | 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... | 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 ... | 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 Fl... | https://docs.flutter.dev/codelabs/layout-basics/index.html |