Fix small TabBar inconsistencies (#20887)
Tabs are now padded by 16.0 on the left and right (used to be 12.0).
This commit is contained in:
parent
e24ac50871
commit
09e7902f5b
@ -29,7 +29,7 @@ const int kRadialReactionAlpha = 0x1F;
|
|||||||
const Duration kTabScrollDuration = Duration(milliseconds: 300);
|
const Duration kTabScrollDuration = Duration(milliseconds: 300);
|
||||||
|
|
||||||
/// The horizontal padding included by [Tab]s.
|
/// The horizontal padding included by [Tab]s.
|
||||||
const EdgeInsets kTabLabelPadding = EdgeInsets.symmetric(horizontal: 12.0);
|
const EdgeInsets kTabLabelPadding = EdgeInsets.symmetric(horizontal: 16.0);
|
||||||
|
|
||||||
/// The padding added around material list items.
|
/// The padding added around material list items.
|
||||||
const EdgeInsets kMaterialListPadding = EdgeInsets.symmetric(vertical: 8.0);
|
const EdgeInsets kMaterialListPadding = EdgeInsets.symmetric(vertical: 8.0);
|
||||||
|
@ -90,6 +90,7 @@ class _UnderlinePainter extends BoxPainter {
|
|||||||
final Rect rect = offset & configuration.size;
|
final Rect rect = offset & configuration.size;
|
||||||
final TextDirection textDirection = configuration.textDirection;
|
final TextDirection textDirection = configuration.textDirection;
|
||||||
final Rect indicator = _indicatorRectFor(rect, textDirection).deflate(borderSide.width / 2.0);
|
final Rect indicator = _indicatorRectFor(rect, textDirection).deflate(borderSide.width / 2.0);
|
||||||
canvas.drawLine(indicator.bottomLeft, indicator.bottomRight, borderSide.toPaint());
|
final Paint paint = borderSide.toPaint()..strokeCap = StrokeCap.square;
|
||||||
|
canvas.drawLine(indicator.bottomLeft, indicator.bottomRight, paint);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1277,8 +1277,8 @@ void main() {
|
|||||||
testWidgets('Overflowing RTL tab bar', (WidgetTester tester) async {
|
testWidgets('Overflowing RTL tab bar', (WidgetTester tester) async {
|
||||||
final List<Widget> tabs = new List<Widget>.filled(100,
|
final List<Widget> tabs = new List<Widget>.filled(100,
|
||||||
// For convenience padded width of each tab will equal 100:
|
// For convenience padded width of each tab will equal 100:
|
||||||
// 76 + kTabLabelPadding.horizontal(24)
|
// 68 + kTabLabelPadding.horizontal(32)
|
||||||
new SizedBox(key: new UniqueKey(), width: 76.0, height: 40.0),
|
new SizedBox(key: new UniqueKey(), width: 68.0, height: 40.0),
|
||||||
);
|
);
|
||||||
|
|
||||||
final TabController controller = new TabController(
|
final TabController controller = new TabController(
|
||||||
@ -1384,15 +1384,15 @@ void main() {
|
|||||||
actions: SemanticsAction.tap.index,
|
actions: SemanticsAction.tap.index,
|
||||||
flags: SemanticsFlag.isSelected.index,
|
flags: SemanticsFlag.isSelected.index,
|
||||||
label: 'TAB #0\nTab 1 of 2',
|
label: 'TAB #0\nTab 1 of 2',
|
||||||
rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
|
rect: new Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
|
||||||
transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
|
transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
|
||||||
),
|
),
|
||||||
new TestSemantics(
|
new TestSemantics(
|
||||||
id: 5,
|
id: 5,
|
||||||
actions: SemanticsAction.tap.index,
|
actions: SemanticsAction.tap.index,
|
||||||
label: 'TAB #1\nTab 2 of 2',
|
label: 'TAB #1\nTab 2 of 2',
|
||||||
rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
|
rect: new Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
|
||||||
transform: new Matrix4.translationValues(108.0, 276.0, 0.0),
|
transform: new Matrix4.translationValues(116.0, 276.0, 0.0),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
@ -1647,15 +1647,15 @@ void main() {
|
|||||||
actions: SemanticsAction.tap.index,
|
actions: SemanticsAction.tap.index,
|
||||||
flags: SemanticsFlag.isSelected.index,
|
flags: SemanticsFlag.isSelected.index,
|
||||||
label: 'Semantics override 0\nTab 1 of 2',
|
label: 'Semantics override 0\nTab 1 of 2',
|
||||||
rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
|
rect: new Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
|
||||||
transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
|
transform: new Matrix4.translationValues(0.0, 276.0, 0.0),
|
||||||
),
|
),
|
||||||
new TestSemantics(
|
new TestSemantics(
|
||||||
id: 5,
|
id: 5,
|
||||||
actions: SemanticsAction.tap.index,
|
actions: SemanticsAction.tap.index,
|
||||||
label: 'Semantics override 1\nTab 2 of 2',
|
label: 'Semantics override 1\nTab 2 of 2',
|
||||||
rect: new Rect.fromLTRB(0.0, 0.0, 108.0, kTextTabBarHeight),
|
rect: new Rect.fromLTRB(0.0, 0.0, 116.0, kTextTabBarHeight),
|
||||||
transform: new Matrix4.translationValues(108.0, 276.0, 0.0),
|
transform: new Matrix4.translationValues(116.0, 276.0, 0.0),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user