Fix overflow issue caused by a long title/subtitle for the vertical stepper (#61623)
This commit is contained in:
parent
30e556ddc5
commit
14dcbb2d84
@ -520,9 +520,11 @@ class _StepperState extends State<Stepper> with TickerProviderStateMixin {
|
|||||||
_buildLine(!_isLast(index)),
|
_buildLine(!_isLast(index)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
Container(
|
Expanded(
|
||||||
margin: const EdgeInsetsDirectional.only(start: 12.0),
|
child: Container(
|
||||||
child: _buildHeaderText(index),
|
margin: const EdgeInsetsDirectional.only(start: 12.0),
|
||||||
|
child: _buildHeaderText(index),
|
||||||
|
)
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -663,4 +663,57 @@ void main() {
|
|||||||
await tester.pump();
|
await tester.pump();
|
||||||
expect(disabledNode.hasPrimaryFocus, isFalse);
|
expect(disabledNode.hasPrimaryFocus, isFalse);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
testWidgets('Stepper header title should not overflow', (WidgetTester tester) async {
|
||||||
|
const String longText =
|
||||||
|
'A long long long long long long long long long long long long text';
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
home: Material(
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Stepper(
|
||||||
|
steps: const <Step>[
|
||||||
|
Step(
|
||||||
|
title: Text(longText),
|
||||||
|
content: Text('Text content')
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(tester.takeException(), isNull);
|
||||||
|
});
|
||||||
|
|
||||||
|
testWidgets('Stepper header subtitle should not overflow', (WidgetTester tester) async {
|
||||||
|
const String longText =
|
||||||
|
'A long long long long long long long long long long long long text';
|
||||||
|
|
||||||
|
await tester.pumpWidget(
|
||||||
|
MaterialApp(
|
||||||
|
home: Material(
|
||||||
|
child: ListView(
|
||||||
|
children: <Widget>[
|
||||||
|
Stepper(
|
||||||
|
steps: const <Step>[
|
||||||
|
Step(
|
||||||
|
title: Text('Regular title'),
|
||||||
|
subtitle: Text(longText),
|
||||||
|
content: Text('Text content')
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(tester.takeException(), isNull);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user