Skip to content

Commit d9bbca2

Browse files
committed
Mirror ExpansionTile shape and collapsedShape
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01A67XoQYsLVvoMtiKcXXUxY
1 parent c79953b commit d9bbca2

4 files changed

Lines changed: 78 additions & 1 deletion

File tree

‎CHANGELOG.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
- `ListTileProperties.minTileHeight`, `titleAlignment` (new
4242
`ListTileTitleAlignmentC`)
4343
- `MaterialLoadingIndicatorProperties.strokeAlign`, `trackGap`
44-
- `ExpansionTileProperties.showTrailingIcon`
44+
- `ExpansionTileProperties.showTrailingIcon`, `shape`, `collapsedShape`,
45+
`cornerRadius`
4546
- `TextMixin.softWrap`
4647
- Document the Flutter replacements for deprecated `cacheExtent`
4748
(`scrollCacheExtent`) and `Radio.groupValue` (`RadioGroup`).

‎lib/src/api/nodes/expansion_tile_node.dart‎

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -230,6 +230,17 @@ class ExpansionTileProperties extends CustomProperties with FieldsHolder {
230230
/// `ExpansionTile.showTrailingIcon`.
231231
bool showTrailingIcon;
232232

233+
/// Border shape of the tile when expanded. When set, it replaces the
234+
/// dividers drawn by [showDividers]. Mirrors `ExpansionTile.shape`.
235+
CShapeBorder? shape;
236+
237+
/// Border shape of the tile when collapsed. When set, it replaces the
238+
/// dividers drawn by [showDividers]. Mirrors `ExpansionTile.collapsedShape`.
239+
CShapeBorder? collapsedShape;
240+
241+
/// Corner radius applied to [shape] and [collapsedShape].
242+
CornerRadius cornerRadius;
243+
233244
/// Platform or null affinity defaults to trailing.
234245
ListTileControlAffinityC effectiveAffinity(
235246
ListTileControlAffinityC? affinity,
@@ -261,6 +272,9 @@ class ExpansionTileProperties extends CustomProperties with FieldsHolder {
261272
this.visualDensity = VisualDensityModel.standard,
262273
this.showDividers = true,
263274
this.showTrailingIcon = true,
275+
this.shape,
276+
this.collapsedShape,
277+
this.cornerRadius = CornerRadius.zero,
264278
});
265279

266280
/// Duplicates this [ExpansionTileProperties] instance with given data
@@ -282,6 +296,9 @@ class ExpansionTileProperties extends CustomProperties with FieldsHolder {
282296
VisualDensityModel? visualDensity,
283297
bool? showDividers,
284298
bool? showTrailingIcon,
299+
CShapeBorder? shape,
300+
CShapeBorder? collapsedShape,
301+
CornerRadius? cornerRadius,
285302
}) {
286303
return ExpansionTileProperties(
287304
backgroundColor: backgroundColor ?? this.backgroundColor,
@@ -302,6 +319,9 @@ class ExpansionTileProperties extends CustomProperties with FieldsHolder {
302319
visualDensity: visualDensity ?? this.visualDensity,
303320
showDividers: showDividers ?? this.showDividers,
304321
showTrailingIcon: showTrailingIcon ?? this.showTrailingIcon,
322+
shape: shape ?? this.shape,
323+
collapsedShape: collapsedShape ?? this.collapsedShape,
324+
cornerRadius: cornerRadius ?? this.cornerRadius,
305325
);
306326
}
307327

@@ -406,6 +426,28 @@ class ExpansionTileProperties extends CustomProperties with FieldsHolder {
406426
() => showTrailingIcon,
407427
(value) => showTrailingIcon = value,
408428
),
429+
'shape': EnumFieldAccess<CShapeBorder?>(
430+
'Shape',
431+
'Border shape of the tile when expanded.',
432+
() => shape,
433+
(value) => shape = value,
434+
defaultValue: () => null,
435+
options: () => CShapeBorder.values,
436+
),
437+
'collapsedShape': EnumFieldAccess<CShapeBorder?>(
438+
'Collapsed Shape',
439+
'Border shape of the tile when collapsed.',
440+
() => collapsedShape,
441+
(value) => collapsedShape = value,
442+
defaultValue: () => null,
443+
options: () => CShapeBorder.values,
444+
),
445+
'cornerRadius': RadiusFieldAccess(
446+
'Corner Radius',
447+
'Corner radius applied to the shapes.',
448+
() => cornerRadius,
449+
(value) => cornerRadius = value,
450+
),
409451
};
410452

411453
@override
@@ -426,6 +468,9 @@ class ExpansionTileProperties extends CustomProperties with FieldsHolder {
426468
visualDensity,
427469
showDividers,
428470
showTrailingIcon,
471+
shape,
472+
collapsedShape,
473+
cornerRadius,
429474
];
430475

431476
@override

‎lib/src/api/nodes/expansion_tile_node.g.dart‎

Lines changed: 23 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎test/properties_test.dart‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,14 @@ void main() {
226226
ExpansionTileProperties(showTrailingIcon: false).toJson(),
227227
);
228228
expect(copy.showTrailingIcon, isFalse);
229+
final shaped = ExpansionTileProperties.fromJson(
230+
ExpansionTileProperties(
231+
shape: CShapeBorder.roundedRectangle,
232+
cornerRadius: CornerRadius.zero,
233+
).toJson(),
234+
);
235+
expect(shaped.shape, CShapeBorder.roundedRectangle);
236+
expect(shaped.collapsedShape, isNull);
229237
});
230238

231239
test('TextNode.softWrap', () {

0 commit comments

Comments
 (0)