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
29e55735
Commit
29e55735
authored
Feb 26, 2016
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2228 from abarth/fix_demo_template
Simplify demo template
parents
240e499b
11fa94cd
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
17 deletions
+26
-17
floating_action_button.dart
...ages/flutter/lib/src/material/floating_action_button.dart
+21
-9
main.dart.tmpl
packages/flutter_tools/templates/create/lib/main.dart.tmpl
+5
-8
No files found.
packages/flutter/lib/src/material/floating_action_button.dart
View file @
29e55735
...
...
@@ -9,6 +9,7 @@ import 'icon_theme_data.dart';
import
'ink_well.dart'
;
import
'material.dart'
;
import
'theme.dart'
;
import
'tooltip.dart'
;
// TODO(eseidel): This needs to change based on device size?
// http://www.google.com/design/spec/layout/metrics-keylines.html#metrics-keylines-keylines-spacing
...
...
@@ -35,6 +36,7 @@ class FloatingActionButton extends StatefulComponent {
const
FloatingActionButton
({
Key
key
,
this
.
child
,
this
.
tooltip
,
this
.
backgroundColor
,
this
.
elevation
:
6
,
this
.
highlightElevation
:
12
,
...
...
@@ -43,6 +45,7 @@ class FloatingActionButton extends StatefulComponent {
})
:
super
(
key:
key
);
final
Widget
child
;
final
String
tooltip
;
final
Color
backgroundColor
;
/// The callback that is invoked when the button is tapped or otherwise activated.
...
...
@@ -99,6 +102,23 @@ class _FloatingActionButtonState extends State<FloatingActionButton> {
iconThemeColor
=
themeData
.
accentColorBrightness
==
ThemeBrightness
.
dark
?
IconThemeColor
.
white
:
IconThemeColor
.
black
;
}
Widget
result
=
new
Center
(
child:
new
IconTheme
(
data:
new
IconThemeData
(
color:
iconThemeColor
),
child:
new
RotationTransition
(
turns:
_childSegue
,
child:
config
.
child
)
)
);
if
(
config
.
tooltip
!=
null
)
{
result
=
new
Tooltip
(
message:
config
.
tooltip
,
child:
result
);
}
return
new
Material
(
color:
materialColor
,
type:
MaterialType
.
circle
,
...
...
@@ -109,15 +129,7 @@ class _FloatingActionButtonState extends State<FloatingActionButton> {
child:
new
InkWell
(
onTap:
config
.
onPressed
,
onHighlightChanged:
_handleHighlightChanged
,
child:
new
Center
(
child:
new
IconTheme
(
data:
new
IconThemeData
(
color:
iconThemeColor
),
child:
new
RotationTransition
(
turns:
_childSegue
,
child:
config
.
child
)
)
)
child:
result
)
)
);
...
...
packages/flutter_tools/templates/create/lib/main.dart.tmpl
View file @
29e55735
...
...
@@ -12,7 +12,7 @@ void main() {
}
class FlutterDemo extends StatefulComponent {
State createState() => new _FlutterDemoState();
_FlutterDemo
State createState() => new _FlutterDemoState();
}
class _FlutterDemoState extends State<FlutterDemo> {
...
...
@@ -30,17 +30,14 @@ class _FlutterDemoState extends State<FlutterDemo> {
center: new Text('Flutter Demo')
),
body: new Center(
child: new Text(
'Button tapped $_counter times.',
key: const ValueKey('counter')
)
child: new Text('Button tapped $_counter time${ _counter == 1 ? '' : 's' }.')
),
floatingActionButton: new FloatingActionButton(
key: const ValueKey('fab'),
onPressed: _incrementCounter,
tooltip: 'Increment',
child: new Icon(
icon: 'content/add'
),
onPressed: _incrementCounter
)
)
);
}
...
...
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