Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
acd51a72
Unverified
Commit
acd51a72
authored
Mar 16, 2020
by
Greg Spencer
Committed by
GitHub
Mar 16, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make AnimatedSwitcher example into a dartpad example (#52547)
parent
d444582f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
43 deletions
+38
-43
animated_switcher.dart
packages/flutter/lib/src/widgets/animated_switcher.dart
+38
-43
No files found.
packages/flutter/lib/src/widgets/animated_switcher.dart
View file @
acd51a72
...
...
@@ -87,53 +87,48 @@ typedef AnimatedSwitcherLayoutBuilder = Widget Function(Widget currentChild, Lis
/// progress indicator and the image will be fading out while a new progress
/// indicator is fading in.)
///
/// {@tool snippet}
/// The type of transition can be changed from a cross-fade to a custom
/// transition by setting the [transitionBuilder].
///
/// ```dart
/// class ClickCounter extends StatefulWidget {
/// const ClickCounter({Key key}) : super(key: key);
///
/// @override
/// _ClickCounterState createState() => _ClickCounterState();
/// }
/// {@tool dartpad --template=stateful_widget_material}
/// This sample shows a counter that animates the scale of a text widget
/// whenever the value changes.
///
///
class _ClickCounterState extends State<ClickCounter> {
///
int _count = 0;
///
```dart
/// int _count = 0;
///
/// @override
/// Widget build(BuildContext context) {
/// return MaterialApp(
/// home: Material(
/// child: Column(
/// mainAxisAlignment: MainAxisAlignment.center,
/// children: <Widget>[
/// AnimatedSwitcher(
/// duration: const Duration(milliseconds: 500),
/// transitionBuilder: (Widget child, Animation<double> animation) {
/// return ScaleTransition(child: child, scale: animation);
/// },
/// child: Text(
/// '$_count',
/// // This key causes the AnimatedSwitcher to interpret this as a "new"
/// // child each time the count changes, so that it will begin its animation
/// // when the count changes.
/// key: ValueKey<int>(_count),
/// style: Theme.of(context).textTheme.headline4,
/// ),
/// ),
/// RaisedButton(
/// child: const Text('Increment'),
/// onPressed: () {
/// setState(() {
/// _count += 1;
/// });
/// },
/// ),
/// ],
/// @override
/// Widget build(BuildContext context) {
/// return Container(
/// color: Colors.white,
/// child: Column(
/// mainAxisAlignment: MainAxisAlignment.center,
/// children: <Widget>[
/// AnimatedSwitcher(
/// duration: const Duration(milliseconds: 500),
/// transitionBuilder: (Widget child, Animation<double> animation) {
/// return ScaleTransition(child: child, scale: animation);
/// },
/// child: Text(
/// '$_count',
/// // This key causes the AnimatedSwitcher to interpret this as a "new"
/// // child each time the count changes, so that it will begin its animation
/// // when the count changes.
/// key: ValueKey<int>(_count),
/// style: Theme.of(context).textTheme.headline4,
/// ),
/// ),
/// RaisedButton(
/// child: const Text('Increment'),
/// onPressed: () {
/// setState(() {
/// _count += 1;
/// });
/// },
/// ),
///
)
,
/// )
;
///
}
///
]
,
/// )
,
///
);
/// }
/// ```
/// {@end-tool}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment