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
b2db3baf
Unverified
Commit
b2db3baf
authored
May 03, 2018
by
xster
Committed by
GitHub
May 03, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make Android back button presses in a demo category not unexpectedly quit the app (#17224)
parent
22c12f9f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
36 deletions
+41
-36
home.dart
examples/flutter_gallery/lib/gallery/home.dart
+41
-36
No files found.
examples/flutter_gallery/lib/gallery/home.dart
View file @
b2db3baf
...
...
@@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'dart:async'
;
import
'dart:developer'
;
import
'dart:math'
as
math
;
...
...
@@ -298,42 +299,46 @@ class _GalleryHomeState extends State<GalleryHome> with SingleTickerProviderStat
backgroundColor:
isDark
?
_kFlutterBlue
:
theme
.
primaryColor
,
body:
new
SafeArea
(
bottom:
false
,
child:
new
Backdrop
(
backTitle:
const
Text
(
'Options'
),
backLayer:
widget
.
optionsPage
,
frontAction:
new
AnimatedSwitcher
(
duration:
_kFrontLayerSwitchDuration
,
child:
_category
==
null
?
const
_FlutterLogo
()
:
new
IconButton
(
icon:
const
BackButtonIcon
(),
tooltip:
'Back'
,
onPressed:
()
{
setState
(()
{
_category
=
null
;
});
},
),
),
frontTitle:
new
AnimatedSwitcher
(
duration:
_kFrontLayerSwitchDuration
,
child:
_category
==
null
?
const
Text
(
'Flutter gallery'
)
:
new
Text
(
_category
.
name
),
),
frontHeading:
new
Container
(
height:
24.0
),
frontLayer:
new
AnimatedSwitcher
(
duration:
_kFrontLayerSwitchDuration
,
child:
_category
!=
null
?
new
_DemosPage
(
_category
)
:
new
_CategoriesPage
(
categories:
kAllGalleryDemoCategories
,
onCategoryTap:
(
GalleryDemoCategory
category
)
{
setState
(()
{
_category
=
category
;
});
},
),
child:
new
WillPopScope
(
onWillPop:
()
{
// Pop the category page if Android back button is pressed.
if
(
_category
!=
null
)
{
setState
(()
=>
_category
=
null
);
return
new
Future
<
bool
>.
value
(
false
);
}
return
new
Future
<
bool
>.
value
(
true
);
},
child:
new
Backdrop
(
backTitle:
const
Text
(
'Options'
),
backLayer:
widget
.
optionsPage
,
frontAction:
new
AnimatedSwitcher
(
duration:
_kFrontLayerSwitchDuration
,
child:
_category
==
null
?
const
_FlutterLogo
()
:
new
IconButton
(
icon:
const
BackButtonIcon
(),
tooltip:
'Back'
,
onPressed:
()
=>
setState
(()
=>
_category
=
null
),
),
),
frontTitle:
new
AnimatedSwitcher
(
duration:
_kFrontLayerSwitchDuration
,
child:
_category
==
null
?
const
Text
(
'Flutter gallery'
)
:
new
Text
(
_category
.
name
),
),
frontHeading:
new
Container
(
height:
24.0
),
frontLayer:
new
AnimatedSwitcher
(
duration:
_kFrontLayerSwitchDuration
,
child:
_category
!=
null
?
new
_DemosPage
(
_category
)
:
new
_CategoriesPage
(
categories:
kAllGalleryDemoCategories
,
onCategoryTap:
(
GalleryDemoCategory
category
)
{
setState
(()
=>
_category
=
category
);
},
),
),
),
),
),
...
...
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