fbe1928f59
Keep the existing Material transcript path while preserving public Cupertino parameters for callers. Narrow transcript tests to the Material-only behavior and remove Cupertino-only fixtures.
33 lines
1.1 KiB
Dart
33 lines
1.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
|
|
/// A block opened with the host's own disclosure control (collapsed by default).
|
|
///
|
|
/// [childBuilder] runs only while the block is open, so a closed disclosure
|
|
/// never encodes or lays out its body. The [ExpansionTile] keeps the open state.
|
|
class NativeDisclosure extends StatelessWidget {
|
|
const NativeDisclosure({
|
|
super.key,
|
|
required this.label,
|
|
required this.childBuilder,
|
|
this.initiallyExpanded = false,
|
|
});
|
|
|
|
final String label;
|
|
final WidgetBuilder childBuilder;
|
|
final bool initiallyExpanded;
|
|
|
|
@override
|
|
Widget build(BuildContext context) => ExpansionTile(
|
|
title: Text(label),
|
|
initiallyExpanded: initiallyExpanded,
|
|
maintainState: false,
|
|
// A transcript block starts at the row edge, like its answer text; the
|
|
// tile's own padding would indent it, and its body defaults to centred,
|
|
// which floats a short body in the middle of the row.
|
|
tilePadding: EdgeInsets.zero,
|
|
expandedAlignment: AlignmentDirectional.centerStart,
|
|
expandedCrossAxisAlignment: CrossAxisAlignment.stretch,
|
|
children: [Builder(builder: childBuilder)],
|
|
);
|
|
}
|