Skip to content

Commit 9dec4fb

Browse files
authored
FIX: NavigationDrawer hover/focus/pressed does not use indicatorShape (flutter#123325)
FIX: NavigationDrawer hover/focus/pressed do not use indicatorShape
1 parent af6029c commit 9dec4fb

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

packages/flutter/lib/src/material/navigation_drawer.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ class _NavigationDestinationBuilder extends StatelessWidget {
328328
child: InkWell(
329329
highlightColor: Colors.transparent,
330330
onTap: info.onTap,
331-
borderRadius: const BorderRadius.all(Radius.circular(28.0)),
331+
customBorder: info.indicatorShape ?? navigationDrawerTheme.indicatorShape ?? defaults.indicatorShape!,
332332
child: Stack(
333333
alignment: Alignment.center,
334334
children: <Widget>[

packages/flutter/test/material/navigation_drawer_test.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,12 +349,16 @@ void main() {
349349
// Test default indicator color and shape.
350350
expect(_getIndicatorDecoration(tester)?.color, theme.colorScheme.secondaryContainer);
351351
expect(_getIndicatorDecoration(tester)?.shape, const StadiumBorder());
352+
// Test that InkWell for hover, focus and pressed use default shape.
353+
expect(_getInkWell(tester)?.customBorder, const StadiumBorder());
352354

353355
await tester.pumpWidget(buildNavigationDrawer(indicatorColor: color, indicatorShape: shape));
354356

355357
// Test custom indicator color and shape.
356358
expect(_getIndicatorDecoration(tester)?.color, color);
357359
expect(_getIndicatorDecoration(tester)?.shape, shape);
360+
// Test that InkWell for hover, focus and pressed use custom shape.
361+
expect(_getInkWell(tester)?.customBorder, shape);
358362
});
359363
}
360364

@@ -376,6 +380,13 @@ Material _getMaterial(WidgetTester tester) {
376380
);
377381
}
378382

383+
InkWell? _getInkWell(WidgetTester tester) {
384+
return tester.firstWidget<InkWell>(
385+
find.descendant(
386+
of: find.byType(NavigationDrawer), matching: find.byType(InkWell)),
387+
);
388+
}
389+
379390
ShapeDecoration? _getIndicatorDecoration(WidgetTester tester) {
380391
return tester
381392
.firstWidget<Container>(

0 commit comments

Comments
 (0)