SectionTile.button constructor

SectionTile.button({
  1. Key? key,
  2. required String titleText,
  3. Icon? icon,
  4. required VoidCallback onTap,
  5. required Color color,
  6. String? subTitle,
  7. bool dense = false,
})

Implementation

factory SectionTile.button({
  Key? key,
  required String titleText,
  Icon? icon,
  required VoidCallback onTap,
  required Color color,
  String? subTitle,
  bool dense = false,
}) {
  final textWidget = Text(
    titleText,
    style: TextStyle(color: color),
  );

  final title = icon == null
      ? textWidget
      : Row(
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Padding(
              padding: const EdgeInsets.only(right: 10),
              child: icon,
            ),
            textWidget,
          ],
        );

  return SectionTile(
    key: key,
    dense: dense,
    // icon: icon,
    title: Center(
      child: title,
    ),
    color: color,
    onTap: onTap,
  );
}