修复 图片加载

hmxc
张萌 4 years ago
parent ab97bd8db6
commit c6ee2c5817

@ -1,3 +1,3 @@
{ {
"flutterSdkVersion": "2.0.0" "flutterSdkVersion": "2.0.2"
} }

@ -1,3 +1,3 @@
{ {
"dart.flutterSdkPath": "/Users/zhangmeng/fvm/versions/2.0.0" "dart.flutterSdkPath": "/Users/zhangmeng/fvm/versions/2.0.2"
} }

@ -4,7 +4,7 @@
In most cases you can leave this as-is, but you if you want to provide In most cases you can leave this as-is, but you if you want to provide
additional functionality it is fine to subclass or reimplement additional functionality it is fine to subclass or reimplement
FlutterApplication and put your custom class here. --> FlutterApplication and put your custom class here. -->
<application android:name="io.flutter.app.FlutterApplication" android:label="小蜜蜂智慧社区" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true"> <application android:name="io.flutter.app.FlutterApplication" android:label="小蜜蜂智慧社区管家端" android:icon="@mipmap/ic_launcher" android:usesCleartextTraffic="true">
<meta-data android:name="com.amap.api.v2.apikey" android:value="872b909f2ebc8150b809d692c4349f22"/> <meta-data android:name="com.amap.api.v2.apikey" android:value="872b909f2ebc8150b809d692c4349f22"/>
<activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize"> <activity android:name=".MainActivity" android:launchMode="singleTop" android:theme="@style/LaunchTheme" android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode" android:hardwareAccelerated="true" android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as <!-- Specifies an Android theme to apply to this Activity as soon as

@ -6,8 +6,8 @@ class InspectionCheckDetialModel {
int type; int type;
String completeDate; String completeDate;
List<CheckFBIVoList> checkFBIVoList; List<CheckFBIVoList> checkFBIVoList;
List<String> faceImg; List<FaceImg> faceImg;
List<String> spaceImg; List<FaceImg> spaceImg;
InspectionCheckDetialModel( InspectionCheckDetialModel(
{this.id, {this.id,
@ -33,8 +33,18 @@ class InspectionCheckDetialModel {
checkFBIVoList.add(new CheckFBIVoList.fromJson(v)); checkFBIVoList.add(new CheckFBIVoList.fromJson(v));
}); });
} }
faceImg = json['faceImg'].cast<String>(); if (json['faceImg'] != null) {
spaceImg = json['spaceImg'].cast<String>(); faceImg = new List<FaceImg>();
json['faceImg'].forEach((v) {
faceImg.add(new FaceImg.fromJson(v));
});
}
if (json['spaceImg'] != null) {
spaceImg = new List<FaceImg>();
json['spaceImg'].forEach((v) {
spaceImg.add(new FaceImg.fromJson(v));
});
}
} }
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
@ -49,8 +59,12 @@ class InspectionCheckDetialModel {
data['checkFBIVoList'] = data['checkFBIVoList'] =
this.checkFBIVoList.map((v) => v.toJson()).toList(); this.checkFBIVoList.map((v) => v.toJson()).toList();
} }
data['faceImg'] = this.faceImg; if (this.faceImg != null) {
data['spaceImg'] = this.spaceImg; data['faceImg'] = this.faceImg.map((v) => v.toJson()).toList();
}
if (this.spaceImg != null) {
data['spaceImg'] = this.spaceImg.map((v) => v.toJson()).toList();
}
return data; return data;
} }
} }
@ -79,3 +93,31 @@ class CheckFBIVoList {
return data; return data;
} }
} }
class FaceImg {
String url;
int size;
int longs;
int paragraph;
int sort;
FaceImg({this.url, this.size, this.longs, this.paragraph, this.sort});
FaceImg.fromJson(Map<String, dynamic> json) {
url = json['url'];
size = json['size'];
longs = json['longs'];
paragraph = json['paragraph'];
sort = json['sort'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['url'] = this.url;
data['size'] = this.size;
data['longs'] = this.longs;
data['paragraph'] = this.paragraph;
data['sort'] = this.sort;
return data;
}
}

@ -1,3 +1,4 @@
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/inspection/inspection_check_detail_model.dart'; import 'package:aku_community_manager/models/manager/inspection/inspection_check_detail_model.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_utils.dart'; import 'package:aku_community_manager/ui/manage_pages/inspection_manage/inspection_utils.dart';
@ -99,7 +100,10 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
? Container( ? Container(
width: 320.w, width: 320.w,
height: 320.w, height: 320.w,
child: Placeholder(), child: FadeInImage.assetNetwork(
fit: BoxFit.fill,
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(_detialModel.faceImg?.first?.url ?? '')),
) )
: DottedBorder( : DottedBorder(
borderType: BorderType.RRect, borderType: BorderType.RRect,
@ -148,7 +152,10 @@ class _InspectionPointDetailPageState extends State<InspectionPointDetailPage> {
? Container( ? Container(
width: 320.w, width: 320.w,
height: 320.w, height: 320.w,
child: Placeholder(), child: FadeInImage.assetNetwork(
fit: BoxFit.fill,
placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(_detialModel.spaceImg?.first?.url ?? '')),
) )
: DottedBorder( : DottedBorder(
borderType: BorderType.RRect, borderType: BorderType.RRect,

@ -54,7 +54,7 @@ class _ActivityDetailPageState extends State<ActivityDetailPage> {
children: [ children: [
FadeInImage.assetNetwork( FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: _detailModel.firstImg?.url ?? '', image: API.image(_detailModel.firstImg?.url ?? ''),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
Padding( Padding(

@ -1,4 +1,5 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/activity_item_model.dart'; import 'package:aku_community_manager/models/manager/activity_item_model.dart';
import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_detail_page.dart'; import 'package:aku_community_manager/ui/sub_pages/activity_manager/activity_detail_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -40,7 +41,7 @@ class ActivityManagerCard extends StatelessWidget {
tag: model.title, tag: model.title,
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: model.firstImg?.url ?? '', image: API.image(model.firstImg?.url ?? ''),
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),

@ -1,4 +1,5 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_detail_model.dart'; import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_detail_model.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart'; import 'package:aku_community_manager/models/manager/bussiness_and_fix/dispatch_report_model.dart';
@ -123,7 +124,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
builder: (context) { builder: (context) {
final userProvider = final userProvider =
Provider.of<UserProvider>(context, listen: false); Provider.of<UserProvider>(context, listen: false);
if (userProvider.infoModel.canOperation&&widget.model.status<2) { if (userProvider.infoModel.canOperation && widget.model.status < 2) {
return AkuMaterialButton( return AkuMaterialButton(
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
nullColor: AppStyle.minorColor, nullColor: AppStyle.minorColor,
@ -180,7 +181,7 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
), ),
); );
} }
} else if ((widget.model.status==3) && } else if ((widget.model.status == 3) &&
userProvider.infoModel.canPickUpTicket) userProvider.infoModel.canPickUpTicket)
return Container( return Container(
height: 96.w, height: 96.w,
@ -291,7 +292,8 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: e.url), placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(e.url)),
); );
}).toList(), }).toList(),
shrinkWrap: true, shrinkWrap: true,
@ -472,7 +474,8 @@ class _BusinessAndFixDetailPageState extends State<BusinessAndFixDetailPage> {
return ClipRRect( return ClipRRect(
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: e.url)); placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(e.url)));
}).toList(), }).toList(),
), ),
], ],

@ -1,5 +1,8 @@
// Flutter imports: // Flutter imports:
import 'package:aku_community_manager/const/api.dart';
import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart'; import 'package:aku_community_manager/models/manager/bussiness_and_fix/bussiness_and_fix_model.dart';
import 'package:aku_community_manager/models/user/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/tools/aku_map.dart'; import 'package:aku_community_manager/tools/aku_map.dart';
import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart'; import 'package:aku_community_manager/ui/sub_pages/business_and_fix/business_and_fix_detail_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -11,8 +14,6 @@ import 'package:get/get.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
// Project imports: // Project imports:
import 'package:aku_community_manager/mock_models/users/user_info_model.dart';
import 'package:aku_community_manager/provider/user_provider.dart';
import 'package:aku_community_manager/style/app_style.dart'; import 'package:aku_community_manager/style/app_style.dart';
import 'package:aku_community_manager/tools/screen_tool.dart'; import 'package:aku_community_manager/tools/screen_tool.dart';
import 'package:aku_community_manager/tools/widget_tool.dart'; import 'package:aku_community_manager/tools/widget_tool.dart';
@ -29,9 +30,9 @@ class BusinessFixCard extends StatefulWidget {
} }
class _BusinessFixCardState extends State<BusinessFixCard> { class _BusinessFixCardState extends State<BusinessFixCard> {
USER_ROLE get userRole { UserInfoModel get userInfoModel {
final userProvider = Provider.of<UserProvider>(context, listen: false); final userProvider = Provider.of<UserProvider>(context, listen: false);
return userProvider.userInfoModel.role; return userProvider.infoModel;
} }
String get dateStart => DateUtil.formatDateStr(widget.model.repairDate, String get dateStart => DateUtil.formatDateStr(widget.model.repairDate,
@ -61,10 +62,9 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
final userProvider = Provider.of<UserProvider>(context, listen: false);
return GestureDetector( return GestureDetector(
onTap: () { onTap: () {
Get.to(BusinessAndFixDetailPage(model: widget.model)); Get.to(() => BusinessAndFixDetailPage(model: widget.model));
}, },
child: Container( child: Container(
padding: EdgeInsets.all(24.w), padding: EdgeInsets.all(24.w),
@ -86,12 +86,10 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
), ),
), ),
Text( Text(
AkuMap.fixStatus( AkuMap.fixStatus(userInfoModel.canOperation,
userProvider.infoModel.canOperation, userInfoModel.canPickUpTicket, widget.model.status),
userProvider.infoModel.canPickUpTicket,
widget.model.status),
style: TextStyle( style: TextStyle(
color: widget.model.status <4 color: widget.model.status < 4
? Color(0XFFFF4501) ? Color(0XFFFF4501)
: AppStyle.minorTextColor, : AppStyle.minorTextColor,
), ),
@ -141,7 +139,8 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
), ),
clipBehavior: Clip.antiAlias, clipBehavior: Clip.antiAlias,
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, image: imgObj), placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: API.image(imgObj ?? '')),
); );
}, },
itemCount: widget.model.imgUrls.length, itemCount: widget.model.imgUrls.length,
@ -150,8 +149,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
} }
_buildBottomCard() { _buildBottomCard() {
switch (userRole) { if (userInfoModel.canPickUpTicket) {
case USER_ROLE.FIXER:
if (widget.model.status > 4) return SizedBox(); if (widget.model.status > 4) return SizedBox();
return Column( return Column(
children: [ children: [
@ -233,8 +231,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
), ),
], ],
); );
break; } else {
default:
return Column( return Column(
children: [ children: [
widget.homeDisplay ? Divider(height: 24.w) : Divider(height: 48.w), widget.homeDisplay ? Divider(height: 24.w) : Divider(height: 48.w),
@ -243,7 +240,7 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
child: AkuMaterialButton( child: AkuMaterialButton(
height: 64.w, height: 64.w,
onPressed: () { onPressed: () {
// Get.to(BusinessAndFixDetailPage(model: widget.model)); Get.to(() => BusinessAndFixDetailPage(model: widget.model));
}, },
radius: 4, radius: 4,
color: AppStyle.primaryColor, color: AppStyle.primaryColor,
@ -261,7 +258,6 @@ class _BusinessFixCardState extends State<BusinessFixCard> {
), ),
], ],
); );
break;
} }
} }
} }

@ -96,8 +96,9 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
borderRadius: BorderRadius.circular(4.w), borderRadius: BorderRadius.circular(4.w),
child: FadeInImage.assetNetwork( child: FadeInImage.assetNetwork(
placeholder: R.ASSETS_PLACEHOLDER_WEBP, placeholder: R.ASSETS_PLACEHOLDER_WEBP,
image: widget.model.repairDetail.imgUrls[index].url, image: API.image(
)); widget.model.repairDetail.imgUrls[index].url,
)));
}, },
itemCount: widget.model.repairDetail.imgUrls.length, itemCount: widget.model.repairDetail.imgUrls.length,
), ),
@ -389,8 +390,8 @@ class _FixWorkFinishPageState extends State<FixWorkFinishPage> {
// materialPrice: double.parse(_materialController.text), // materialPrice: double.parse(_materialController.text),
// ); // );
// Get.back(); // Get.back();
List<String> urls = await NetUtil() List<String> urls =
.uploadFiles(_imgs, API.upload.uploadArtical); await NetUtil().uploadFiles(_imgs, API.upload.uploadArtical);
BaseModel baseModel = await ManageFunc.handleResult( BaseModel baseModel = await ManageFunc.handleResult(
widget.model.repairDetail.dispatchId, widget.model.repairDetail.dispatchId,
_descriptionController.text, _descriptionController.text,

@ -112,8 +112,9 @@ class _BeeListViewState<T> extends State<BeeListView> {
params: _params, params: _params,
); );
_models.addAll(widget.convert(_model) as List<T>); _models.addAll(widget.convert(_model) as List<T>);
if (_pageNum >= _model.pageCount) // if (_pageNum >= _model.pageCount) {
widget.controller.finishLoad(noMore: true); widget.controller.finishLoad();
// }
setState(() {}); setState(() {});
}, },
child: widget.builder(_models), child: widget.builder(_models),

Loading…
Cancel
Save