Add ADListTile

This commit is contained in:
Ankit Mahato
2025-03-29 12:20:37 +05:30
parent 632186f73c
commit ed230e40f2
3 changed files with 58 additions and 16 deletions

View File

@ -0,0 +1,42 @@
import 'package:flutter/material.dart';
import '../tokens/colors.dart';
enum ListTileType { switchOnOff, checkbox, button }
class ADListTile extends StatelessWidget {
const ADListTile({
super.key,
required this.type,
this.hoverColor = kColorTransparent,
required this.title,
this.subtitle,
this.value,
this.onChanged,
});
final ListTileType type;
final Color hoverColor;
final String title;
final String? subtitle;
// For Switch and checkbox tiles
final bool? value;
// For Switch and checkbox tiles
final Function(bool?)? onChanged;
@override
Widget build(BuildContext context) {
return switch (type) {
ListTileType.switchOnOff => SwitchListTile(
hoverColor: hoverColor,
title: Text(title),
subtitle: subtitle == null ? null : Text(subtitle ?? ''),
value: value ?? false,
onChanged: onChanged,
),
// TODO: Handle this case.
ListTileType.checkbox => throw UnimplementedError(),
// TODO: Handle this case.
ListTileType.button => throw UnimplementedError(),
};
}
}

View File

@ -4,6 +4,7 @@ export 'button_text.dart';
export 'checkbox.dart';
export 'decoration_input_textfield.dart';
export 'dropdown.dart';
export 'list_tile.dart';
export 'popup_menu.dart';
export 'snackbar.dart';
export 'textfield_outlined.dart';