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
3abb9e50
Unverified
Commit
3abb9e50
authored
Dec 23, 2020
by
Kate Lovett
Committed by
GitHub
Dec 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove deprecated showDialog.child (#72532)
parent
5eabfc24
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
43 additions
and
40 deletions
+43
-40
fix_data.yaml
packages/flutter/lib/fix_data.yaml
+20
-1
dialog.dart
packages/flutter/lib/src/material/dialog.dart
+2
-10
dialog_test.dart
packages/flutter/test/material/dialog_test.dart
+1
-29
material.dart
packages/flutter/test_fixes/material.dart
+10
-0
material.dart.expect
packages/flutter/test_fixes/material.dart.expect
+10
-0
No files found.
packages/flutter/lib/fix_data.yaml
View file @
3abb9e50
...
...
@@ -11,6 +11,26 @@
version
:
1
transforms
:
# Changes made in https://github.com/flutter/flutter/pull/15303
-
title
:
'
Replace
child
with
builder'
date
:
2020-12-17
element
:
uris
:
[
'
material.dart'
]
function
:
'
showDialog'
changes
:
-
kind
:
'
addParameter'
index
:
0
name
:
'
builder'
style
:
optional_named
argumentValue
:
expression
:
'
(context)
=>
{%
widget
%}'
requiredIf
:
"
widget
!=
''"
variables
:
widget
:
kind
:
fragment
value
:
'
arguments[child]'
-
kind
:
'
removeParameter'
name
:
'
child'
# Changes made in https://github.com/flutter/flutter/pull/28602
-
title
:
'
Rename
to
fromMouseEvent'
date
:
2020-12-15
...
...
@@ -33,7 +53,6 @@ transforms:
-
kind
:
'
rename'
newName
:
'
fromMouseEvent'
# Changes made in https://github.com/flutter/flutter/pull/41859
-
title
:
'
Remove
brightness'
date
:
2020-12-10
...
...
packages/flutter/lib/src/material/dialog.dart
View file @
3abb9e50
...
...
@@ -967,16 +967,8 @@ Future<T?> showDialog<T>({
bool
useSafeArea
=
true
,
bool
useRootNavigator
=
true
,
RouteSettings
?
routeSettings
,
@Deprecated
(
'Instead of using the "child" argument, return the child from a closure '
'provided to the "builder" argument. This will ensure that the BuildContext '
'is appropriate for widgets built in the dialog. '
'This feature was deprecated after v0.2.3.'
)
Widget
?
child
,
})
{
assert
(
child
==
null
||
builder
==
null
);
assert
(
child
!=
null
||
builder
!=
null
);
assert
(
builder
!=
null
);
assert
(
barrierDismissible
!=
null
);
assert
(
useSafeArea
!=
null
);
assert
(
useRootNavigator
!=
null
);
...
...
@@ -986,7 +978,7 @@ Future<T?> showDialog<T>({
return
showGeneralDialog
(
context:
context
,
pageBuilder:
(
BuildContext
buildContext
,
Animation
<
double
>
animation
,
Animation
<
double
>
secondaryAnimation
)
{
final
Widget
pageChild
=
child
??
Builder
(
builder:
builder
!);
final
Widget
pageChild
=
Builder
(
builder:
builder
!);
Widget
dialog
=
themes
.
wrap
(
pageChild
);
if
(
useSafeArea
)
{
dialog
=
SafeArea
(
child:
dialog
);
...
...
packages/flutter/test/material/dialog_test.dart
View file @
3abb9e50
...
...
@@ -217,35 +217,7 @@ void main() {
expect
(
materialWidget
.
shape
,
customBorder
);
});
testWidgets
(
'showDialog child and builder cannot be simultaneously defined'
,
(
WidgetTester
tester
)
async
{
late
BuildContext
currentBuildContext
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
Center
(
child:
Builder
(
builder:
(
BuildContext
context
)
{
currentBuildContext
=
context
;
return
Container
();
}
),
),
),
),
);
expect
(()
async
{
showDialog
<
void
>(
context:
currentBuildContext
,
child:
const
Text
(
'Child'
),
builder:
(
BuildContext
context
)
{
return
const
Text
(
'Builder'
);
},
);
},
throwsAssertionError
);
});
testWidgets
(
'showDialog child or builder must be defined'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'showDialog builder must be defined'
,
(
WidgetTester
tester
)
async
{
late
BuildContext
currentBuildContext
;
await
tester
.
pumpWidget
(
MaterialApp
(
...
...
packages/flutter/test_fixes/material.dart
0 → 100644
View file @
3abb9e50
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import
'package:flutter/material.dart'
;
void
main
(
)
{
// Change made in https://github.com/flutter/flutter/pull/15303
showDialog
(
child:
Text
(
'Fix me.'
));
}
packages/flutter/test_fixes/material.dart.expect
0 → 100644
View file @
3abb9e50
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:flutter/material.dart';
void main() {
// Change made in https://github.com/flutter/flutter/pull/15303
showDialog(builder: (context) => Text('Fix me.'));
}
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