You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
133 lines
5.0 KiB
Dart
133 lines
5.0 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mc_common_app/classes/consts.dart';
|
|
import 'package:mc_common_app/extensions/int_extensions.dart';
|
|
import 'package:mc_common_app/extensions/string_extensions.dart';
|
|
import 'package:mc_common_app/generated/locale_keys.g.dart';
|
|
import 'package:mc_common_app/models/services/service_model.dart';
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
class ProviderDetailsCard extends StatelessWidget {
|
|
final String providerImageUrl;
|
|
final String title;
|
|
final String? providerName;
|
|
final String providerLocation;
|
|
final String providerRatings;
|
|
|
|
//TODO: items can be make a generaic, so we can add services/items in the future
|
|
final List<ServiceModel>? services;
|
|
final Function() onCardTapped;
|
|
|
|
const ProviderDetailsCard({
|
|
Key? key,
|
|
required this.providerImageUrl,
|
|
required this.title,
|
|
this.providerName,
|
|
required this.providerRatings,
|
|
required this.providerLocation,
|
|
this.services,
|
|
required this.onCardTapped,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
//TODO: use pading in listview
|
|
return Padding(
|
|
padding: EdgeInsets.zero,
|
|
// padding: const EdgeInsets.only(
|
|
// bottom: 10,
|
|
// left: 21,
|
|
// right: 21,
|
|
// ),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Image.asset(
|
|
providerImageUrl,
|
|
width: 80,
|
|
height: 85,
|
|
fit: BoxFit.cover,
|
|
),
|
|
12.width,
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Expanded(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
title.toText(fontSize: 16, isBold: true),
|
|
Row(
|
|
children: [
|
|
(LocaleKeys.location.tr() + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
4.width,
|
|
providerLocation.toText(fontSize: 12, isBold: true),
|
|
],
|
|
),
|
|
if (providerName != null)
|
|
Row(
|
|
children: [
|
|
(LocaleKeys.providers.tr() + ":").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
4.width,
|
|
providerName!.toText(fontSize: 12, isBold: true),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
providerRatings.toText(
|
|
isUnderLine: true,
|
|
isBold: true,
|
|
fontSize: 12,
|
|
),
|
|
2.width,
|
|
MyAssets.starIcon.buildSvg(width: 12),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
8.height,
|
|
if (services != null)
|
|
Column(
|
|
children: services!
|
|
.take(2)
|
|
.map(
|
|
(e) =>
|
|
Row(
|
|
children: [
|
|
//TODO: Needs to add icon in the future when added from the provider
|
|
// MyAssets.maintenanceIcon.buildSvg(),
|
|
// 8.width,
|
|
e.serviceDescription.toString().toText(
|
|
fontSize: 12,
|
|
isBold: true,
|
|
)
|
|
],
|
|
),
|
|
)
|
|
.toList(),
|
|
),
|
|
if (services != null && services!.length > 2)
|
|
("+${services!.length - 2} more").toText(
|
|
color: MyColors.primaryColor,
|
|
isUnderLine: true,
|
|
isBold: true,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
).onPress(onCardTapped).toWhiteContainer(width: double.infinity, allPading: 12));
|
|
}
|
|
}
|