buildSection method

Widget buildSection({
  1. required String title,
  2. String? subtitle,
  3. required List<Widget> children,
  4. bool initiallyExpanded = false,
})

Build an expansion tile section

Implementation

Widget buildSection({
  required String title,
  String? subtitle,
  required List<Widget> children,
  bool initiallyExpanded = false,
}) {
  return ExpansionTile(
    title: Text(
      title,
      style: TextStyle(fontWeight: FontWeight.w600, color: textColor),
    ),
    subtitle: subtitle != null
        ? Text(subtitle, style: TextStyle(fontSize: 12, color: subtitleColor))
        : null,
    initiallyExpanded: initiallyExpanded,
    children: [
      Padding(
        padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.start,
          children: children,
        ),
      ),
    ],
  );
}