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
Show 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 {
...
@@ -41,7 +41,7 @@ class ComponentDemoTabData {
int
get
hashCode
=>
Object
.
hash
(
tabName
,
description
,
documentationUrl
);
int
get
hashCode
=>
Object
.
hash
(
tabName
,
description
,
documentationUrl
);
}
}
class
TabbedComponentDemoScaffold
extends
State
less
Widget
{
class
TabbedComponentDemoScaffold
extends
State
ful
Widget
{
const
TabbedComponentDemoScaffold
({
const
TabbedComponentDemoScaffold
({
super
.
key
,
super
.
key
,
this
.
title
,
this
.
title
,
...
@@ -57,8 +57,13 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
...
@@ -57,8 +57,13 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
final
bool
isScrollable
;
final
bool
isScrollable
;
final
bool
showExampleCodeAction
;
final
bool
showExampleCodeAction
;
@override
State
<
TabbedComponentDemoScaffold
>
createState
()
=>
_TabbedComponentDemoScaffoldState
();
}
class
_TabbedComponentDemoScaffoldState
extends
State
<
TabbedComponentDemoScaffold
>
{
void
_showExampleCode
(
BuildContext
context
)
{
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
)
{
if
(
tag
!=
null
)
{
Navigator
.
push
(
context
,
MaterialPageRoute
<
FullScreenCodeDialog
>(
Navigator
.
push
(
context
,
MaterialPageRoute
<
FullScreenCodeDialog
>(
builder:
(
BuildContext
context
)
=>
FullScreenCodeDialog
(
exampleCodeTag:
tag
)
builder:
(
BuildContext
context
)
=>
FullScreenCodeDialog
(
exampleCodeTag:
tag
)
...
@@ -67,7 +72,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
...
@@ -67,7 +72,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
}
}
Future
<
void
>
_showApiDocumentation
(
BuildContext
context
)
async
{
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
)
{
if
(
url
==
null
)
{
return
;
return
;
}
}
...
@@ -75,7 +80,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
...
@@ -75,7 +80,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
final
Uri
uri
=
Uri
.
parse
(
url
);
final
Uri
uri
=
Uri
.
parse
(
url
);
if
(
await
canLaunchUrl
(
uri
))
{
if
(
await
canLaunchUrl
(
uri
))
{
await
launchUrl
(
uri
);
await
launchUrl
(
uri
);
}
else
{
}
else
if
(
mounted
)
{
showDialog
<
void
>(
showDialog
<
void
>(
context:
context
,
context:
context
,
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
...
@@ -96,12 +101,12 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
...
@@ -96,12 +101,12 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
@override
@override
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
DefaultTabController
(
return
DefaultTabController
(
length:
demos
!.
length
,
length:
widget
.
demos
!.
length
,
child:
Scaffold
(
child:
Scaffold
(
appBar:
AppBar
(
appBar:
AppBar
(
title:
Text
(
title
!),
title:
Text
(
widget
.
title
!),
actions:
<
Widget
>[
actions:
<
Widget
>[
...?
actions
,
...?
widget
.
actions
,
Builder
(
Builder
(
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
return
IconButton
(
return
IconButton
(
...
@@ -110,7 +115,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
...
@@ -110,7 +115,7 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
);
);
},
},
),
),
if
(
showExampleCodeAction
)
if
(
widget
.
showExampleCodeAction
)
Builder
(
Builder
(
builder:
(
BuildContext
context
)
{
builder:
(
BuildContext
context
)
{
return
IconButton
(
return
IconButton
(
...
@@ -122,12 +127,12 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
...
@@ -122,12 +127,12 @@ class TabbedComponentDemoScaffold extends StatelessWidget {
),
),
],
],
bottom:
TabBar
(
bottom:
TabBar
(
isScrollable:
isScrollable
,
isScrollable:
widget
.
isScrollable
,
tabs:
demos
!.
map
<
Widget
>((
ComponentDemoTabData
data
)
=>
Tab
(
text:
data
.
tabName
)).
toList
(),
tabs:
widget
.
demos
!.
map
<
Widget
>((
ComponentDemoTabData
data
)
=>
Tab
(
text:
data
.
tabName
)).
toList
(),
),
),
),
),
body:
TabBarView
(
body:
TabBarView
(
children:
demos
!.
map
<
Widget
>((
ComponentDemoTabData
demo
)
{
children:
widget
.
demos
!.
map
<
Widget
>((
ComponentDemoTabData
demo
)
{
return
SafeArea
(
return
SafeArea
(
top:
false
,
top:
false
,
bottom:
false
,
bottom:
false
,
...
...
dev/integration_tests/flutter_gallery/lib/gallery/updater.dart
View file @
4f9b19e2
...
@@ -35,11 +35,13 @@ class UpdaterState extends State<Updater> {
...
@@ -35,11 +35,13 @@ class UpdaterState extends State<Updater> {
_lastUpdateCheck
=
DateTime
.
now
();
_lastUpdateCheck
=
DateTime
.
now
();
final
String
?
updateUrl
=
await
widget
.
updateUrlFetcher
();
final
String
?
updateUrl
=
await
widget
.
updateUrlFetcher
();
if
(
mounted
)
{
final
bool
?
wantsUpdate
=
await
showDialog
<
bool
>(
context:
context
,
builder:
_buildDialog
);
final
bool
?
wantsUpdate
=
await
showDialog
<
bool
>(
context:
context
,
builder:
_buildDialog
);
if
(
wantsUpdate
!=
null
&&
updateUrl
!=
null
&&
wantsUpdate
)
{
if
(
wantsUpdate
!=
null
&&
updateUrl
!=
null
&&
wantsUpdate
)
{
launchUrl
(
Uri
.
parse
(
updateUrl
));
launchUrl
(
Uri
.
parse
(
updateUrl
));
}
}
}
}
}
Widget
_buildDialog
(
BuildContext
context
)
{
Widget
_buildDialog
(
BuildContext
context
)
{
final
ThemeData
theme
=
Theme
.
of
(
context
);
final
ThemeData
theme
=
Theme
.
of
(
context
);
...
...
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