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
4f9b19e2
Unverified
Commit
4f9b19e2
authored
Sep 14, 2022
by
Alexandre Ardhuin
Committed by
GitHub
Sep 14, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix for upcoming use_build_context_synchronously changes (#111539)
parent
6b1f84fe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
14 deletions
+21
-14
demo.dart
dev/integration_tests/flutter_gallery/lib/gallery/demo.dart
+16
-11
updater.dart
...ntegration_tests/flutter_gallery/lib/gallery/updater.dart
+5
-3
No files found.
dev/integration_tests/flutter_gallery/lib/gallery/demo.dart
View file @
4f9b19e2
...
...
@@ -41,7 +41,7 @@ class ComponentDemoTabData {
int
get
hashCode
=>
Object
.
hash
(
tabName
,
description
,
documentationUrl
);
}
class
TabbedComponentDemoScaffold
extends
State
less
Widget
{
class
TabbedComponentDemoScaffold
extends
State
ful
Widget
{
const
TabbedComponentDemoScaffold
({
super
.
key
,
this
.
title
,
...
...
@@ -57,8 +57,13 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
final
bool
isScrollable
;
final
bool
showExampleCodeAction
;
@override
State
<
TabbedComponentDemoScaffold
>
createState
()
=>
_TabbedComponentDemoScaffoldState
();
}
class
_TabbedComponentDemoScaffoldState
extends
State
<
TabbedComponentDemoScaffold
>
{
void
_showExampleCode
(
BuildContext
context
)
{
final
String
?
tag
=
demos
![
DefaultTabController
.
of
(
context
)!.
index
].
exampleCodeTag
;
final
String
?
tag
=
widget
.
demos
![
DefaultTabController
.
of
(
context
)!.
index
].
exampleCodeTag
;
if
(
tag
!=
null
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
<
FullScreenCodeDialog
>(
builder:
(
BuildContext
context
)
=>
FullScreenCodeDialog
(
exampleCodeTag:
tag
)
...
...
@@ -67,7 +72,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
}
Future
<
void
>
_showApiDocumentation
(
BuildContext
context
)
async
{
final
String
?
url
=
demos
![
DefaultTabController
.
of
(
context
)!.
index
].
documentationUrl
;
final
String
?
url
=
widget
.
demos
![
DefaultTabController
.
of
(
context
)!.
index
].
documentationUrl
;
if
(
url
==
null
)
{
return
;
}
...
...
@@ -75,7 +80,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
final
Uri
uri
=
Uri
.
parse
(
url
);
if
(
await
canLaunchUrl
(
uri
))
{
await
launchUrl
(
uri
);
}
else
{
}
else
if
(
mounted
)
{
showDialog
<
void
>(
context:
context
,
builder:
(
BuildContext
context
)
{
...
...
@@ -96,12 +101,12 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
@override
Widget
build
(
BuildContext
context
)
{
return
DefaultTabController
(
length:
demos
!.
length
,
length:
widget
.
demos
!.
length
,
child:
Scaffold
(
appBar:
AppBar
(
title:
Text
(
title
!),
title:
Text
(
widget
.
title
!),
actions:
<
Widget
>[
...?
actions
,
...?
widget
.
actions
,
Builder
(
builder:
(
BuildContext
context
)
{
return
IconButton
(
...
...
@@ -110,7 +115,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
);
},
),
if
(
showExampleCodeAction
)
if
(
widget
.
showExampleCodeAction
)
Builder
(
builder:
(
BuildContext
context
)
{
return
IconButton
(
...
...
@@ -122,12 +127,12 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
),
],
bottom:
TabBar
(
isScrollable:
isScrollable
,
tabs:
demos
!.
map
<
Widget
>((
ComponentDemoTabData
data
)
=>
Tab
(
text:
data
.
tabName
)).
toList
(),
isScrollable:
widget
.
isScrollable
,
tabs:
widget
.
demos
!.
map
<
Widget
>((
ComponentDemoTabData
data
)
=>
Tab
(
text:
data
.
tabName
)).
toList
(),
),
),
body:
TabBarView
(
children:
demos
!.
map
<
Widget
>((
ComponentDemoTabData
demo
)
{
children:
widget
.
demos
!.
map
<
Widget
>((
ComponentDemoTabData
demo
)
{
return
SafeArea
(
top:
false
,
bottom:
false
,
...
...
dev/integration_tests/flutter_gallery/lib/gallery/updater.dart
View file @
4f9b19e2
...
...
@@ -35,9 +35,11 @@ class UpdaterState extends State<Updater> {
_lastUpdateCheck
=
DateTime
.
now
();
final
String
?
updateUrl
=
await
widget
.
updateUrlFetcher
();
final
bool
?
wantsUpdate
=
await
showDialog
<
bool
>(
context:
context
,
builder:
_buildDialog
);
if
(
wantsUpdate
!=
null
&&
updateUrl
!=
null
&&
wantsUpdate
)
{
launchUrl
(
Uri
.
parse
(
updateUrl
));
if
(
mounted
)
{
final
bool
?
wantsUpdate
=
await
showDialog
<
bool
>(
context:
context
,
builder:
_buildDialog
);
if
(
wantsUpdate
!=
null
&&
updateUrl
!=
null
&&
wantsUpdate
)
{
launchUrl
(
Uri
.
parse
(
updateUrl
));
}
}
}
...
...
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