FIX: NavigationDrawer hover/focus/pressed does not use indicatorShape (#123325)

FIX: NavigationDrawer hover/focus/pressed do not use indicatorShape
This commit is contained in:
Rydmike 2023-03-23 20:13:47 +02:00 committed by GitHub
parent af6029c8fe
commit 9dec4fbd1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 1 deletions

View file

@ -328,7 +328,7 @@ class _NavigationDestinationBuilder extends StatelessWidget {
child: InkWell(
highlightColor: Colors.transparent,
onTap: info.onTap,
borderRadius: const BorderRadius.all(Radius.circular(28.0)),
customBorder: info.indicatorShape ?? navigationDrawerTheme.indicatorShape ?? defaults.indicatorShape!,
child: Stack(
alignment: Alignment.center,
children: <Widget>[

View file

@ -349,12 +349,16 @@ void main() {
// Test default indicator color and shape.
expect(_getIndicatorDecoration(tester)?.color, theme.colorScheme.secondaryContainer);
expect(_getIndicatorDecoration(tester)?.shape, const StadiumBorder());
// Test that InkWell for hover, focus and pressed use default shape.
expect(_getInkWell(tester)?.customBorder, const StadiumBorder());
await tester.pumpWidget(buildNavigationDrawer(indicatorColor: color, indicatorShape: shape));
// Test custom indicator color and shape.
expect(_getIndicatorDecoration(tester)?.color, color);
expect(_getIndicatorDecoration(tester)?.shape, shape);
// Test that InkWell for hover, focus and pressed use custom shape.
expect(_getInkWell(tester)?.customBorder, shape);
});
}
@ -376,6 +380,13 @@ Material _getMaterial(WidgetTester tester) {
);
}
InkWell? _getInkWell(WidgetTester tester) {
return tester.firstWidget<InkWell>(
find.descendant(
of: find.byType(NavigationDrawer), matching: find.byType(InkWell)),
);
}
ShapeDecoration? _getIndicatorDecoration(WidgetTester tester) {
return tester
.firstWidget<Container>(