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
daa70608
Unverified
Commit
daa70608
authored
May 24, 2019
by
Todd Volkert
Committed by
GitHub
May 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add stateful_widget_animation snippet template (#33295)
parent
9d520853
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
58 additions
and
0 deletions
+58
-0
README.md
dev/snippets/config/templates/README.md
+5
-0
stateful_widget_animation.tmpl
dev/snippets/config/templates/stateful_widget_animation.tmpl
+53
-0
No files found.
dev/snippets/config/templates/README.md
View file @
daa70608
...
...
@@ -86,3 +86,8 @@ follows:
-
[
`stateless_widget_scaffold`
](
stateless_widget_scaffold.tmpl
)
: Similar to
`stateless_widget_material`
, except that it wraps the stateless widget with a
Scaffold.
-
[
`stateful_widget_animation`
](
stateful_widget_animation.tmpl
)
: Similar to
`stateful_widget`
, except that it declares an
`AnimationController`
instance
variable called
`_controller`
, and it properly initializes the controller
in
`initState()`
and properly disposes of the controller in
`dispose()`
.
dev/snippets/config/templates/stateful_widget_animation.tmpl
0 → 100644
View file @
daa70608
// Flutter code sample for {{id}}
{{description}}
import 'package:flutter/widgets.dart';
{{code-imports}}
void main() => runApp(new MyApp());
/// This Widget is the main application widget.
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return WidgetsApp(
title: 'Flutter Code Sample',
home: MyStatefulWidget(),
color: const Color(0xffffffff),
);
}
}
{{code-preamble}}
/// This is the stateful widget that the main application instantiates.
class MyStatefulWidget extends StatefulWidget {
MyStatefulWidget({Key key}) : super(key: key);
@override
_MyStatefulWidgetState createState() => _MyStatefulWidgetState();
}
// This is the private State class that goes with MyStatefulWidget.
class _MyStatefulWidgetState extends State<MyStatefulWidget> {
AnimationController _controller;
@override
void initState() {
super.initState();
_controller = AnimationController(
vsync: this,
duration: const Duration(seconds: 1),
);
}
@override
void dispose() {
_controller.dispose();
super.dispose();
}
{{code}}
}
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