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
fc77aea3
Unverified
Commit
fc77aea3
authored
Apr 27, 2020
by
rami-a
Committed by
GitHub
Apr 27, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enable configuring minHeight for LinearProgressIndicator and update default to match spec (#55482)
parent
cb88d2a3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
21 deletions
+51
-21
progress_indicator.dart
packages/flutter/lib/src/material/progress_indicator.dart
+20
-11
progress_indicator_test.dart
packages/flutter/test/material/progress_indicator_test.dart
+31
-10
No files found.
packages/flutter/lib/src/material/progress_indicator.dart
View file @
fc77aea3
...
...
@@ -10,7 +10,6 @@ import 'package:flutter/widgets.dart';
import
'material.dart'
;
import
'theme.dart'
;
const
double
_kLinearProgressIndicatorHeight
=
6.0
;
const
double
_kMinCircularProgressIndicatorSize
=
36.0
;
const
int
_kIndeterminateLinearDuration
=
1800
;
...
...
@@ -221,6 +220,9 @@ class _LinearProgressIndicatorPainter extends CustomPainter {
/// The indicator line is displayed with [valueColor], an animated value. To
/// specify a constant color value use: `AlwaysStoppedAnimation<Color>(color)`.
///
/// The minimum height of the indicator can be specified using [minHeight].
/// The indicator can be made taller by wrapping the widget with a [SizedBox].
///
/// See also:
///
/// * [CircularProgressIndicator], which shows progress along a circular arc.
...
...
@@ -236,16 +238,23 @@ class LinearProgressIndicator extends ProgressIndicator {
double
value
,
Color
backgroundColor
,
Animation
<
Color
>
valueColor
,
this
.
minHeight
,
String
semanticsLabel
,
String
semanticsValue
,
})
:
super
(
key:
key
,
value:
value
,
backgroundColor:
backgroundColor
,
valueColor:
valueColor
,
semanticsLabel:
semanticsLabel
,
semanticsValue:
semanticsValue
,
);
})
:
assert
(
minHeight
==
null
||
minHeight
>
0
),
super
(
key:
key
,
value:
value
,
backgroundColor:
backgroundColor
,
valueColor:
valueColor
,
semanticsLabel:
semanticsLabel
,
semanticsValue:
semanticsValue
,
);
/// The minimum height of the line used to draw the indicator.
///
/// This defaults to 4dp.
final
double
minHeight
;
@override
_LinearProgressIndicatorState
createState
()
=>
_LinearProgressIndicatorState
();
...
...
@@ -284,9 +293,9 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
return
widget
.
_buildSemanticsWrapper
(
context:
context
,
child:
Container
(
constraints:
const
BoxConstraints
(
constraints:
BoxConstraints
(
minWidth:
double
.
infinity
,
minHeight:
_kLinearProgressIndicatorHeight
,
minHeight:
widget
.
minHeight
??
4.0
,
),
child:
CustomPaint
(
painter:
_LinearProgressIndicatorPainter
(
...
...
packages/flutter/test/material/progress_indicator_test.dart
View file @
fc77aea3
...
...
@@ -49,6 +49,27 @@ void main() {
handle
.
dispose
();
});
testWidgets
(
'LinearProgressIndicator custom minHeight'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
Directionality
(
textDirection:
TextDirection
.
ltr
,
child:
Center
(
child:
SizedBox
(
width:
200.0
,
child:
LinearProgressIndicator
(
value:
0.25
,
minHeight:
2.0
),
),
),
),
);
expect
(
find
.
byType
(
LinearProgressIndicator
),
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
2.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
50.0
,
2.0
)),
);
});
testWidgets
(
'LinearProgressIndicator paint (LTR)'
,
(
WidgetTester
tester
)
async
{
await
tester
.
pumpWidget
(
const
Directionality
(
...
...
@@ -65,8 +86,8 @@ void main() {
expect
(
find
.
byType
(
LinearProgressIndicator
),
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
6
.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
50.0
,
6
.0
)),
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
4
.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
50.0
,
4
.0
)),
);
expect
(
tester
.
binding
.
transientCallbackCount
,
0
);
...
...
@@ -88,8 +109,8 @@ void main() {
expect
(
find
.
byType
(
LinearProgressIndicator
),
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
6
.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
150.0
,
0.0
,
200.0
,
6
.0
)),
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
4
.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
150.0
,
0.0
,
200.0
,
4
.0
)),
);
expect
(
tester
.
binding
.
transientCallbackCount
,
0
);
...
...
@@ -115,8 +136,8 @@ void main() {
expect
(
find
.
byType
(
LinearProgressIndicator
),
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
6
.0
))
..
rect
(
rect:
Rect
.
fromLTRB
(
0.0
,
0.0
,
animationValue
*
200.0
,
6
.0
)),
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
4
.0
))
..
rect
(
rect:
Rect
.
fromLTRB
(
0.0
,
0.0
,
animationValue
*
200.0
,
4
.0
)),
);
expect
(
tester
.
binding
.
transientCallbackCount
,
1
);
...
...
@@ -142,8 +163,8 @@ void main() {
expect
(
find
.
byType
(
LinearProgressIndicator
),
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
6
.0
))
..
rect
(
rect:
Rect
.
fromLTRB
(
200.0
-
animationValue
*
200.0
,
0.0
,
200.0
,
6
.0
)),
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
4
.0
))
..
rect
(
rect:
Rect
.
fromLTRB
(
200.0
-
animationValue
*
200.0
,
0.0
,
200.0
,
4
.0
)),
);
expect
(
tester
.
binding
.
transientCallbackCount
,
1
);
...
...
@@ -169,8 +190,8 @@ void main() {
expect
(
find
.
byType
(
LinearProgressIndicator
),
paints
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
6
.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
50.0
,
6
.0
),
color:
Colors
.
white
),
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
200.0
,
4
.0
))
..
rect
(
rect:
const
Rect
.
fromLTRB
(
0.0
,
0.0
,
50.0
,
4
.0
),
color:
Colors
.
white
),
);
});
...
...
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