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
4ed9ab8b
Unverified
Commit
4ed9ab8b
authored
Sep 28, 2023
by
Alex Li
Committed by
GitHub
Sep 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🚀
Add more fields to `RefreshProgressIndicator` (#135207)
Resolves #134494
parent
6cde5da5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
89 additions
and
3 deletions
+89
-3
progress_indicator.dart
packages/flutter/lib/src/material/progress_indicator.dart
+20
-3
progress_indicator_test.dart
packages/flutter/test/material/progress_indicator_test.dart
+69
-0
No files found.
packages/flutter/lib/src/material/progress_indicator.dart
View file @
4ed9ab8b
...
...
@@ -865,8 +865,21 @@ class RefreshProgressIndicator extends CircularProgressIndicator {
super
.
semanticsLabel
,
super
.
semanticsValue
,
super
.
strokeCap
,
this
.
elevation
=
2.0
,
this
.
indicatorMargin
=
const
EdgeInsets
.
all
(
4.0
),
this
.
indicatorPadding
=
const
EdgeInsets
.
all
(
12.0
),
});
/// {@macro flutter.material.material.elevation}
final
double
elevation
;
/// The amount of space by which to inset the whole indicator.
/// It accommodates the [elevation] of the indicator.
final
EdgeInsetsGeometry
indicatorMargin
;
/// The amount of space by which to inset the inner refresh indicator.
final
EdgeInsetsGeometry
indicatorPadding
;
/// Default stroke width.
static
const
double
defaultStrokeWidth
=
2.5
;
...
...
@@ -913,6 +926,10 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState {
// Last value received from the widget before null.
double
?
_lastValue
;
/// Force casting the widget as [RefreshProgressIndicator].
@override
RefreshProgressIndicator
get
widget
=>
super
.
widget
as
RefreshProgressIndicator
;
// Always show the indeterminate version of the circular progress indicator.
//
// When value is non-null the sweep of the progress indicator arrow's arc
...
...
@@ -973,13 +990,13 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState {
child:
Container
(
width:
_indicatorSize
,
height:
_indicatorSize
,
margin:
const
EdgeInsets
.
all
(
4.0
),
// accommodate the shadow
margin:
widget
.
indicatorMargin
,
child:
Material
(
type:
MaterialType
.
circle
,
color:
backgroundColor
,
elevation:
2.0
,
elevation:
widget
.
elevation
,
child:
Padding
(
padding:
const
EdgeInsets
.
all
(
12.0
)
,
padding:
widget
.
indicatorPadding
,
child:
Opacity
(
opacity:
opacity
,
child:
Transform
.
rotate
(
...
...
packages/flutter/test/material/progress_indicator_test.dart
View file @
4ed9ab8b
...
...
@@ -1183,6 +1183,75 @@ void main() {
expect
(
tester
.
getSize
(
find
.
byType
(
CircularProgressIndicator
)),
const
Size
(
36
,
36
));
});
testWidgetsWithLeakTracking
(
'RefreshProgressIndicator using fields correctly'
,
(
WidgetTester
tester
)
async
{
Future
<
void
>
pumpIndicator
(
RefreshProgressIndicator
indicator
)
{
return
tester
.
pumpWidget
(
Theme
(
data:
theme
,
child:
indicator
));
}
// With default values.
await
pumpIndicator
(
const
RefreshProgressIndicator
());
Material
material
=
tester
.
widget
(
find
.
descendant
(
of:
find
.
byType
(
RefreshProgressIndicator
),
matching:
find
.
byType
(
Material
),
),
);
Container
container
=
tester
.
widget
(
find
.
descendant
(
of:
find
.
byType
(
RefreshProgressIndicator
),
matching:
find
.
byType
(
Container
),
),
);
Padding
padding
=
tester
.
widget
(
find
.
descendant
(
of:
find
.
descendant
(
of:
find
.
byType
(
RefreshProgressIndicator
),
matching:
find
.
byType
(
Material
),
),
matching:
find
.
byType
(
Padding
),
),
);
expect
(
material
.
elevation
,
2.0
);
expect
(
container
.
margin
,
const
EdgeInsets
.
all
(
4.0
));
expect
(
padding
.
padding
,
const
EdgeInsets
.
all
(
12.0
));
// With values provided.
const
double
testElevation
=
1.0
;
const
EdgeInsetsGeometry
testIndicatorMargin
=
EdgeInsets
.
all
(
6.0
);
const
EdgeInsetsGeometry
testIndicatorPadding
=
EdgeInsets
.
all
(
10.0
);
await
pumpIndicator
(
const
RefreshProgressIndicator
(
elevation:
testElevation
,
indicatorMargin:
testIndicatorMargin
,
indicatorPadding:
testIndicatorPadding
,
),
);
material
=
tester
.
widget
(
find
.
descendant
(
of:
find
.
byType
(
RefreshProgressIndicator
),
matching:
find
.
byType
(
Material
),
),
);
container
=
tester
.
widget
(
find
.
descendant
(
of:
find
.
byType
(
RefreshProgressIndicator
),
matching:
find
.
byType
(
Container
),
),
);
padding
=
tester
.
widget
(
find
.
descendant
(
of:
find
.
descendant
(
of:
find
.
byType
(
RefreshProgressIndicator
),
matching:
find
.
byType
(
Material
),
),
matching:
find
.
byType
(
Padding
),
),
);
expect
(
material
.
elevation
,
testElevation
);
expect
(
container
.
margin
,
testIndicatorMargin
);
expect
(
padding
.
padding
,
testIndicatorPadding
);
});
}
class
_RefreshProgressIndicatorGolden
extends
StatefulWidget
{
...
...
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