|
@@ -5,29 +5,12 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:flutter/widgets.dart';
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
-import 'package:plugin_platform/engine/toast/toast_engine.dart';
|
|
|
import 'package:shared/utils/color_utils.dart';
|
|
|
import 'package:shared/utils/ext_dart.dart';
|
|
|
-import 'package:shared/utils/log_utils.dart';
|
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
|
import 'package:widgets/my_load_image.dart';
|
|
|
import 'package:widgets/my_text_view.dart';
|
|
|
|
|
|
-import '../../../constants_services.dart';
|
|
|
-
|
|
|
-
|
|
|
-// 'id':1,
|
|
|
-// 'service_type': 0, // 0 房屋保洁 1 空调保洁 2 维修
|
|
|
-// 'cover_img': 'https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500',
|
|
|
-// 'resources': ['https://img2.baidu.com/it/u=3489233687,2364672159&fm=253&fmt=auto&app=120&f=JPEG?w=507&h=500'],
|
|
|
-// 'title': 'House Cleaning Services',
|
|
|
-// 'price': 66,
|
|
|
-// 'unit': '/hr',
|
|
|
-// 'liked': true,
|
|
|
-// 'likes_count': 1212,
|
|
|
-// 'company_name': 'HONG YE GROUP PTE LTD',
|
|
|
-
|
|
|
-
|
|
|
class RepairHomeServiceCard extends StatelessWidget {
|
|
|
String? cleanServiceType;
|
|
|
RepairServiceList itemEntity;
|
|
@@ -43,114 +26,134 @@ class RepairHomeServiceCard extends StatelessWidget {
|
|
|
this.onClickColleciotn,
|
|
|
double? cardHeight,
|
|
|
}) : super(key: key) {
|
|
|
- this.cardHeight ??= 170;
|
|
|
+ this.cardHeight ??= 180;
|
|
|
}
|
|
|
|
|
|
@override
|
|
|
Widget build(BuildContext context) {
|
|
|
+ List? card_resources = itemEntity.resources?? [];
|
|
|
int card_id = itemEntity.id?? 0;
|
|
|
- List? card_resources = [];
|
|
|
String card_img = card_resources.length>0? card_resources[0]:"";
|
|
|
String card_name = itemEntity.name?? "";
|
|
|
+
|
|
|
bool card_liked = itemEntity.liked??false;
|
|
|
int card_likes_count = itemEntity.likesCount?? 0;
|
|
|
|
|
|
final company_name = itemEntity.merchant?.name?? "";
|
|
|
- return Column(
|
|
|
- children: [
|
|
|
- // 图片
|
|
|
- Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.center,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Expanded(
|
|
|
- child: ClipRRect(
|
|
|
- borderRadius: const BorderRadius.only(topLeft: Radius.circular(8), topRight: Radius.circular(8),),
|
|
|
- child: MyLoadImage(
|
|
|
- card_img,
|
|
|
- width: 172.5,
|
|
|
- height: 80.5.ap,
|
|
|
- isCircle: false,
|
|
|
- fit: BoxFit.cover,
|
|
|
- ),
|
|
|
- ),
|
|
|
- ),
|
|
|
- ],
|
|
|
- ),
|
|
|
- // 标题
|
|
|
- Padding(
|
|
|
- padding: const EdgeInsets.only(left: 10, right: 10, top: 10,),
|
|
|
- child: Row(
|
|
|
+ return Container(
|
|
|
+ height: cardHeight!.ap,
|
|
|
+ child: Column(
|
|
|
+ children: [
|
|
|
+ // 图片
|
|
|
+ Row(
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
children: [
|
|
|
Expanded(
|
|
|
- child: SizedBox(
|
|
|
- height: 30.ap,
|
|
|
- child: MyTextView(
|
|
|
- '$card_name',
|
|
|
- maxLines: 2,
|
|
|
- isTextEllipsis: true,
|
|
|
- textAlign: TextAlign.left,
|
|
|
- textColor: context.appColors.textBlack,
|
|
|
- fontSize: 15,
|
|
|
- isFontRegular: true,
|
|
|
+ child: ClipRRect(
|
|
|
+ borderRadius: const BorderRadius.only(topLeft: Radius.circular(8), topRight: Radius.circular(8),),
|
|
|
+ child: MyLoadImage(
|
|
|
+ card_img,
|
|
|
+ width: 172.5.ap,
|
|
|
+ height: 70.ap,
|
|
|
+ isCircle: false,
|
|
|
+ fit: BoxFit.fitWidth,
|
|
|
),
|
|
|
),
|
|
|
),
|
|
|
],
|
|
|
),
|
|
|
- ),
|
|
|
- // 价格 及 收藏
|
|
|
- Padding(
|
|
|
- padding: const EdgeInsets.only(left: 10, right: 10,top: 0, bottom: 0),
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- Expanded(
|
|
|
- child: Row(
|
|
|
- mainAxisAlignment: MainAxisAlignment.start,
|
|
|
- crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
- children: [
|
|
|
- MyTextView(
|
|
|
- 'get a quote',
|
|
|
- maxLines: 1,
|
|
|
+ // 标题
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(left: 10.ap, right: 10.ap, top: 5.ap,),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: SizedBox(
|
|
|
+ height: 36.ap,
|
|
|
+ child: MyTextView(
|
|
|
+ card_name,
|
|
|
+ maxLines: 2,
|
|
|
isTextEllipsis: true,
|
|
|
- textAlign: TextAlign.start,
|
|
|
- textColor: ColorUtils.string2Color('#666666'),
|
|
|
- fontSize: 11,
|
|
|
- isFontMedium: true,
|
|
|
+ textAlign: TextAlign.left,
|
|
|
+ textColor: context.appColors.textBlack,
|
|
|
+ fontSize: 14,
|
|
|
+ isFontRegular: true,
|
|
|
),
|
|
|
- ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- // 动态的 收藏数
|
|
|
- CollectionWidget(
|
|
|
- collectionNum: card_likes_count,
|
|
|
- isCollection: card_liked,
|
|
|
- onClickColleciotn: onClickColleciotn,
|
|
|
- ),
|
|
|
- ],
|
|
|
+ ],
|
|
|
+ ),
|
|
|
),
|
|
|
- ),
|
|
|
- // 公司名称
|
|
|
- Expanded(
|
|
|
- child: Padding(
|
|
|
- padding: const EdgeInsets.only(bottom: 5),
|
|
|
+ // 价格 及 收藏
|
|
|
+ Padding(
|
|
|
+ padding: EdgeInsets.only(left: 10.ap, right: 10.ap,top: 5.ap, bottom: 0),
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.spaceAround,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ Expanded(
|
|
|
+ child: Row(
|
|
|
+ mainAxisAlignment: MainAxisAlignment.start,
|
|
|
+ crossAxisAlignment: CrossAxisAlignment.center,
|
|
|
+ children: [
|
|
|
+ MyTextView(
|
|
|
+ 'get a quote',
|
|
|
+ maxLines: 1,
|
|
|
+ isTextEllipsis: true,
|
|
|
+ textAlign: TextAlign.start,
|
|
|
+ textColor: ColorUtils.string2Color('#666666'),
|
|
|
+ fontSize: 11,
|
|
|
+ isFontMedium: true,
|
|
|
+ ),
|
|
|
+ // MyTextView(
|
|
|
+ // '\$$card_price',
|
|
|
+ // maxLines: 1,
|
|
|
+ // isTextEllipsis: true,
|
|
|
+ // textAlign: TextAlign.start,
|
|
|
+ // textColor: ColorUtils.string2Color('#4161D0'),
|
|
|
+ // fontSize: 15,
|
|
|
+ // isFontMedium: true,
|
|
|
+ // marginLeft: 2,
|
|
|
+ // ),
|
|
|
+ // MyTextView(
|
|
|
+ // '$',
|
|
|
+ // maxLines: 1,
|
|
|
+ // isTextEllipsis: true,
|
|
|
+ // textAlign: TextAlign.start,
|
|
|
+ // textColor: ColorUtils.string2Color('#666666'),
|
|
|
+ // fontSize: 11,
|
|
|
+ // isFontMedium: true,
|
|
|
+ // ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // 动态的 收藏数
|
|
|
+ CollectionWidget(
|
|
|
+ collectionNum: card_likes_count,
|
|
|
+ isCollection: card_liked,
|
|
|
+ onClickColleciotn: onClickColleciotn,
|
|
|
+ ),
|
|
|
+ ],
|
|
|
+ ),
|
|
|
+ ),
|
|
|
+ // 公司名称
|
|
|
+ Expanded(
|
|
|
child: MyTextView(
|
|
|
company_name,
|
|
|
maxLines: 1,
|
|
|
isTextEllipsis: true,
|
|
|
textAlign: TextAlign.start,
|
|
|
- marginLeft: 13,
|
|
|
+ marginLeft: 10,
|
|
|
fontSize: 11,
|
|
|
textColor: ColorUtils.string2Color('#666666'),
|
|
|
alignment: Alignment.centerLeft,
|
|
|
isFontRegular: true,
|
|
|
),
|
|
|
- ),
|
|
|
- )
|
|
|
- ],
|
|
|
+ )
|
|
|
+ ],
|
|
|
+ ),
|
|
|
);
|
|
|
}
|
|
|
}
|
|
@@ -172,8 +175,6 @@ class CollectionWidget extends HookConsumerWidget {
|
|
|
final collectionNumState = useState(collectionNum);
|
|
|
final isCollectionState = useState(isCollection);
|
|
|
return Container(
|
|
|
- width: 60,
|
|
|
- height: 30,
|
|
|
alignment: Alignment.center,
|
|
|
// decoration: BoxDecoration(
|
|
|
// color: ColorUtils.string2Color('#E5E5E5'),
|