mirror of
https://github.com/flutter/flutter
synced 2024-10-30 06:23:38 +00:00
Fixed leading button size on app bar (#110043)
This commit is contained in:
parent
d79a3d7a19
commit
7e33cd5ef3
2 changed files with 16 additions and 9 deletions
|
@ -998,11 +998,16 @@ class _AppBarState extends State<AppBar> {
|
|||
}
|
||||
}
|
||||
if (leading != null) {
|
||||
leading = Container(
|
||||
alignment: Alignment.center,
|
||||
constraints: BoxConstraints.tightFor(width: widget.leadingWidth ?? _kLeadingWidth),
|
||||
child: leading,
|
||||
);
|
||||
leading = theme.useMaterial3
|
||||
? Container(
|
||||
alignment: Alignment.center,
|
||||
constraints: BoxConstraints.tightFor(width: widget.leadingWidth ?? _kLeadingWidth),
|
||||
child: leading,
|
||||
)
|
||||
: ConstrainedBox(
|
||||
constraints: BoxConstraints.tightFor(width: widget.leadingWidth ?? _kLeadingWidth),
|
||||
child: leading,
|
||||
);
|
||||
}
|
||||
|
||||
Widget? title = widget.title;
|
||||
|
|
|
@ -694,9 +694,11 @@ void main() {
|
|||
});
|
||||
|
||||
testWidgets('leading button extends to edge and is square', (WidgetTester tester) async {
|
||||
final ThemeData themeData = ThemeData(platform: TargetPlatform.android);
|
||||
final bool material3 = themeData.useMaterial3;
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
theme: ThemeData(platform: TargetPlatform.android),
|
||||
theme: themeData,
|
||||
home: Scaffold(
|
||||
appBar: AppBar(
|
||||
title: const Text('X'),
|
||||
|
@ -706,9 +708,9 @@ void main() {
|
|||
),
|
||||
);
|
||||
|
||||
final Finder hamburger = find.byTooltip('Open navigation menu');
|
||||
expect(tester.getTopLeft(hamburger), const Offset(4.0, 4.0));
|
||||
expect(tester.getSize(hamburger), const Size(48.0, 48.0));
|
||||
final Finder hamburger = find.byType(IconButton);
|
||||
expect(tester.getTopLeft(hamburger), material3 ? const Offset(4.0, 4.0) : Offset.zero);
|
||||
expect(tester.getSize(hamburger), material3 ? const Size(48.0, 48.0) : const Size(56.0, 56.0));
|
||||
});
|
||||
|
||||
testWidgets('test action is 4dp from edge and 48dp min', (WidgetTester tester) async {
|
||||
|
|
Loading…
Reference in a new issue