Files
tuiche/lib/pages/device_control/my_experience_widget.dart
2025-06-03 09:34:31 +08:00

425 lines
23 KiB
Dart

import 'package:ef/ef.dart';
import 'package:flutter/material.dart';
import 'package:flutterflow_ui/flutterflow_ui.dart';
import 'package:vbvs_app/common/util/FitTool.dart';
import 'package:vbvs_app/common/util/MyUtils.dart';
import 'package:vbvs_app/controller/mh/my_experience_list_controller.dart';
import '../../common/color/appFontsize.dart';
class MyExperienceWidget extends GetView {
int index;
BookExperienceListController bookExperienceListController;
MyExperienceWidget(
{required this.index, required this.bookExperienceListController}) {}
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsetsDirectional.fromSTEB(15, 0, 15, 0),
child: Obx(() {
Map data = {};
bookExperienceListController.model.experienceStoreModelList
.forEach((item) {
if (item["id"] ==
bookExperienceListController.model.bookInfoList[index]
["storeId"]) {
data = item;
}
});
return Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.187,
margin: const EdgeInsets.only(bottom: 25),
constraints: const BoxConstraints(
minHeight: 170,
),
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).secondaryBackground,
borderRadius: BorderRadius.circular(16),
),
child: Padding(
padding: const EdgeInsetsDirectional.fromSTEB(14, 14, 14, 0),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.187,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).secondaryBackground,
),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.187,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context).secondaryBackground,
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(0, 0, 0, 17),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.018,
constraints: const BoxConstraints(
minHeight: 20,
),
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.018,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Align(
alignment: const AlignmentDirectional(0, 0),
child: Text(
// widget!.name,
"体验时间:${DateFormat("yyyy-MM-dd HH:mm").format(DateTime.fromMillisecondsSinceEpoch(int.parse("${bookExperienceListController.model.bookInfoList[index]["bookTimeStart"]}")))}",
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: const Color(0xFF182B7C),
fontSize: AppFontsize.title_size,
letterSpacing: 0,
),
),
),
),
),
),
Container(
width: MediaQuery.sizeOf(context).width,
height: 1.rpx,
decoration: const BoxDecoration(
color: Color(0xFFAAAFC0),
),
),
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(0, 10, 0, 0),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.034,
constraints: const BoxConstraints(
minHeight: 55,
),
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.034,
constraints: const BoxConstraints(
minHeight: 55,
),
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Column(
mainAxisSize: MainAxisSize.max,
children: [
Flexible(
child: Align(
alignment:
const AlignmentDirectional(-1, 0),
child: Text(
'门店:${data["name"] ?? ""}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: const Color(0xFF9EA4B7),
fontSize:
AppFontsize.small_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Align(
alignment:
const AlignmentDirectional(-1, 0),
child: Text(
'地址:${data['addressDetail'] ?? ""}',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: const Color(0xFF9EA4B7),
fontSize:
AppFontsize.small_text_size,
letterSpacing: 0,
),
),
),
),
Flexible(
child: Align(
alignment:
const AlignmentDirectional(-1, 0),
child: Text(
'电话:${data["hotline"]} ',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
color: const Color(0xFF9EA4B7),
fontSize:
AppFontsize.small_text_size,
letterSpacing: 0,
),
),
),
),
],
),
),
),
),
Padding(
padding:
const EdgeInsetsDirectional.fromSTEB(0, 4, 0, 0),
child: Container(
constraints: const BoxConstraints(
minHeight: 40,
),
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.038,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Container(
width: MediaQuery.sizeOf(context).width,
height: MediaQuery.sizeOf(context).height * 0.038,
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: // Generated code for this Row Widget...
Row(
mainAxisSize: MainAxisSize.max,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Flexible(
child: InkWell(
onTap: () {
if (data["hotline"] != null) {
MyUtils.makePhoneCall(data["hotline"]);
}
},
child: Container(
width: MediaQuery.sizeOf(context).width *
0.105,
height:
MediaQuery.sizeOf(context).height *
0.038,
constraints: const BoxConstraints(
maxWidth: 50,
),
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
const Flexible(
child: Icon(
Icons.phone_in_talk,
color: Color(0xFFD3B684),
size: 12,
),
),
Text(
'咨询',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
// color: Color(0xFF9EA4B7),
color:
const Color(0xFF333333),
fontSize: AppFontsize
.small_text_size,
letterSpacing: 0,
),
),
].divide(const SizedBox(width: 13)),
),
),
)),
Flexible(
child: InkWell(
onTap: () {
// AppMapLocation.checkInstalledApps()
// .then((d) {
// if (AppMapLocation
// .availableMapsToNames.isEmpty) {
// showToast("未检测到导航软件");
// } else {
// showOneSelectionDialog(context,
// title: "选择地图",
// arr: AppMapLocation
// .availableMapsToNames,
// checkChange: (index) {
// AppMapLocation.launchMap(
// index,
// data["name"],
// double.parse(
// "${data["latitude"]}"),
// double.parse(
// "${data["longitude"]}"));
// });
// }
// });
},
child: Container(
width: MediaQuery.sizeOf(context).width *
0.105,
height:
MediaQuery.sizeOf(context).height *
0.038,
constraints: const BoxConstraints(
maxWidth: 50,
),
decoration: BoxDecoration(
color: FlutterFlowTheme.of(context)
.secondaryBackground,
),
child: Row(
mainAxisSize: MainAxisSize.max,
children: [
const Flexible(
child: Icon(
Icons.location_on,
color: Color(0xFFD3B684),
size: 12,
),
),
Text(
'导航',
style: FlutterFlowTheme.of(context)
.bodyMedium
.override(
fontFamily: 'Readex Pro',
// color: Color(0xFF9EA4B7),
color:
const Color(0xFF333333),
fontSize: AppFontsize
.small_text_size,
letterSpacing: 0,
),
),
].divide(const SizedBox(width: 13)),
),
),
)),
Container(
width:
MediaQuery.sizeOf(context).width * 0.22,
height: MediaQuery.sizeOf(context).height *
0.038,
constraints: const BoxConstraints(
maxWidth: 78,
maxHeight: 100,
),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16),
),
child: FFButtonWidget(
onPressed: () {
// if (bookExperienceListController
// .model.bookInfoList[index]
// ["status"] ==
// 2) {
// showCustomConfirmAndCancelDialog(
// context, "取消预约")
// .then((d) {
// if (d == "confirm") {
// bookExperienceListController
// .cancelBook(
// bookExperienceListController
// .model
// .bookInfoList[
// index]["id"],
// success: () {
// var rd = jsonDecode(jsonEncode(
// bookExperienceListController
// .model
// .bookInfoList[index]));
// rd["status"] = -1;
// rd["addressDetail"] =
// data['addressDetail'];
// rd["name"] = data["name"];
// bookExperienceListController
// .messageAdd(rd);
// });
// }
// });
// }
},
text: bookExperienceListController
.model.bookInfoList[index]
["status"] ==
2
? '取消预约'
: bookExperienceListController
.model.bookInfoList[index]
["statusName"],
options: FFButtonOptions(
height: 40,
padding: const EdgeInsetsDirectional
.fromSTEB(13, 0, 13, 0),
iconPadding: const EdgeInsetsDirectional
.fromSTEB(0, 0, 0, 0),
color: bookExperienceListController
.model
.bookInfoList[index]
["status"] ==
2
? const Color(0xFFD3B684)
: stringToColor("#D3D3D3"),
textStyle: FlutterFlowTheme.of(context)
.titleSmall
.override(
fontFamily: 'Readex Pro',
color: Colors.white,
fontSize:
AppFontsize.small_text_size,
letterSpacing: 0,
),
elevation: 0,
borderSide: const BorderSide(
color: Colors.transparent,
width: 1,
),
borderRadius: BorderRadius.circular(32),
),
),
),
].divide(const SizedBox(width: 26)),
)),
),
),
],
),
),
),
),
);
}));
}
}