Files
syncrow-app/lib/features/scene/widgets/scene_list_tile.dart
ashrafzarkanisala b1dbee499f push folders revamp
2024-06-24 00:05:56 +03:00

68 lines
2.0 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.subtitle,
this.leadingWidget,
this.trailingWidget,
this.padding,
this.textAlign,
this.onPressed,
this.assetHeight,
this.minLeadingWidth,
this.titleWidget,
});
final String? assetPath;
final String? titleString;
final String? subtitle;
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;
@override
Widget build(BuildContext context) {
return ListTile(
minLeadingWidth: minLeadingWidth ?? 40,
leading: leadingWidget ??
(assetPath != null
? SvgPicture.asset(
assetPath ?? Assets.assetsImagesLogo,
width: 20,
height: assetHeight ?? 32,
fit: BoxFit.fitWidth,
)
: null),
trailing: trailingWidget,
contentPadding: padding,
title: titleWidget ??
BodyMedium(
text: titleString ?? '',
textAlign: textAlign,
style: context.bodyMedium.copyWith(fontSize: 15),
),
subtitle: subtitle == null
? null
: BodySmall(
text: subtitle!,
style: context.bodySmall.copyWith(
fontWeight: FontWeight.w400, color: ColorsManager.greyColor),
),
onTap: onPressed,
);
}
}