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
012d9381
Commit
012d9381
authored
Jul 15, 2016
by
Hans Muller
Committed by
GitHub
Jul 15, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
RefreshIndicator backgroundColor (#4924)
parent
a10cd03b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
21 deletions
+38
-21
overscroll_demo.dart
examples/flutter_gallery/lib/demo/overscroll_demo.dart
+12
-9
progress_indicator.dart
packages/flutter/lib/src/material/progress_indicator.dart
+5
-4
refresh_indicator.dart
packages/flutter/lib/src/material/refresh_indicator.dart
+21
-8
No files found.
examples/flutter_gallery/lib/demo/overscroll_demo.dart
View file @
012d9381
...
...
@@ -31,15 +31,18 @@ class OverscrollDemoState extends State<OverscrollDemo> {
Completer
<
Null
>
completer
=
new
Completer
<
Null
>();
new
Timer
(
new
Duration
(
seconds:
3
),
()
{
completer
.
complete
(
null
);
});
return
completer
.
future
.
then
((
_
)
{
_scaffoldKey
.
currentState
.
showSnackBar
(
new
SnackBar
(
content:
new
Text
(
"Refresh complete"
),
action:
new
SnackBarAction
(
label:
'RETRY'
,
onPressed:
()
{
_refreshIndicatorKey
.
currentState
.
show
();
}
)
));
final
ScaffoldState
scaffoldState
=
_scaffoldKey
.
currentState
;
if
(
scaffoldState
!=
null
)
{
scaffoldState
.
showSnackBar
(
new
SnackBar
(
content:
new
Text
(
"Refresh complete"
),
action:
new
SnackBarAction
(
label:
'RETRY'
,
onPressed:
()
{
_refreshIndicatorKey
.
currentState
.
show
();
}
)
));
}
});
}
...
...
packages/flutter/lib/src/material/progress_indicator.dart
View file @
012d9381
...
...
@@ -46,14 +46,15 @@ abstract class ProgressIndicator extends StatefulWidget {
/// much actual progress is being made.
final
double
value
;
/// The progress indicator's background color.
If null, the background color i
s
///
the current theme's backgroundColor
.
/// The progress indicator's background color.
The current theme'
s
///
[ThemeData.backgroundColor] by default
.
final
Color
backgroundColor
;
/// The indicator's color is the animation's value. To specify a constant
/// color use: `new AlwaysStoppedAnimation<Color>(color)`.
///
/// If null, the progress indicator is rendered with the current theme's primaryColor.
/// If null, the progress indicator is rendered with the current theme's
/// [ThemeData.primaryColor].
final
Animation
<
Color
>
valueColor
;
Color
_getBackgroundColor
(
BuildContext
context
)
=>
backgroundColor
??
Theme
.
of
(
context
).
backgroundColor
;
...
...
@@ -485,7 +486,7 @@ class _RefreshProgressIndicatorState extends _CircularProgressIndicatorState {
margin:
const
EdgeInsets
.
all
(
4.0
),
// acommodate the shadow
child:
new
Material
(
type:
MaterialType
.
circle
,
color:
Theme
.
of
(
context
).
canvasColor
,
color:
config
.
backgroundColor
??
Theme
.
of
(
context
).
canvasColor
,
elevation:
2
,
child:
new
Padding
(
padding:
const
EdgeInsets
.
all
(
12.0
),
...
...
packages/flutter/lib/src/material/refresh_indicator.dart
View file @
012d9381
...
...
@@ -68,18 +68,20 @@ enum _DismissTransition {
/// animated circular progress indicator is faded into view. When the scroll
/// ends, if the indicator has been dragged far enough for it to become
/// completely opaque, the refresh callback is called. The callback is
/// expected to u
dpate the scrollback and then complete the Future it
/// returns. The refresh indicator disappears after the callback's
/// expected to u
pdate the scrollable's contents and then complete the Future
///
it
returns. The refresh indicator disappears after the callback's
/// Future has completed.
///
/// The required [scrollableKey] parameter identifies the scrollable widget
/// whose scrollOffset is monitored by this RefreshIndicator. The same
/// scrollableKey must also be set on the scrollable. See [Block.scrollableKey]
/// scrollableKey must also be set on the scrollable. See [Block.scrollableKey]
,
/// [ScrollableList.scrollableKey], etc.
///
/// See also:
///
/// * <https://www.google.com/design/spec/patterns/swipe-to-refresh.html>
/// * [RefreshIndicatorState] (can be used to programatically show the refresh indicator)
/// * [RefreshProgressIndicator]
class
RefreshIndicator
extends
StatefulWidget
{
/// Creates a refresh indicator.
///
...
...
@@ -91,7 +93,9 @@ class RefreshIndicator extends StatefulWidget {
this
.
child
,
this
.
displacement
:
40.0
,
this
.
refresh
,
this
.
location
:
RefreshIndicatorLocation
.
top
this
.
location
:
RefreshIndicatorLocation
.
top
,
this
.
color
,
this
.
backgroundColor
})
:
super
(
key:
key
)
{
assert
(
child
!=
null
);
assert
(
refresh
!=
null
);
...
...
@@ -116,10 +120,18 @@ class RefreshIndicator extends StatefulWidget {
/// Future must complete when the refresh operation is finished.
final
RefreshCallback
refresh
;
/// Where the refresh indicator should appear,
RefreshIndicatorLocation.top
/// Where the refresh indicator should appear,
[RefreshIndicatorLocation.top]
/// by default.
final
RefreshIndicatorLocation
location
;
/// The progress indicator's foreground color. The current theme's
/// [ThemeData.primaryColor] by default.
final
Color
color
;
/// The progress indicator's background color. The current theme's
/// [ThemeData.canvasColor] by default.
final
Color
backgroundColor
;
@override
RefreshIndicatorState
createState
()
=>
new
RefreshIndicatorState
();
}
...
...
@@ -156,8 +168,8 @@ class RefreshIndicatorState extends State<RefreshIndicator> {
// Fully opaque when we've reached config.displacement.
_valueColor
=
new
ColorTween
(
begin:
theme
.
primaryColor
.
withOpacity
(
0.0
),
end:
theme
.
primaryColor
.
withOpacity
(
1.0
)
begin:
(
config
.
color
??
theme
.
primaryColor
)
.
withOpacity
(
0.0
),
end:
(
config
.
color
??
theme
.
primaryColor
)
.
withOpacity
(
1.0
)
)
.
animate
(
new
CurvedAnimation
(
parent:
_sizeController
,
...
...
@@ -369,7 +381,8 @@ class RefreshIndicatorState extends State<RefreshIndicator> {
builder:
(
BuildContext
context
,
Widget
child
)
{
return
new
RefreshProgressIndicator
(
value:
showIndeterminateIndicator
?
null
:
_value
.
value
,
valueColor:
_valueColor
valueColor:
_valueColor
,
backgroundColor:
config
.
backgroundColor
);
}
)
...
...
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