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
7b7778a8
Unverified
Commit
7b7778a8
authored
Nov 05, 2021
by
Markus Aksli
Committed by
GitHub
Nov 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add golden tests for default and overriden `expandedTitleScale` in `FlexibleSpaceBar` (#93059)
parent
a4fa2aff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
125 additions
and
0 deletions
+125
-0
flexible_space_bar_test.dart
packages/flutter/test/material/flexible_space_bar_test.dart
+125
-0
No files found.
packages/flutter/test/material/flexible_space_bar_test.dart
View file @
7b7778a8
...
...
@@ -2,6 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// This file is run as part of a reduced test set in CI on Mac and Windows
// machines.
@Tags
(<
String
>[
'reduced-test-set'
])
import
'package:flutter/material.dart'
;
import
'package:flutter_test/flutter_test.dart'
;
...
...
@@ -542,6 +546,127 @@ void main() {
);
});
testWidgets
(
'FlexibleSpaceBar scaled title'
,
(
WidgetTester
tester
)
async
{
const
double
titleFontSize
=
20.0
;
const
double
height
=
300.0
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
CustomScrollView
(
slivers:
<
Widget
>[
const
SliverAppBar
(
expandedHeight:
height
,
pinned:
true
,
stretch:
true
,
flexibleSpace:
RepaintBoundary
(
child:
FlexibleSpaceBar
(
title:
Text
(
'X'
,
style:
TextStyle
(
fontSize:
titleFontSize
,),
),
centerTitle:
false
,
),
),
),
SliverList
(
delegate:
SliverChildListDelegate
(
<
Widget
>[
for
(
int
i
=
0
;
i
<
3
;
i
+=
1
)
SizedBox
(
height:
200.0
,
child:
Center
(
child:
Text
(
'Item
$i
'
)),
),
],
),
),
],
),
),
),
);
// We drag up to fully collapse the space bar.
await
tester
.
drag
(
find
.
text
(
'Item 0'
),
const
Offset
(
0
,
-
600.0
));
await
tester
.
pumpAndSettle
();
final
Finder
flexibleSpaceBar
=
find
.
ancestor
(
of:
find
.
byType
(
FlexibleSpaceBar
),
matching:
find
.
byType
(
RepaintBoundary
).
first
);
await
expectLater
(
flexibleSpaceBar
,
matchesGoldenFile
(
'flexible_space_bar.expanded_title_scale_default.collapsed.png'
)
);
// We drag down to fully expand the space bar.
await
tester
.
drag
(
find
.
text
(
'Item 2'
),
const
Offset
(
0
,
600.0
));
await
tester
.
pumpAndSettle
();
await
expectLater
(
flexibleSpaceBar
,
matchesGoldenFile
(
'flexible_space_bar.expanded_title_scale_default.expanded.png'
)
);
});
testWidgets
(
'FlexibleSpaceBar scaled title - override expandedTitleScale'
,
(
WidgetTester
tester
)
async
{
const
double
titleFontSize
=
20.0
;
const
double
height
=
300.0
;
const
double
expandedTitleScale
=
3.0
;
await
tester
.
pumpWidget
(
MaterialApp
(
home:
Scaffold
(
body:
CustomScrollView
(
slivers:
<
Widget
>[
const
SliverAppBar
(
expandedHeight:
height
,
pinned:
true
,
stretch:
true
,
flexibleSpace:
RepaintBoundary
(
child:
FlexibleSpaceBar
(
title:
Text
(
'X'
,
style:
TextStyle
(
fontSize:
titleFontSize
,),
),
centerTitle:
false
,
expandedTitleScale:
expandedTitleScale
,
),
),
),
SliverList
(
delegate:
SliverChildListDelegate
(
<
Widget
>[
for
(
int
i
=
0
;
i
<
3
;
i
+=
1
)
SizedBox
(
height:
200.0
,
child:
Center
(
child:
Text
(
'Item
$i
'
)),
),
],
),
),
],
),
),
),
);
// We drag up to fully collapse the space bar.
await
tester
.
drag
(
find
.
text
(
'Item 0'
),
const
Offset
(
0
,
-
600.0
));
await
tester
.
pumpAndSettle
();
final
Finder
flexibleSpaceBar
=
find
.
ancestor
(
of:
find
.
byType
(
FlexibleSpaceBar
),
matching:
find
.
byType
(
RepaintBoundary
).
first
);
// This should match the default behavior
await
expectLater
(
flexibleSpaceBar
,
matchesGoldenFile
(
'flexible_space_bar.expanded_title_scale_default.collapsed.png'
)
);
// We drag down to fully expand the space bar.
await
tester
.
drag
(
find
.
text
(
'Item 2'
),
const
Offset
(
0
,
600.0
));
await
tester
.
pumpAndSettle
();
await
expectLater
(
flexibleSpaceBar
,
matchesGoldenFile
(
'flexible_space_bar.expanded_title_scale_override.expanded.png'
)
);
});
testWidgets
(
'FlexibleSpaceBar test titlePadding defaults'
,
(
WidgetTester
tester
)
async
{
Widget
buildFrame
(
TargetPlatform
platform
,
bool
?
centerTitle
)
{
return
MaterialApp
(
...
...
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