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.
127 lines
5.1 KiB
Dart
127 lines
5.1 KiB
Dart
import 'package:easy_localization/easy_localization.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:mc_common_app/classes/app_state.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_models/service_model.dart';
|
|
import 'package:mc_common_app/theme/colors.dart';
|
|
import 'package:mc_common_app/widgets/extensions/extensions_widget.dart';
|
|
|
|
class BranchDetailCard extends StatelessWidget {
|
|
final String providerImageUrl;
|
|
final String title;
|
|
final String? providerName;
|
|
final String providerLocation;
|
|
final double providerRatings;
|
|
final List<ServiceModel>? services;
|
|
final Function() onCardTapped;
|
|
|
|
const BranchDetailCard({
|
|
Key? key,
|
|
required this.providerImageUrl,
|
|
required this.title,
|
|
required this.providerRatings,
|
|
required this.providerLocation,
|
|
this.services,
|
|
this.providerName,
|
|
required this.onCardTapped,
|
|
}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: EdgeInsets.zero,
|
|
// padding: const EdgeInsets.only(
|
|
// bottom: 10,
|
|
// left: 21,
|
|
// right: 21,
|
|
// ),
|
|
child: Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
providerImageUrl.buildNetworkImage(height: 80, width: 80),
|
|
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),
|
|
if (AppState().currentLocation.latitude != 0 && AppState().currentLocation.longitude != 0) ...[
|
|
Row(
|
|
children: [
|
|
("${LocaleKeys.location.tr()}:").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
4.width,
|
|
providerLocation.toText(fontSize: 12, isBold: true),
|
|
],
|
|
),
|
|
],
|
|
if (providerName != null)
|
|
Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
("${LocaleKeys.provider.tr()}:").toText(color: MyColors.lightTextColor, fontSize: 12),
|
|
4.width,
|
|
Flexible(child: providerName!.toText(fontSize: 12, isBold: true),)
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
if (providerRatings != 0.0) ...[
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.start,
|
|
children: [
|
|
providerRatings.toString().toText(
|
|
isUnderLine: true,
|
|
isBold: true,
|
|
fontSize: 12,
|
|
),
|
|
2.width,
|
|
MyAssets.icStar.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)
|
|
],
|
|
),
|
|
)
|
|
.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));
|
|
}
|
|
}
|