diff --git a/packages/flutter/lib/src/material/radio_list_tile.dart b/packages/flutter/lib/src/material/radio_list_tile.dart index 2e8a1c42a6..1ca6f5e395 100644 --- a/packages/flutter/lib/src/material/radio_list_tile.dart +++ b/packages/flutter/lib/src/material/radio_list_tile.dart @@ -320,7 +320,9 @@ class RadioListTile extends StatelessWidget { this.controlAffinity = ListTileControlAffinity.platform, this.autofocus = false, this.contentPadding, - + this.shape, + this.tileColor, + this.selectedTileColor, }) : assert(toggleable != null), assert(isThreeLine != null), assert(!isThreeLine || subtitle != null), @@ -483,6 +485,16 @@ class RadioListTile extends StatelessWidget { /// To control this value, set [value] and [groupValue] appropriately. bool get checked => value == groupValue; + /// If specified, [shape] defines the shape of the [RadioListTile]'s [InkWell] border. + final ShapeBorder? shape; + + /// If specified, defines the background color for `RadioListTile` when + /// [RadioListTile.selected] is false. + final Color? tileColor; + + /// If non-null, defines the background color when [RadioListTile.selected] is true. + final Color? selectedTileColor; + @override Widget build(BuildContext context) { final Widget control = Radio( @@ -517,6 +529,9 @@ class RadioListTile extends StatelessWidget { isThreeLine: isThreeLine, dense: dense, enabled: onChanged != null, + shape: shape, + tileColor: tileColor, + selectedTileColor: selectedTileColor, onTap: onChanged != null ? () { if (toggleable && checked) { onChanged!(null); diff --git a/packages/flutter/test/material/radio_list_tile_test.dart b/packages/flutter/test/material/radio_list_tile_test.dart index 98d4fefa30..704cb63e05 100644 --- a/packages/flutter/test/material/radio_list_tile_test.dart +++ b/packages/flutter/test/material/radio_list_tile_test.dart @@ -646,4 +646,67 @@ void main() { expect(paddingRect.left, radioRect.left - 8); //left padding expect(paddingRect.right, titleRect.right + 15); //right padding }); + + testWidgets('RadioListTile respects shape', (WidgetTester tester) async { + const ShapeBorder shapeBorder = RoundedRectangleBorder( + borderRadius: BorderRadius.horizontal(right: Radius.circular(100)), + ); + + await tester.pumpWidget(const MaterialApp( + home: Material( + child: RadioListTile( + value: true, + groupValue: true, + onChanged: null, + title: Text('Title'), + shape: shapeBorder, + ), + ), + )); + + expect(tester.widget(find.byType(InkWell)).customBorder, shapeBorder); + }); + + testWidgets('RadioListTile respects tileColor', (WidgetTester tester) async { + const Color tileColor = Colors.red; + + await tester.pumpWidget( + wrap( + child: const Center( + child: RadioListTile( + value: false, + groupValue: true, + onChanged: null, + title: Text('Title'), + tileColor: tileColor, + ), + ), + ), + ); + + final ColoredBox coloredBox = tester.firstWidget(find.byType(ColoredBox)); + expect(coloredBox.color, tileColor); + }); + + testWidgets('RadioListTile respects selectedTileColor', (WidgetTester tester) async { + const Color selectedTileColor = Colors.black; + + await tester.pumpWidget( + wrap( + child: const Center( + child: RadioListTile( + value: false, + groupValue: true, + onChanged: null, + title: Text('Title'), + selected: true, + selectedTileColor: selectedTileColor, + ), + ), + ), + ); + + final ColoredBox coloredBox = tester.firstWidget(find.byType(ColoredBox)); + expect(coloredBox.color, equals(selectedTileColor)); + }); }