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
7625c10f
Unverified
Commit
7625c10f
authored
Sep 05, 2023
by
Polina Cherkasova
Committed by
GitHub
Sep 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
_MaterialAppState should dispose MaterialHeroController. (#133951)
parent
af1b7494
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
61 deletions
+93
-61
app.dart
packages/flutter/lib/src/material/app.dart
+6
-0
heroes.dart
packages/flutter/lib/src/widgets/heroes.dart
+21
-0
snack_bar_test.dart
packages/flutter/test/material/snack_bar_test.dart
+4
-1
stepper_test.dart
packages/flutter/test/material/stepper_test.dart
+61
-59
switch_list_tile_test.dart
packages/flutter/test/material/switch_list_tile_test.dart
+1
-1
No files found.
packages/flutter/lib/src/material/app.dart
View file @
7625c10f
...
@@ -880,6 +880,12 @@ class _MaterialAppState extends State<MaterialApp> {
...
@@ -880,6 +880,12 @@ class _MaterialAppState extends State<MaterialApp> {
_heroController
=
MaterialApp
.
createMaterialHeroController
();
_heroController
=
MaterialApp
.
createMaterialHeroController
();
}
}
@override
void
dispose
()
{
_heroController
.
dispose
();
super
.
dispose
();
}
// Combine the Localizations for Material with the ones contributed
// Combine the Localizations for Material with the ones contributed
// by the localizationsDelegates parameter, if any. Only the first delegate
// by the localizationsDelegates parameter, if any. Only the first delegate
// of a particular LocalizationsDelegate.type is loaded so the
// of a particular LocalizationsDelegate.type is loaded so the
...
...
packages/flutter/lib/src/widgets/heroes.dart
View file @
7625c10f
...
@@ -612,6 +612,19 @@ class _HeroFlight {
...
@@ -612,6 +612,19 @@ class _HeroFlight {
navigator
.
userGestureInProgressNotifier
.
addListener
(
delayedPerformAnimationUpdate
);
navigator
.
userGestureInProgressNotifier
.
addListener
(
delayedPerformAnimationUpdate
);
}
}
/// Releases resources.
@mustCallSuper
void
dispose
()
{
if
(
overlayEntry
!=
null
)
{
overlayEntry
!.
remove
();
overlayEntry
!.
dispose
();
overlayEntry
=
null
;
_proxyAnimation
.
parent
=
null
;
_proxyAnimation
.
removeListener
(
onTick
);
_proxyAnimation
.
removeStatusListener
(
_handleAnimationUpdate
);
}
}
void
onTick
()
{
void
onTick
()
{
final
RenderBox
?
toHeroBox
=
(!
_aborted
&&
manifest
.
toHero
.
mounted
)
final
RenderBox
?
toHeroBox
=
(!
_aborted
&&
manifest
.
toHero
.
mounted
)
?
manifest
.
toHero
.
context
.
findRenderObject
()
as
RenderBox
?
?
manifest
.
toHero
.
context
.
findRenderObject
()
as
RenderBox
?
...
@@ -1027,6 +1040,14 @@ class HeroController extends NavigatorObserver {
...
@@ -1027,6 +1040,14 @@ class HeroController extends NavigatorObserver {
},
},
);
);
}
}
/// Releases resources.
@mustCallSuper
void
dispose
()
{
for
(
final
_HeroFlight
flight
in
_flights
.
values
)
{
flight
.
dispose
();
}
}
}
}
/// Enables or disables [Hero]es in the widget subtree.
/// Enables or disables [Hero]es in the widget subtree.
...
...
packages/flutter/test/material/snack_bar_test.dart
View file @
7625c10f
...
@@ -14,6 +14,7 @@ import 'package:flutter/foundation.dart';
...
@@ -14,6 +14,7 @@ import 'package:flutter/foundation.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter/rendering.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'SnackBar control test'
,
(
WidgetTester
tester
)
async
{
testWidgets
(
'SnackBar control test'
,
(
WidgetTester
tester
)
async
{
...
@@ -2542,7 +2543,9 @@ void main() {
...
@@ -2542,7 +2543,9 @@ void main() {
expect
(
find
.
text
(
secondHeader
),
findsOneWidget
);
expect
(
find
.
text
(
secondHeader
),
findsOneWidget
);
});
});
testWidgets
(
'Should have only one SnackBar during back swipe navigation'
,
(
WidgetTester
tester
)
async
{
testWidgetsWithLeakTracking
(
'Should have only one SnackBar during back swipe navigation'
,
leakTrackingTestConfig:
LeakTrackingTestConfig
.
debugNotDisposed
(),
(
WidgetTester
tester
)
async
{
const
String
snackBarText
=
'hello snackbar'
;
const
String
snackBarText
=
'hello snackbar'
;
const
Key
snackTarget
=
Key
(
'snack-target'
);
const
Key
snackTarget
=
Key
(
'snack-target'
);
const
Key
transitionTarget
=
Key
(
'transition-target'
);
const
Key
transitionTarget
=
Key
(
'transition-target'
);
...
...
packages/flutter/test/material/stepper_test.dart
View file @
7625c10f
...
@@ -5,9 +5,10 @@
...
@@ -5,9 +5,10 @@
import
'package:flutter/foundation.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
import
'package:leak_tracker_flutter_testing/leak_tracker_flutter_testing.dart'
;
void
main
(
)
{
void
main
(
)
{
testWidgets
(
'Material3 has sentence case labels'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 has sentence case labels'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
theme:
ThemeData
(
useMaterial3:
true
),
theme:
ThemeData
(
useMaterial3:
true
),
...
@@ -38,7 +39,7 @@ void main() {
...
@@ -38,7 +39,7 @@ void main() {
expect
(
find
.
text
(
'Cancel'
),
findsWidgets
);
expect
(
find
.
text
(
'Cancel'
),
findsWidgets
);
});
});
testWidgets
(
'Stepper tap callback test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper tap callback test'
,
(
WidgetTester
tester
)
async
{
int
index
=
0
;
int
index
=
0
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -72,7 +73,7 @@ void main() {
...
@@ -72,7 +73,7 @@ void main() {
expect
(
index
,
1
);
expect
(
index
,
1
);
});
});
testWidgets
(
'Stepper expansion test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper expansion test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Center
(
home:
Center
(
...
@@ -139,7 +140,7 @@ void main() {
...
@@ -139,7 +140,7 @@ void main() {
expect
(
box
.
size
.
height
,
432.0
);
expect
(
box
.
size
.
height
,
432.0
);
});
});
testWidgets
(
'Stepper horizontal size test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper horizontal size test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Center
(
home:
Center
(
...
@@ -165,7 +166,7 @@ void main() {
...
@@ -165,7 +166,7 @@ void main() {
expect
(
box
.
size
.
height
,
600.0
);
expect
(
box
.
size
.
height
,
600.0
);
});
});
testWidgets
(
'Stepper visibility test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper visibility test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
...
@@ -214,7 +215,7 @@ void main() {
...
@@ -214,7 +215,7 @@ void main() {
expect
(
find
.
text
(
'B'
),
findsOneWidget
);
expect
(
find
.
text
(
'B'
),
findsOneWidget
);
});
});
testWidgets
(
'Material2 - Stepper button test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material2 - Stepper button test'
,
(
WidgetTester
tester
)
async
{
bool
continuePressed
=
false
;
bool
continuePressed
=
false
;
bool
cancelPressed
=
false
;
bool
cancelPressed
=
false
;
...
@@ -258,7 +259,7 @@ void main() {
...
@@ -258,7 +259,7 @@ void main() {
expect
(
cancelPressed
,
isTrue
);
expect
(
cancelPressed
,
isTrue
);
});
});
testWidgets
(
'Material3 - Stepper button test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - Stepper button test'
,
(
WidgetTester
tester
)
async
{
bool
continuePressed
=
false
;
bool
continuePressed
=
false
;
bool
cancelPressed
=
false
;
bool
cancelPressed
=
false
;
...
@@ -302,7 +303,7 @@ void main() {
...
@@ -302,7 +303,7 @@ void main() {
expect
(
cancelPressed
,
isTrue
);
expect
(
cancelPressed
,
isTrue
);
});
});
testWidgets
(
'Stepper disabled step test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper disabled step test'
,
(
WidgetTester
tester
)
async
{
int
index
=
0
;
int
index
=
0
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -338,7 +339,7 @@ void main() {
...
@@ -338,7 +339,7 @@ void main() {
expect
(
index
,
0
);
expect
(
index
,
0
);
});
});
testWidgets
(
'Stepper scroll test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper scroll test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
...
@@ -412,7 +413,7 @@ void main() {
...
@@ -412,7 +413,7 @@ void main() {
expect
(
scrollableState
.
position
.
pixels
,
greaterThan
(
0.0
));
expect
(
scrollableState
.
position
.
pixels
,
greaterThan
(
0.0
));
});
});
testWidgets
(
'Stepper index test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper index test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Center
(
home:
Center
(
...
@@ -445,7 +446,7 @@ void main() {
...
@@ -445,7 +446,7 @@ void main() {
expect
(
find
.
text
(
'2'
),
findsOneWidget
);
expect
(
find
.
text
(
'2'
),
findsOneWidget
);
});
});
testWidgets
(
'Stepper custom controls test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper custom controls test'
,
(
WidgetTester
tester
)
async
{
bool
continuePressed
=
false
;
bool
continuePressed
=
false
;
void
setContinue
()
{
void
setContinue
()
{
continuePressed
=
true
;
continuePressed
=
true
;
...
@@ -524,7 +525,7 @@ void main() {
...
@@ -524,7 +525,7 @@ void main() {
expect
(
continuePressed
,
isTrue
);
expect
(
continuePressed
,
isTrue
);
});
});
testWidgets
(
'Stepper custom indexed controls test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper custom indexed controls test'
,
(
WidgetTester
tester
)
async
{
int
currentStep
=
0
;
int
currentStep
=
0
;
void
setContinue
()
{
void
setContinue
()
{
...
@@ -619,7 +620,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -619,7 +620,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
find
.
text
(
'Continue to 2'
),
findsNWidgets
(
1
));
expect
(
find
.
text
(
'Continue to 2'
),
findsNWidgets
(
1
));
});
});
testWidgets
(
'Stepper error test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper error test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Center
(
home:
Center
(
...
@@ -644,7 +645,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -644,7 +645,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
find
.
text
(
'!'
),
findsOneWidget
);
expect
(
find
.
text
(
'!'
),
findsOneWidget
);
});
});
testWidgets
(
'Nested stepper error test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Nested stepper error test'
,
(
WidgetTester
tester
)
async
{
late
FlutterErrorDetails
errorDetails
;
late
FlutterErrorDetails
errorDetails
;
final
FlutterExceptionHandler
?
oldHandler
=
FlutterError
.
onError
;
final
FlutterExceptionHandler
?
oldHandler
=
FlutterError
.
onError
;
FlutterError
.
onError
=
(
FlutterErrorDetails
details
)
{
FlutterError
.
onError
=
(
FlutterErrorDetails
details
)
{
...
@@ -711,7 +712,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -711,7 +712,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
});
});
///https://github.com/flutter/flutter/issues/16920
///https://github.com/flutter/flutter/issues/16920
testWidgets
(
'Stepper icons size test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper icons size test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
...
@@ -740,7 +741,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -740,7 +741,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
renderObject
.
size
,
equals
(
const
Size
.
square
(
18.0
)));
expect
(
renderObject
.
size
,
equals
(
const
Size
.
square
(
18.0
)));
});
});
testWidgets
(
'Stepper physics scroll error test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper physics scroll error test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
...
@@ -773,7 +774,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -773,7 +774,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
find
.
text
(
'Text After Stepper'
),
findsNothing
);
expect
(
find
.
text
(
'Text After Stepper'
),
findsNothing
);
});
});
testWidgets
(
"Vertical Stepper can't be focused when disabled."
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
"Vertical Stepper can't be focused when disabled."
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
...
@@ -797,7 +798,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -797,7 +798,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
disabledNode
.
hasPrimaryFocus
,
isFalse
);
expect
(
disabledNode
.
hasPrimaryFocus
,
isFalse
);
});
});
testWidgets
(
"Horizontal Stepper can't be focused when disabled."
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
"Horizontal Stepper can't be focused when disabled."
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
...
@@ -822,7 +823,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -822,7 +823,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
disabledNode
.
hasPrimaryFocus
,
isFalse
);
expect
(
disabledNode
.
hasPrimaryFocus
,
isFalse
);
});
});
testWidgets
(
'Stepper header title should not overflow'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper header title should not overflow'
,
(
WidgetTester
tester
)
async
{
const
String
longText
=
const
String
longText
=
'A long long long long long long long long long long long long text'
;
'A long long long long long long long long long long long long text'
;
...
@@ -848,7 +849,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -848,7 +849,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
tester
.
takeException
(),
isNull
);
expect
(
tester
.
takeException
(),
isNull
);
});
});
testWidgets
(
'Stepper header subtitle should not overflow'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper header subtitle should not overflow'
,
(
WidgetTester
tester
)
async
{
const
String
longText
=
const
String
longText
=
'A long long long long long long long long long long long long text'
;
'A long long long long long long long long long long long long text'
;
...
@@ -875,7 +876,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -875,7 +876,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
tester
.
takeException
(),
isNull
);
expect
(
tester
.
takeException
(),
isNull
);
});
});
testWidgets
(
'Material2 - Stepper enabled button styles'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material2 - Stepper enabled button styles'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
ThemeData
theme
)
{
Widget
buildFrame
(
ThemeData
theme
)
{
return
MaterialApp
(
return
MaterialApp
(
theme:
theme
,
theme:
theme
,
...
@@ -935,7 +936,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -935,7 +936,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
tester
.
getRect
(
find
.
widgetWithText
(
TextButton
,
cancelStr
)),
cancelButtonRect
);
expect
(
tester
.
getRect
(
find
.
widgetWithText
(
TextButton
,
cancelStr
)),
cancelButtonRect
);
});
});
testWidgets
(
'Material3 - Stepper enabled button styles'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - Stepper enabled button styles'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
ThemeData
theme
)
{
Widget
buildFrame
(
ThemeData
theme
)
{
return
MaterialApp
(
return
MaterialApp
(
theme:
theme
,
theme:
theme
,
...
@@ -1007,7 +1008,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1007,7 +1008,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
);
);
});
});
testWidgets
(
'Material2 - Stepper disabled button styles'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material2 - Stepper disabled button styles'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
ThemeData
theme
)
{
Widget
buildFrame
(
ThemeData
theme
)
{
return
MaterialApp
(
return
MaterialApp
(
theme:
theme
,
theme:
theme
,
...
@@ -1053,7 +1054,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1053,7 +1054,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
buttonMaterial
(
cancelStr
).
textStyle
!.
color
!.
value
,
0x61ffffff
);
expect
(
buttonMaterial
(
cancelStr
).
textStyle
!.
color
!.
value
,
0x61ffffff
);
});
});
testWidgets
(
'Material3 - Stepper disabled button styles'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - Stepper disabled button styles'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
ThemeData
theme
)
{
Widget
buildFrame
(
ThemeData
theme
)
{
return
MaterialApp
(
return
MaterialApp
(
theme:
theme
,
theme:
theme
,
...
@@ -1113,7 +1114,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1113,7 +1114,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
);
);
});
});
testWidgets
(
'Vertical and Horizontal Stepper physics test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Vertical and Horizontal Stepper physics test'
,
(
WidgetTester
tester
)
async
{
const
ScrollPhysics
physics
=
NeverScrollableScrollPhysics
();
const
ScrollPhysics
physics
=
NeverScrollableScrollPhysics
();
for
(
final
StepperType
type
in
StepperType
.
values
)
{
for
(
final
StepperType
type
in
StepperType
.
values
)
{
...
@@ -1142,38 +1143,39 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1142,38 +1143,39 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
}
}
});
});
testWidgets
(
'ScrollController is passed to the stepper listview'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'ScrollController is passed to the stepper listview'
,
(
WidgetTester
tester
)
async
{
final
ScrollController
controller
=
ScrollController
();
final
ScrollController
controller
=
ScrollController
();
for
(
final
StepperType
type
in
StepperType
.
values
)
{
addTearDown
(()
=>
controller
.
dispose
());
await
tester
.
pumpWidget
(
for
(
final
StepperType
type
in
StepperType
.
values
)
{
MaterialApp
(
await
tester
.
pumpWidget
(
home:
Material
(
MaterialApp
(
child:
Stepper
(
home:
Material
(
controller:
controller
,
child:
Stepper
(
type:
type
,
controller:
controller
,
steps:
const
<
Step
>[
type:
type
,
Step
(
steps:
const
<
Step
>[
title:
Text
(
'Step 1'
),
Step
(
content:
SizedBox
(
title:
Text
(
'Step 1'
),
width:
100.0
,
content:
SizedBox
(
height
:
100.0
,
width
:
100.0
,
)
,
height:
100.0
,
),
),
]
,
)
,
)
,
]
,
),
),
),
),
);
),
);
final
ListView
listView
=
tester
.
widget
<
ListView
>(
final
ListView
listView
=
tester
.
widget
<
ListView
>(
find
.
descendant
(
of:
find
.
byType
(
Stepper
),
find
.
descendant
(
of:
find
.
byType
(
Stepper
),
matching:
find
.
byType
(
ListView
),
matching:
find
.
byType
(
ListView
),
));
));
expect
(
listView
.
controller
,
controller
);
expect
(
listView
.
controller
,
controller
);
}
}
});
});
testWidgets
(
'Stepper horizontal size test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper horizontal size test'
,
(
WidgetTester
tester
)
async
{
// Regression test for https://github.com/flutter/flutter/pull/77732
// Regression test for https://github.com/flutter/flutter/pull/77732
Widget
buildFrame
({
bool
isActive
=
true
,
Brightness
?
brightness
})
{
Widget
buildFrame
({
bool
isActive
=
true
,
Brightness
?
brightness
})
{
return
MaterialApp
(
return
MaterialApp
(
...
@@ -1218,7 +1220,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1218,7 +1220,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
circleFillColor
(),
dark
.
background
);
expect
(
circleFillColor
(),
dark
.
background
);
});
});
testWidgets
(
'Stepper custom elevation'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper custom elevation'
,
(
WidgetTester
tester
)
async
{
const
double
elevation
=
4.0
;
const
double
elevation
=
4.0
;
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
...
@@ -1252,7 +1254,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1252,7 +1254,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
material
.
elevation
,
elevation
);
expect
(
material
.
elevation
,
elevation
);
});
});
testWidgets
(
'Stepper with default elevation'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper with default elevation'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
...
@@ -1284,7 +1286,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1284,7 +1286,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
material
.
elevation
,
2.0
);
expect
(
material
.
elevation
,
2.0
);
});
});
testWidgets
(
'Stepper horizontal preserves state'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper horizontal preserves state'
,
(
WidgetTester
tester
)
async
{
const
Color
untappedColor
=
Colors
.
blue
;
const
Color
untappedColor
=
Colors
.
blue
;
const
Color
tappedColor
=
Colors
.
red
;
const
Color
tappedColor
=
Colors
.
red
;
int
index
=
0
;
int
index
=
0
;
...
@@ -1355,7 +1357,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1355,7 +1357,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
// The color should still be `tappedColor`
// The color should still be `tappedColor`
expect
(
getColor
(),
tappedColor
);
expect
(
getColor
(),
tappedColor
);
});
});
testWidgets
(
'Stepper custom margin'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper custom margin'
,
(
WidgetTester
tester
)
async
{
const
EdgeInsetsGeometry
margin
=
EdgeInsetsDirectional
.
only
(
const
EdgeInsetsGeometry
margin
=
EdgeInsetsDirectional
.
only
(
bottom:
20
,
bottom:
20
,
...
@@ -1392,7 +1394,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1392,7 +1394,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
material
.
margin
,
equals
(
margin
));
expect
(
material
.
margin
,
equals
(
margin
));
});
});
testWidgets
(
'Stepper with Alternative Label'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper with Alternative Label'
,
(
WidgetTester
tester
)
async
{
int
index
=
0
;
int
index
=
0
;
late
TextStyle
bodyLargeStyle
;
late
TextStyle
bodyLargeStyle
;
late
TextStyle
bodyMediumStyle
;
late
TextStyle
bodyMediumStyle
;
...
@@ -1476,7 +1478,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1476,7 +1478,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
bodyMediumStyle
,
nextLabelTextWidget
.
style
);
expect
(
bodyMediumStyle
,
nextLabelTextWidget
.
style
);
});
});
testWidgets
(
'Stepper Connector Style'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper Connector Style'
,
(
WidgetTester
tester
)
async
{
const
Color
selectedColor
=
Colors
.
black
;
const
Color
selectedColor
=
Colors
.
black
;
const
Color
disabledColor
=
Colors
.
white
;
const
Color
disabledColor
=
Colors
.
white
;
int
index
=
0
;
int
index
=
0
;
...
@@ -1545,7 +1547,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
...
@@ -1545,7 +1547,7 @@ testWidgets('Stepper custom indexed controls test', (WidgetTester tester) async
expect
(
lineColor
(
'line0'
),
selectedColor
);
expect
(
lineColor
(
'line0'
),
selectedColor
);
});
});
testWidgets
(
'Stepper stepIconBuilder test'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Stepper stepIconBuilder test'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
await
tester
.
pumpWidget
(
MaterialApp
(
MaterialApp
(
home:
Material
(
home:
Material
(
...
...
packages/flutter/test/material/switch_list_tile_test.dart
View file @
7625c10f
...
@@ -865,7 +865,7 @@ void main() {
...
@@ -865,7 +865,7 @@ void main() {
);
);
});
});
testWidgets
(
'Material3 - SwitchListTile respects thumbColor in hovered/pressed states'
,
(
WidgetTester
tester
)
async
{
testWidgets
WithLeakTracking
(
'Material3 - SwitchListTile respects thumbColor in hovered/pressed states'
,
(
WidgetTester
tester
)
async
{
tester
.
binding
.
focusManager
.
highlightStrategy
=
FocusHighlightStrategy
.
alwaysTraditional
;
tester
.
binding
.
focusManager
.
highlightStrategy
=
FocusHighlightStrategy
.
alwaysTraditional
;
const
Color
hoveredThumbColor
=
Color
(
0xFF4caf50
);
const
Color
hoveredThumbColor
=
Color
(
0xFF4caf50
);
const
Color
pressedThumbColor
=
Color
(
0xFFF44336
);
const
Color
pressedThumbColor
=
Color
(
0xFFF44336
);
...
...
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