|
@@ -8,9 +8,14 @@ import 'package:flutter/material.dart';
|
|
|
import 'package:auto_route/auto_route.dart';
|
|
|
import 'package:flutter_hooks/flutter_hooks.dart';
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
+import 'package:plugin_basic/provider/app_config/app_config.dart';
|
|
|
+import 'package:plugin_basic/provider/app_config/app_config_service.dart';
|
|
|
+import 'package:plugin_platform/engine/image/image_preview.dart';
|
|
|
import 'package:router/ext/auto_router_extensions.dart';
|
|
|
import 'package:shared/utils/color_utils.dart';
|
|
|
+import 'package:shared/utils/ext_dart.dart';
|
|
|
import 'package:shared/utils/log_utils.dart';
|
|
|
+import 'package:shared/utils/size_config.dart';
|
|
|
import 'package:widgets/ext/ex_widget.dart';
|
|
|
import 'package:widgets/load_state_layout.dart';
|
|
|
import 'package:widgets/my_appbar.dart';
|
|
@@ -42,15 +47,14 @@ class GaragesaleDetailPage extends HookConsumerWidget {
|
|
|
final String pageTitle = (type == 'forSale') ? 'For Sale' :'For Rent';
|
|
|
GlobalKey _likeButtonKey = GlobalKey<MyLikeButtonState>();
|
|
|
|
|
|
- GarageSaleRentDetailEntity detailInfo = state.datas?? GarageSaleRentDetailEntity();
|
|
|
- String title = detailInfo.title?? '';
|
|
|
- int price = detailInfo.price?? 0;
|
|
|
+ GarageSaleRentDetailEntity? detailInfo = state.datas?? null;
|
|
|
+ String title = detailInfo?.title?? '';
|
|
|
+ int price = detailInfo?.price?? 0;
|
|
|
|
|
|
- String contactType = detailInfo.contact??'';
|
|
|
+ String contactType = detailInfo?.contact??'';
|
|
|
|
|
|
String description = '';
|
|
|
|
|
|
-
|
|
|
useEffect((){
|
|
|
vm.setInitPageData(id: id!, type: type);
|
|
|
// 组件挂载时执行 - 执行接口请求
|
|
@@ -98,7 +102,7 @@ class GaragesaleDetailPage extends HookConsumerWidget {
|
|
|
SliverList(
|
|
|
delegate: SliverChildBuilderDelegate(
|
|
|
(context, index){
|
|
|
- return _buildContentBox(context, ref, detailInfo);
|
|
|
+ return detailInfo !=null? _buildContentBox(context, ref, detailInfo): Container();
|
|
|
},
|
|
|
childCount: 1
|
|
|
),
|
|
@@ -124,13 +128,13 @@ class GaragesaleDetailPage extends HookConsumerWidget {
|
|
|
// 底部联系信息
|
|
|
Visibility(
|
|
|
visible: state.loadingState == LoadState.State_Success,
|
|
|
- child: _buildBottomConcatInfo(context, ref, _likeButtonKey,
|
|
|
+ child: detailInfo !=null ? _buildBottomConcatInfo(context, ref, _likeButtonKey,
|
|
|
title:title,
|
|
|
price:price,
|
|
|
contactType:contactType,
|
|
|
description:description,
|
|
|
detailInfo:detailInfo,
|
|
|
- ),
|
|
|
+ ): Container(),
|
|
|
)
|
|
|
],
|
|
|
),
|
|
@@ -165,17 +169,29 @@ class GaragesaleDetailPage extends HookConsumerWidget {
|
|
|
children: [
|
|
|
// 图片
|
|
|
SizedBox(
|
|
|
- width: double.infinity,
|
|
|
+ width: SizeConfig().screenWidth,
|
|
|
height: 173.5,
|
|
|
child: CarouselSlider(
|
|
|
// items: [MyLoadImage(goods_img)] ,
|
|
|
- items: resources.map((resource) => MyLoadImage(resource)).toList(),
|
|
|
+ items: resources.map((resource) => MyLoadImage(
|
|
|
+ resource,
|
|
|
+ fit: BoxFit.cover, // 确保图片覆盖整个区域
|
|
|
+ width: SizeConfig().screenWidth, // 确保图片宽度与屏幕宽度一致
|
|
|
+ height: 173.5, // 确保图片高度与 CarouselSlider 高度一致
|
|
|
+ ).onTap((){
|
|
|
+ ImagePreviewEngine.multipleImagePreview(
|
|
|
+ context,
|
|
|
+ resources,
|
|
|
+ heroes: List.generate(resources.length, (index) => resources[index]),
|
|
|
+ onLongPressAction: (url) {}
|
|
|
+ );
|
|
|
+ })
|
|
|
+ ).toList(),
|
|
|
carouselController: buttonCarouselController,
|
|
|
options: CarouselOptions(
|
|
|
- autoPlay: true,
|
|
|
+ autoPlay: false,
|
|
|
enlargeCenterPage: true,
|
|
|
- viewportFraction: 0.9,
|
|
|
- aspectRatio: 2.0,
|
|
|
+ viewportFraction: 1,
|
|
|
initialPage: 0,
|
|
|
),
|
|
|
),
|
|
@@ -221,15 +237,20 @@ class GaragesaleDetailPage extends HookConsumerWidget {
|
|
|
|
|
|
GarageSaleRentDetailAccount account = detailInfo.account?? GarageSaleRentDetailAccount();
|
|
|
|
|
|
+ Log.d("0000000 ${detailInfo.likesCount}");
|
|
|
String publisher = account.name??'-';
|
|
|
String publisherAvatar = account.avatar??'-';
|
|
|
|
|
|
String contactType = detailInfo.contact??'';
|
|
|
String publisherTime = detailInfo.createdAt??'-';
|
|
|
- int likes_count = detailInfo!.likesCount??0;
|
|
|
+ int? likes_count = detailInfo.likesCount??0;
|
|
|
+ Log.d("666666 ${likes_count}");
|
|
|
|
|
|
- final _likes_count = useState(likes_count);
|
|
|
+
|
|
|
+ final _likes_count = useState<int>(likes_count!);
|
|
|
final _isLiked = useState<bool>(false);
|
|
|
+ Log.d("4344 ${_likes_count.value}");
|
|
|
+
|
|
|
|
|
|
return Container(
|
|
|
height: 50,
|