Unverified Commit 3aa104fe authored by jslavitz's avatar jslavitz Committed by GitHub

Allows progress indicator height to be controlled by parent (#23540)

* Adds functionality for progress indicator height to be controlled by the parent.
parent 00565c2d
......@@ -221,9 +221,9 @@ class _LinearProgressIndicatorState extends State<LinearProgressIndicator> with
Widget _buildIndicator(BuildContext context, double animationValue, TextDirection textDirection) {
return Container(
constraints: const BoxConstraints.tightFor(
width: double.infinity,
height: _kLinearProgressIndicatorHeight,
constraints: const BoxConstraints(
minWidth: double.infinity,
minHeight: _kLinearProgressIndicatorHeight,
),
child: CustomPaint(
painter: _LinearProgressIndicatorPainter(
......
......@@ -255,4 +255,70 @@ void main() {
await tester.pump(const Duration(milliseconds: 1));
expect(tester.hasRunningAnimations, isTrue);
});
testWidgets('LinearProgressIndicator with height 12.0', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
width: 100.0,
height: 12.0,
child: LinearProgressIndicator(value: 0.25),
),
),
),
);
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 12.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, 25.0, 12.0))
);
expect(tester.binding.transientCallbackCount, 0);
});
testWidgets('LinearProgressIndicator with a height less than the minumum', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
width: 100.0,
height: 3.0,
child: LinearProgressIndicator(value: 0.25),
),
),
),
);
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 3.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, 25.0, 3.0))
);
expect(tester.binding.transientCallbackCount, 0);
});
testWidgets('LinearProgressIndicator with default height', (WidgetTester tester) async {
await tester.pumpWidget(
const Directionality(
textDirection: TextDirection.ltr,
child: Center(
child: SizedBox(
width: 100.0,
height: 4.0,
child: LinearProgressIndicator(value: 0.25),
),
),
),
);
expect(
find.byType(LinearProgressIndicator),
paints
..rect(rect: Rect.fromLTRB(0.0, 0.0, 100.0, 4.0))
..rect(rect: Rect.fromLTRB(0.0, 0.0, 25.0, 4.0))
);
expect(tester.binding.transientCallbackCount, 0);
});
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment