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
9536c418
Commit
9536c418
authored
Mar 09, 2016
by
Hans Muller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scaffold saves and restores scrollable state, etc
parent
6d646860
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
138 additions
and
145 deletions
+138
-145
dialog_demo.dart
examples/material_gallery/lib/demo/dialog_demo.dart
+104
-128
page_selector_demo.dart
examples/material_gallery/lib/demo/page_selector_demo.dart
+17
-14
tabs_demo.dart
examples/material_gallery/lib/demo/tabs_demo.dart
+9
-2
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+7
-0
tabs.dart
packages/flutter/lib/src/material/tabs.dart
+1
-1
No files found.
examples/material_gallery/lib/demo/dialog_demo.dart
View file @
9536c418
...
...
@@ -14,11 +14,6 @@ enum DialogDemoAction {
agree
,
}
const
String
_introText
=
"Use dialogs sparingly because their sudden appearance forces users to stop their "
"current task and focus on the dialog's content. Alternatives to dialogs include "
"menus or inline expansion, both of which maintain the current context."
;
const
String
_alertWithoutTitleText
=
"Discard draft?"
;
const
String
_alertWithTitleText
=
...
...
@@ -88,27 +83,11 @@ class DialogDemoState extends State<DialogDemo> {
toolBar:
new
ToolBar
(
center:
new
Text
(
'Dialogs'
)
),
body:
new
ButtonTheme
(
color:
ButtonColor
.
accent
,
child:
new
Padding
(
padding:
const
EdgeDims
.
all
(
24.0
),
child:
new
ScrollableViewport
(
child:
new
Column
(
alignItems:
FlexAlignItems
.
stretch
,
body:
new
Block
(
padding:
const
EdgeDims
.
symmetric
(
vertical:
24.0
,
horizontal:
72.0
),
children:
<
Widget
>[
new
Container
(
child:
new
Text
(
_introText
,
style:
dialogTextStyle
),
padding:
const
EdgeDims
.
only
(
top:
8.0
,
bottom:
24.0
),
margin:
const
EdgeDims
.
only
(
bottom:
16.0
),
decoration:
new
BoxDecoration
(
border:
new
Border
(
bottom:
new
BorderSide
(
color:
theme
.
dividerColor
))
)
),
new
FlatButton
(
child:
new
Text
(
'Alert without a title'
),
new
RaisedButton
(
child:
new
Text
(
'ALERT'
),
onPressed:
()
{
showDemoDialog
(
context:
context
,
...
...
@@ -131,8 +110,8 @@ class DialogDemoState extends State<DialogDemo> {
);
}
),
new
Flat
Button
(
child:
new
Text
(
'Alert with a title
'
),
new
Raised
Button
(
child:
new
Text
(
'ALERT WITH TITLE
'
),
onPressed:
()
{
showDemoDialog
(
context:
context
,
...
...
@@ -156,8 +135,8 @@ class DialogDemoState extends State<DialogDemo> {
);
}
),
new
Flat
Button
(
child:
new
Text
(
'Simple Dialog
'
),
new
Raised
Button
(
child:
new
Text
(
'SIMPLE
'
),
onPressed:
()
{
showDemoDialog
(
context:
context
,
...
...
@@ -188,8 +167,8 @@ class DialogDemoState extends State<DialogDemo> {
);
}
),
new
Flat
Button
(
child:
new
Text
(
'Confirmation Dialog
'
),
new
Raised
Button
(
child:
new
Text
(
'CONFIRMATION
'
),
onPressed:
()
{
showTimePicker
(
context:
context
,
...
...
@@ -204,8 +183,8 @@ class DialogDemoState extends State<DialogDemo> {
});
}
),
new
Flat
Button
(
child:
new
Text
(
'Fullscreen Dialog
'
),
new
Raised
Button
(
child:
new
Text
(
'FULLSCREEN
'
),
onPressed:
()
{
Navigator
.
push
(
context
,
new
MaterialPageRoute
(
builder:
(
BuildContext
context
)
=>
new
FullScreenDialogDemo
()
...
...
@@ -214,9 +193,6 @@ class DialogDemoState extends State<DialogDemo> {
)
]
)
)
)
)
);
}
}
examples/material_gallery/lib/demo/page_selector_demo.dart
View file @
9536c418
...
...
@@ -5,17 +5,6 @@
import
'package:flutter/material.dart'
;
class
PageSelectorDemo
extends
StatelessComponent
{
Widget
_buildTabView
(
IconData
icon
)
{
return
new
Container
(
key:
new
ObjectKey
(
icon
),
padding:
const
EdgeDims
.
all
(
12.0
),
child:
new
Card
(
child:
new
Center
(
child:
new
Icon
(
icon:
icon
,
size:
48.0
)
)
)
);
}
void
_handleArrowButtonPress
(
BuildContext
context
,
int
delta
)
{
final
TabBarSelectionState
selection
=
TabBarSelection
.
of
(
context
);
...
...
@@ -35,10 +24,11 @@ class PageSelectorDemo extends StatelessComponent {
return
new
Scaffold
(
toolBar:
new
ToolBar
(
center:
new
Text
(
'Page Selector'
)),
body:
new
TabBarSelection
(
body:
new
TabBarSelection
<
IconData
>
(
values:
icons
,
child:
new
Builder
(
builder:
(
BuildContext
context
)
{
final
Color
color
=
Theme
.
of
(
context
).
accentColor
;
return
new
Column
(
children:
<
Widget
>[
new
Container
(
...
...
@@ -47,12 +37,14 @@ class PageSelectorDemo extends StatelessComponent {
children:
<
Widget
>[
new
IconButton
(
icon:
Icons
.
arrow_back
,
color:
color
,
onPressed:
()
{
_handleArrowButtonPress
(
context
,
-
1
);
},
tooltip:
'Back'
),
new
TabPageSelector
<
String
>(),
new
TabPageSelector
<
IconData
>(),
new
IconButton
(
icon:
Icons
.
arrow_forward
,
color:
color
,
onPressed:
()
{
_handleArrowButtonPress
(
context
,
1
);
},
tooltip:
'Forward'
)
...
...
@@ -62,7 +54,18 @@ class PageSelectorDemo extends StatelessComponent {
),
new
Flexible
(
child:
new
TabBarView
(
children:
icons
.
map
(
_buildTabView
).
toList
()
children:
icons
.
map
((
IconData
icon
)
{
return
new
Container
(
key:
new
ObjectKey
(
icon
),
padding:
const
EdgeDims
.
all
(
12.0
),
child:
new
Card
(
child:
new
Center
(
child:
new
Icon
(
icon:
icon
,
size:
128.0
,
color:
color
)
)
)
);
})
.
toList
()
)
)
]
...
...
examples/material_gallery/lib/demo/tabs_demo.dart
View file @
9536c418
...
...
@@ -23,7 +23,8 @@ class TabsDemo extends StatelessComponent {
Icons
.
language
:
'LANGUAGE'
,
};
Widget
build
(
_
)
{
Widget
build
(
BuildContext
context
)
{
final
Color
iconColor
=
Theme
.
of
(
context
).
accentColor
;
return
new
TabBarSelection
(
values:
icons
,
child:
new
Scaffold
(
...
...
@@ -43,7 +44,13 @@ class TabsDemo extends StatelessComponent {
key:
new
ObjectKey
(
icon
),
padding:
const
EdgeDims
.
all
(
12.0
),
child:
new
Card
(
child:
new
Center
(
child:
new
Icon
(
icon:
icon
,
size:
48.0
))
child:
new
Center
(
child:
new
Icon
(
icon:
icon
,
color:
iconColor
,
size:
128.0
)
)
)
);
}).
toList
()
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
9536c418
...
...
@@ -345,6 +345,12 @@ class ScaffoldState extends State<Scaffold> {
void
initState
()
{
super
.
initState
();
_appBarController
=
new
AnimationController
();
List
<
double
>
scrollValues
=
PageStorage
.
of
(
context
)?.
readState
(
context
);
if
(
scrollValues
!=
null
)
{
assert
(
scrollValues
.
length
==
2
);
_scrollOffset
=
scrollValues
[
0
];
_scrollOffsetDelta
=
scrollValues
[
1
];
}
}
void
dispose
()
{
...
...
@@ -353,6 +359,7 @@ class ScaffoldState extends State<Scaffold> {
_snackBarController
=
null
;
_snackBarTimer
?.
cancel
();
_snackBarTimer
=
null
;
PageStorage
.
of
(
context
)?.
writeState
(
context
,
<
double
>[
_scrollOffset
,
_scrollOffsetDelta
]);
super
.
dispose
();
}
...
...
packages/flutter/lib/src/material/tabs.dart
View file @
9536c418
...
...
@@ -999,7 +999,7 @@ class TabPageSelector<T> extends StatelessComponent {
Widget
build
(
BuildContext
context
)
{
final
TabBarSelectionState
selection
=
TabBarSelection
.
of
(
context
);
final
Color
color
=
Theme
.
of
(
context
).
primary
Color
;
final
Color
color
=
Theme
.
of
(
context
).
accent
Color
;
final
ColorTween
selectedColor
=
new
ColorTween
(
begin:
Colors
.
transparent
,
end:
color
);
final
ColorTween
previousColor
=
new
ColorTween
(
begin:
color
,
end:
Colors
.
transparent
);
Animation
<
double
>
animation
=
new
CurvedAnimation
(
parent:
selection
.
animation
,
curve:
Curves
.
ease
);
...
...
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