2024-10-10 15:44:14 +07:00
|
|
|
import 'package:flutter/material.dart';
|
2024-11-21 22:35:58 +07:00
|
|
|
import 'package:immich_mobile/extensions/build_context_extensions.dart';
|
2024-10-10 15:44:14 +07:00
|
|
|
|
|
|
|
class LargeLeadingTile extends StatelessWidget {
|
|
|
|
const LargeLeadingTile({
|
|
|
|
super.key,
|
|
|
|
required this.leading,
|
|
|
|
required this.onTap,
|
|
|
|
required this.title,
|
|
|
|
this.subtitle,
|
|
|
|
this.leadingPadding = const EdgeInsets.symmetric(
|
|
|
|
vertical: 8,
|
|
|
|
horizontal: 16.0,
|
|
|
|
),
|
|
|
|
this.borderRadius = 20.0,
|
2025-01-16 21:20:44 -06:00
|
|
|
this.trailing,
|
|
|
|
this.selected = false,
|
|
|
|
this.disabled = false,
|
2025-01-29 14:02:54 -07:00
|
|
|
this.selectedTileColor,
|
|
|
|
this.tileColor,
|
2024-10-10 15:44:14 +07:00
|
|
|
});
|
|
|
|
|
|
|
|
final Widget leading;
|
|
|
|
final VoidCallback onTap;
|
|
|
|
final Widget title;
|
|
|
|
final Widget? subtitle;
|
|
|
|
final EdgeInsetsGeometry leadingPadding;
|
|
|
|
final double borderRadius;
|
2025-01-16 21:20:44 -06:00
|
|
|
final Widget? trailing;
|
|
|
|
final bool selected;
|
|
|
|
final bool disabled;
|
2025-01-29 14:02:54 -07:00
|
|
|
final Color? selectedTileColor;
|
|
|
|
final Color? tileColor;
|
|
|
|
|
2024-10-10 15:44:14 +07:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return InkWell(
|
|
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
2025-01-16 21:20:44 -06:00
|
|
|
onTap: disabled ? null : onTap,
|
|
|
|
child: Container(
|
|
|
|
decoration: BoxDecoration(
|
|
|
|
color: selected
|
2025-01-29 14:02:54 -07:00
|
|
|
? selectedTileColor ??
|
|
|
|
Theme.of(context).primaryColor.withAlpha(30)
|
|
|
|
: tileColor ?? Colors.transparent,
|
2025-01-16 21:20:44 -06:00
|
|
|
borderRadius: BorderRadius.circular(borderRadius),
|
|
|
|
),
|
|
|
|
child: Row(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Padding(
|
|
|
|
padding: leadingPadding,
|
|
|
|
child: leading,
|
|
|
|
),
|
|
|
|
Expanded(
|
|
|
|
child: Column(
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
|
|
children: [
|
|
|
|
SizedBox(
|
|
|
|
width: context.width * 0.6,
|
|
|
|
child: title,
|
|
|
|
),
|
|
|
|
subtitle ?? const SizedBox.shrink(),
|
|
|
|
],
|
2024-10-10 15:44:14 +07:00
|
|
|
),
|
2025-01-16 21:20:44 -06:00
|
|
|
),
|
|
|
|
if (trailing != null) trailing!,
|
|
|
|
],
|
|
|
|
),
|
2024-10-10 15:44:14 +07:00
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|