Files
syncrow-app/lib/features/scene/widgets/scene_list_tile.dart
2024-06-29 18:24:33 +03:00

80 lines
2.5 KiB
Dart

import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
class SceneListTile extends StatelessWidget {
const SceneListTile({
super.key,
this.assetPath,
this.titleString,
this.leadingWidget,
this.trailingWidget,
this.padding,
this.textAlign,
this.onPressed,
this.assetHeight,
this.minLeadingWidth,
this.titleWidget,
this.subtitleString,
this.subtitleWidget,
this.iconsSize,
this.assetHeaderValue,
});
final String? assetPath;
final String? titleString;
final Widget? subtitleWidget;
final String? subtitleString;
final Widget? leadingWidget;
final Widget? trailingWidget;
final EdgeInsetsGeometry? padding;
final TextAlign? textAlign;
final void Function()? onPressed;
final double? assetHeight;
final double? minLeadingWidth;
final Widget? titleWidget;
final double? iconsSize;
final String? assetHeaderValue;
@override
Widget build(BuildContext context) {
return ListTile(
minLeadingWidth: minLeadingWidth ?? 40,
leading: leadingWidget ??
(assetPath != null
? SizedBox(
width: iconsSize,
child: SvgPicture.asset(
assetPath ?? Assets.assetsImagesLogo,
width: iconsSize,
height: assetHeight ?? 35,
alignment: Alignment.center,
fit: BoxFit.fitWidth,
),
)
: null),
trailing: trailingWidget,
contentPadding: padding,
title: titleWidget ??
BodyMedium(
text: titleString ?? '',
textAlign: textAlign,
style: context.bodyMedium.copyWith(fontSize: 15),
),
subtitle: subtitleWidget ??
(subtitleString?.isNotEmpty == true
? BodySmall(
text: subtitleString ?? '',
style: context.bodySmall.copyWith(
fontWeight: FontWeight.w400,
color: ColorsManager.greyColor),
)
: null),
onTap: onPressed,
);
}
}