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
2b47efc9
Commit
2b47efc9
authored
Dec 04, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #716 from abarth/auto_menu
Automatically fill in the menu button when there's a drawer
parents
ed9fcc35
e17c3ecc
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
56 additions
and
53 deletions
+56
-53
main.dart
examples/address_book/lib/main.dart
+2
-3
feed.dart
examples/fitness/lib/feed.dart
+0
-5
settings.dart
examples/fitness/lib/settings.dart
+0
-4
gallery_page.dart
examples/material_gallery/lib/gallery_page.dart
+0
-7
stock_home.dart
examples/stocks/lib/stock_home.dart
+1
-5
stock_settings.dart
examples/stocks/lib/stock_settings.dart
+0
-4
stock_symbol_viewer.dart
examples/stocks/lib/stock_symbol_viewer.dart
+0
-6
card_collection.dart
examples/widgets/card_collection.dart
+0
-3
pageable_list.dart
examples/widgets/pageable_list.dart
+0
-3
scaffold.dart
packages/flutter/lib/src/material/scaffold.dart
+32
-2
tool_bar.dart
packages/flutter/lib/src/material/tool_bar.dart
+21
-11
No files found.
examples/address_book/lib/main.dart
View file @
2b47efc9
...
...
@@ -36,9 +36,8 @@ class Field extends StatelessComponent {
class
AddressBookHome
extends
StatelessComponent
{
Widget
buildToolBar
(
BuildContext
context
)
{
return
new
ToolBar
(
left:
new
IconButton
(
icon:
"navigation/arrow_back"
),
right:
<
Widget
>[
new
IconButton
(
icon:
"navigation/check"
)]
);
right:
<
Widget
>[
new
IconButton
(
icon:
"navigation/check"
)]
);
}
Widget
buildFloatingActionButton
(
BuildContext
context
)
{
...
...
examples/fitness/lib/feed.dart
View file @
2b47efc9
...
...
@@ -55,7 +55,6 @@ class FeedFragment extends StatefulComponent {
class
FeedFragmentState
extends
State
<
FeedFragment
>
{
FitnessMode
_fitnessMode
=
FitnessMode
.
feed
;
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
void
_handleFitnessModeChange
(
FitnessMode
value
)
{
setState
(()
{
...
...
@@ -104,9 +103,6 @@ class FeedFragmentState extends State<FeedFragment> {
Widget
buildToolBar
()
{
return
new
ToolBar
(
left:
new
IconButton
(
icon:
"navigation/menu"
,
onPressed:
()
=>
_scaffoldKey
.
currentState
?.
openDrawer
()),
center:
new
Text
(
fitnessModeTitle
)
);
}
...
...
@@ -207,7 +203,6 @@ class FeedFragmentState extends State<FeedFragment> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
key:
_scaffoldKey
,
toolBar:
buildToolBar
(),
body:
buildBody
(),
floatingActionButton:
buildFloatingActionButton
(),
...
...
examples/fitness/lib/settings.dart
View file @
2b47efc9
...
...
@@ -26,10 +26,6 @@ class SettingsFragmentState extends State<SettingsFragment> {
Widget
buildToolBar
()
{
return
new
ToolBar
(
left:
new
IconButton
(
icon:
"navigation/arrow_back"
,
onPressed:
()
=>
Navigator
.
pop
(
context
)
),
center:
new
Text
(
'Settings'
)
);
}
...
...
examples/material_gallery/lib/gallery_page.dart
View file @
2b47efc9
...
...
@@ -17,8 +17,6 @@ class GalleryPage extends StatefulComponent {
}
class
_GalleryPageState
extends
State
<
GalleryPage
>
{
final
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
Widget
_buildDrawer
()
{
List
<
Widget
>
items
=
<
Widget
>[
new
DrawerHeader
(
child:
new
Text
(
'Material demos'
)),
...
...
@@ -53,12 +51,7 @@ class _GalleryPageState extends State<GalleryPage> {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
key:
_scaffoldKey
,
toolBar:
new
ToolBar
(
left:
new
IconButton
(
icon:
'navigation/menu'
,
onPressed:
()
{
_scaffoldKey
.
currentState
?.
openDrawer
();
}
),
center:
new
Text
(
config
.
active
?.
title
??
'Material gallery'
),
tabBar:
_buildTabBar
()
),
...
...
examples/stocks/lib/stock_home.dart
View file @
2b47efc9
...
...
@@ -147,10 +147,6 @@ class StockHomeState extends State<StockHome> {
Widget
buildToolBar
()
{
return
new
ToolBar
(
elevation:
0
,
left:
new
IconButton
(
icon:
"navigation/menu"
,
onPressed:
()
=>
_scaffoldKey
.
currentState
?.
openDrawer
()
),
center:
new
Text
(
'Stocks'
),
right:
<
Widget
>[
new
IconButton
(
...
...
@@ -230,7 +226,7 @@ class StockHomeState extends State<StockHome> {
Widget
buildSearchBar
()
{
return
new
ToolBar
(
left:
new
IconButton
(
icon:
"navigation/arrow_back"
,
icon:
'navigation/arrow_back'
,
colorFilter:
new
ColorFilter
.
mode
(
Theme
.
of
(
context
).
accentColor
,
ui
.
TransferMode
.
srcATop
),
onPressed:
_handleSearchEnd
),
...
...
examples/stocks/lib/stock_settings.dart
View file @
2b47efc9
...
...
@@ -70,10 +70,6 @@ class StockSettingsState extends State<StockSettings> {
Widget
buildToolBar
(
BuildContext
context
)
{
return
new
ToolBar
(
left:
new
IconButton
(
icon:
'navigation/arrow_back'
,
onPressed:
()
=>
Navigator
.
pop
(
context
)
),
center:
new
Text
(
'Settings'
)
);
}
...
...
examples/stocks/lib/stock_symbol_viewer.dart
View file @
2b47efc9
...
...
@@ -55,12 +55,6 @@ class StockSymbolPage extends StatelessComponent {
Widget
build
(
BuildContext
context
)
{
return
new
Scaffold
(
toolBar:
new
ToolBar
(
left:
new
IconButton
(
icon:
'navigation/arrow_back'
,
onPressed:
()
{
Navigator
.
pop
(
context
);
}
),
center:
new
Text
(
stock
.
name
)
),
body:
new
Block
(<
Widget
>[
...
...
examples/widgets/card_collection.dart
View file @
2b47efc9
...
...
@@ -46,8 +46,6 @@ class CardCollectionState extends State<CardCollection> {
InvalidatorCallback
_invalidator
;
Size
_cardCollectionSize
=
new
Size
(
200.0
,
200.0
);
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
void
_initVariableSizedCardModels
()
{
List
<
double
>
cardHeights
=
<
double
>[
48.0
,
63.0
,
82.0
,
146.0
,
60.0
,
55.0
,
84.0
,
96.0
,
50.0
,
...
...
@@ -268,7 +266,6 @@ class CardCollectionState extends State<CardCollection> {
Widget
_buildToolBar
()
{
return
new
ToolBar
(
left:
new
IconButton
(
icon:
"navigation/menu"
,
onPressed:
()
=>
_scaffoldKey
.
currentState
?.
openDrawer
()),
right:
<
Widget
>[
new
Text
(
_dismissDirectionText
(
_dismissDirection
))
],
...
...
examples/widgets/pageable_list.dart
View file @
2b47efc9
...
...
@@ -41,8 +41,6 @@ class PageableListAppState extends State<PageableListApp> {
ScrollDirection
scrollDirection
=
ScrollDirection
.
horizontal
;
bool
itemsWrap
=
false
;
GlobalKey
<
ScaffoldState
>
_scaffoldKey
=
new
GlobalKey
<
ScaffoldState
>();
void
updatePageSize
(
Size
newSize
)
{
setState
(()
{
pageSize
=
newSize
;
...
...
@@ -114,7 +112,6 @@ class PageableListAppState extends State<PageableListApp> {
Widget
_buildToolBar
()
{
return
new
ToolBar
(
left:
new
IconButton
(
icon:
"navigation/menu"
,
onPressed:
()
=>
_scaffoldKey
.
currentState
?.
openDrawer
()),
center:
new
Text
(
'PageableList'
),
right:
<
Widget
>[
new
Text
(
scrollDirection
==
ScrollDirection
.
horizontal
?
"horizontal"
:
"vertical"
)
...
...
packages/flutter/lib/src/material/scaffold.dart
View file @
2b47efc9
...
...
@@ -16,6 +16,7 @@ import 'material.dart';
import
'snack_bar.dart'
;
import
'tool_bar.dart'
;
import
'drawer.dart'
;
import
'icon_button.dart'
;
const
double
_kFloatingActionButtonMargin
=
16.0
;
// TODO(hmuller): should be device dependent
...
...
@@ -257,8 +258,37 @@ class ScaffoldState extends State<Scaffold> {
children
.
add
(
new
LayoutId
(
child:
child
,
id:
childId
));
}
bool
_shouldShowBackArrow
;
Widget
get
_modifiedToolBar
{
ToolBar
toolBar
=
config
.
toolBar
;
if
(
toolBar
==
null
)
return
null
;
EdgeDims
padding
=
new
EdgeDims
.
only
(
top:
ui
.
window
.
padding
.
top
);
Widget
left
=
toolBar
.
left
;
if
(
left
==
null
)
{
if
(
config
.
drawer
!=
null
)
{
left
=
new
IconButton
(
icon:
'navigation/menu'
,
onPressed:
openDrawer
);
}
else
{
_shouldShowBackArrow
??=
Navigator
.
canPop
(
context
);
if
(
_shouldShowBackArrow
)
{
left
=
new
IconButton
(
icon:
'navigation/arrow_back'
,
onPressed:
()
=>
Navigator
.
pop
(
context
)
);
}
}
}
return
toolBar
.
copyWith
(
padding:
padding
,
left:
left
);
}
Widget
build
(
BuildContext
context
)
{
final
Widget
paddedToolBar
=
config
.
toolBar
?.
withPadding
(
new
EdgeDims
.
only
(
top:
ui
.
window
.
padding
.
top
));
final
Widget
materialBody
=
config
.
body
!=
null
?
new
Material
(
child:
config
.
body
)
:
null
;
if
(
_snackBars
.
length
>
0
)
{
...
...
@@ -274,7 +304,7 @@ class ScaffoldState extends State<Scaffold> {
final
List
<
LayoutId
>
children
=
new
List
<
LayoutId
>();
_addIfNonNull
(
children
,
materialBody
,
_Child
.
body
);
_addIfNonNull
(
children
,
padd
edToolBar
,
_Child
.
toolBar
);
_addIfNonNull
(
children
,
_modifi
edToolBar
,
_Child
.
toolBar
);
if
(
_currentBottomSheet
!=
null
||
(
_dismissedBottomSheets
!=
null
&&
_dismissedBottomSheets
.
isNotEmpty
))
{
...
...
packages/flutter/lib/src/material/tool_bar.dart
View file @
2b47efc9
...
...
@@ -36,18 +36,28 @@ class ToolBar extends StatelessComponent {
final
TextTheme
textTheme
;
final
EdgeDims
padding
;
ToolBar
withPadding
(
EdgeDims
newPadding
,
{
Key
fallbackKey
})
{
ToolBar
copyWith
({
Key
key
,
Widget
left
,
Widget
center
,
List
<
Widget
>
right
,
Widget
bottom
,
int
elevation
,
Color
backgroundColor
,
TextTheme
textTheme
,
EdgeDims
padding
})
{
return
new
ToolBar
(
key:
key
??
fallbackK
ey
,
left:
left
,
center:
center
,
right:
right
,
bottom:
bottom
,
tabBar:
tabBar
,
elevation:
elevation
,
backgroundColor:
backgroundColor
,
textTheme:
textTheme
,
padding:
newP
adding
key:
key
??
this
.
k
ey
,
left:
left
??
this
.
left
,
center:
center
??
this
.
center
,
right:
right
??
this
.
right
,
bottom:
bottom
??
this
.
bottom
,
tabBar:
tabBar
??
this
.
tabBar
,
elevation:
elevation
??
this
.
elevation
,
backgroundColor:
backgroundColor
??
this
.
backgroundColor
,
textTheme:
textTheme
??
this
.
textTheme
,
padding:
padding
??
this
.
p
adding
);
}
...
...
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