File tree Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Expand file tree Collapse file tree 5 files changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -272,6 +272,7 @@ class CheckboxListTile extends StatelessWidget {
272272 this .autofocus = false ,
273273 this .contentPadding,
274274 this .tristate = false ,
275+ this .shape,
275276 }) : assert (tristate != null ),
276277 assert (tristate || value != null ),
277278 assert (isThreeLine != null ),
@@ -380,6 +381,9 @@ class CheckboxListTile extends StatelessWidget {
380381 /// If tristate is false (the default), [value] must not be null.
381382 final bool tristate;
382383
384+ /// {@macro flutter.material.ListTile.shape}
385+ final ShapeBorder ? shape;
386+
383387 void _handleValueChange () {
384388 assert (onChanged != null );
385389 switch (value) {
@@ -433,6 +437,7 @@ class CheckboxListTile extends StatelessWidget {
433437 selected: selected,
434438 autofocus: autofocus,
435439 contentPadding: contentPadding,
440+ shape: shape,
436441 ),
437442 ),
438443 );
Original file line number Diff line number Diff line change @@ -96,7 +96,9 @@ class ListTileTheme extends InheritedTheme {
9696 /// If true then [ListTile] s will have the vertically dense layout.
9797 final bool dense;
9898
99+ /// {@template flutter.material.ListTile.shape}
99100 /// If specified, [shape] defines the shape of the [ListTile] 's [InkWell] border.
101+ /// {@endtemplate}
100102 final ShapeBorder ? shape;
101103
102104 /// If specified, [style] defines the font used for [ListTile] titles.
Original file line number Diff line number Diff line change @@ -273,6 +273,7 @@ class SwitchListTile extends StatelessWidget {
273273 this .selected = false ,
274274 this .autofocus = false ,
275275 this .controlAffinity = ListTileControlAffinity .platform,
276+ this .shape,
276277 }) : _switchListTileType = _SwitchListTileType .material,
277278 assert (value != null ),
278279 assert (isThreeLine != null ),
@@ -308,6 +309,7 @@ class SwitchListTile extends StatelessWidget {
308309 this .selected = false ,
309310 this .autofocus = false ,
310311 this .controlAffinity = ListTileControlAffinity .platform,
312+ this .shape,
311313 }) : _switchListTileType = _SwitchListTileType .adaptive,
312314 assert (value != null ),
313315 assert (isThreeLine != null ),
@@ -435,6 +437,9 @@ class SwitchListTile extends StatelessWidget {
435437 /// By default, the value of `controlAffinity` is [ListTileControlAffinity.platform] .
436438 final ListTileControlAffinity controlAffinity;
437439
440+ /// {@macro flutter.material.ListTile.shape}
441+ final ShapeBorder ? shape;
442+
438443 @override
439444 Widget build (BuildContext context) {
440445 Widget control;
@@ -497,6 +502,7 @@ class SwitchListTile extends StatelessWidget {
497502 onTap: onChanged != null ? () { onChanged !(! value); } : null ,
498503 selected: selected,
499504 autofocus: autofocus,
505+ shape: shape,
500506 ),
501507 ),
502508 );
Original file line number Diff line number Diff line change @@ -224,4 +224,21 @@ void main() {
224224 await tester.pumpAndSettle ();
225225 expect (_value, false );
226226 });
227+
228+ testWidgets ('CheckboxListTile respects shape' , (WidgetTester tester) async {
229+ const ShapeBorder shapeBorder = RoundedRectangleBorder (
230+ borderRadius: BorderRadius .horizontal (right: Radius .circular (100 ))
231+ );
232+
233+ await tester.pumpWidget (wrap (
234+ child: const CheckboxListTile (
235+ value: false ,
236+ onChanged: null ,
237+ title: Text ('Title' ),
238+ shape: shapeBorder,
239+ ),
240+ ));
241+
242+ expect (tester.widget <InkWell >(find.byType (InkWell )).customBorder, shapeBorder);
243+ });
227244}
Original file line number Diff line number Diff line change @@ -340,4 +340,23 @@ void main() {
340340 expect (listTile.leading.runtimeType, Icon );
341341 expect (listTile.trailing.runtimeType, Switch );
342342 });
343+
344+ testWidgets ('SwitchListTile respects shape' , (WidgetTester tester) async {
345+ const ShapeBorder shapeBorder = RoundedRectangleBorder (
346+ borderRadius: BorderRadius .horizontal (right: Radius .circular (100 ))
347+ );
348+
349+ await tester.pumpWidget (const MaterialApp (
350+ home: Material (
351+ child: SwitchListTile (
352+ value: true ,
353+ onChanged: null ,
354+ title: Text ('Title' ),
355+ shape: shapeBorder,
356+ ),
357+ ),
358+ ));
359+
360+ expect (tester.widget <InkWell >(find.byType (InkWell )).customBorder, shapeBorder);
361+ });
343362}
You can’t perform that action at this time.
0 commit comments