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
08ee37e1
Unverified
Commit
08ee37e1
authored
Mar 30, 2020
by
Ayush Bherwani
Committed by
GitHub
Mar 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[RefreshIndicator] adds strokeWidth parameter to RefreshIndicator (#53344)
parent
f9474c29
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
82 additions
and
1 deletion
+82
-1
refresh_indicator.dart
packages/flutter/lib/src/material/refresh_indicator.dart
+8
-0
refresh_indicator_test.dart
packages/flutter/test/material/refresh_indicator_test.dart
+74
-1
No files found.
packages/flutter/lib/src/material/refresh_indicator.dart
View file @
08ee37e1
...
...
@@ -106,9 +106,11 @@ class RefreshIndicator extends StatefulWidget {
this
.
notificationPredicate
=
defaultScrollNotificationPredicate
,
this
.
semanticsLabel
,
this
.
semanticsValue
,
this
.
strokeWidth
=
2.0
})
:
assert
(
child
!=
null
),
assert
(
onRefresh
!=
null
),
assert
(
notificationPredicate
!=
null
),
assert
(
strokeWidth
!=
null
),
super
(
key:
key
);
/// The widget below this widget in the tree.
...
...
@@ -153,6 +155,11 @@ class RefreshIndicator extends StatefulWidget {
/// {@macro flutter.material.progressIndicator.semanticsValue}
final
String
semanticsValue
;
/// Defines `strokeWidth` for `RefreshIndicator`.
///
/// By default, the value of `strokeWidth` is 2.0 pixels.
final
double
strokeWidth
;
@override
RefreshIndicatorState
createState
()
=>
RefreshIndicatorState
();
}
...
...
@@ -462,6 +469,7 @@ class RefreshIndicatorState extends State<RefreshIndicator> with TickerProviderS
value:
showIndeterminateIndicator
?
null
:
_value
.
value
,
valueColor:
_valueColor
,
backgroundColor:
widget
.
backgroundColor
,
strokeWidth:
widget
.
strokeWidth
,
);
},
),
...
...
packages/flutter/test/material/refresh_indicator_test.dart
View file @
08ee37e1
...
...
@@ -455,4 +455,77 @@ void main() {
expect
(
layoutCount
,
1
);
});
}
\ No newline at end of file
testWidgets
(
'strokeWidth cannot be null in RefreshIndicator'
,
(
WidgetTester
tester
)
async
{
try
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
RefreshIndicator
(
onRefresh:
()
async
{},
strokeWidth:
null
,
child:
ListView
(
physics:
const
AlwaysScrollableScrollPhysics
(),
children:
<
String
>[
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
].
map
<
Widget
>((
String
item
)
{
return
SizedBox
(
height:
200.0
,
child:
Text
(
item
),
);
}).
toList
(),
),
),
)
);
}
on
AssertionError
catch
(
_
)
{
return
;
}
fail
(
'The assertion was not thrown when strokeWidth was null'
);
});
testWidgets
(
'RefreshIndicator responds to strokeWidth'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
MaterialApp
(
home:
RefreshIndicator
(
onRefresh:
()
async
{},
child:
ListView
(
physics:
const
AlwaysScrollableScrollPhysics
(),
children:
<
String
>[
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
].
map
<
Widget
>((
String
item
)
{
return
SizedBox
(
height:
200.0
,
child:
Text
(
item
),
);
}).
toList
(),
),
),
)
);
//By default the value of strokeWidth is 2.0
expect
(
tester
.
widget
<
RefreshIndicator
>(
find
.
byType
(
RefreshIndicator
)).
strokeWidth
,
2.0
,
);
await
tester
.
pumpWidget
(
MaterialApp
(
home:
RefreshIndicator
(
onRefresh:
()
async
{},
strokeWidth:
4.0
,
child:
ListView
(
physics:
const
AlwaysScrollableScrollPhysics
(),
children:
<
String
>[
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
].
map
<
Widget
>((
String
item
)
{
return
SizedBox
(
height:
200.0
,
child:
Text
(
item
),
);
}).
toList
(),
),
),
)
);
expect
(
tester
.
widget
<
RefreshIndicator
>(
find
.
byType
(
RefreshIndicator
)).
strokeWidth
,
4.0
,
);
});
}
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