import 'dart:async'; import 'package:ef/ef.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/svg.dart'; import 'package:flutterflow_ui/flutterflow_ui.dart'; import 'package:vbvs_app/common/color/appColors.dart'; import 'package:vbvs_app/common/color/appConstants.dart'; import 'package:vbvs_app/common/color/appFontsize.dart'; import 'package:vbvs_app/common/util/FitTool.dart'; import 'package:vbvs_app/common/util/MyUtils.dart'; import 'package:vbvs_app/component/NullDataComponentWidget.dart'; import 'package:vbvs_app/component/tool/ClickableContainer.dart'; import 'package:vbvs_app/controller/mh_controller/experience_store_list_page.dart'; import 'package:vbvs_app/controller/weather/weather_controller.dart'; import 'package:vbvs_app/pages/mh_page/Empty.dart'; import 'package:vbvs_app/pages/mh_page/experience_store_widget.dart'; import 'package:vbvs_app/pages/mh_page/searchWidget.dart'; class ExperienceStorePage extends StatefulWidget { ExperienceStorePage({super.key}); @override State createState() => _ExperienceStorePageState(); } class _ExperienceStorePageState extends State { final scaffoldKey = GlobalKey(); BoxConstraints? bodysize; ScrollController scrollController = ScrollController(); ExperienceStoreListController controller = Get.find(); WeatherModelController weatherModelController = Get.find(); int runTime = 0; @override void initState() { // TODO: implement initState super.initState(); Timer(Duration(milliseconds: 100), () async { controller.resetParm(); await weatherModelController.determinePosition(); controller.page = 0; controller.getData(); scrollController.addListener(() { int ctime = DateTime.now().millisecondsSinceEpoch; if (ctime - runTime > 100 && scrollController.position.pixels + 80 > scrollController.position.maxScrollExtent) { runTime = ctime; print( "bottom get more data ${scrollController.position.pixels} ${scrollController.position.maxScrollExtent}"); controller.getData(); } }); }); } @override Widget build(BuildContext context) { return LayoutBuilder(builder: (context, cc) { // controller.model.experienceStoreModelList = [ // { // "id": "5b82d1d9c33c74647e7624ec1db7918f", // "enabled": true, // "code": "3401002", // "name": "SWES眠花糖合肥省委大院体验店", // "customerId": null, // "setNetCustomerKid": null, // "customer": null, // "kingdeeId": "", // "channel": null, // "salePersonId": "ed648f977422a9f32a05b4892a3cb529", // "salePerson": null, // "deptId": 3, // "deptName": null, // "dept": null, // "introduction": "", // "mobile": "18156022846", // "hotline": "0551-64464894", // "city": "合肥市", // "district": "庐阳区", // "addressDetail": "合肥市庐阳区逍遥津街道南含山路与红星路交汇处", // "image": "", // "latitude": "31.858934", // "longitude": "117.282166", // "isDel": false, // "isAppShow": true, // "business": true, // "authEndTime": null, // "createTime": 1701133326000, // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", // "updateTime": 1709193588000, // "updateAdminId": null, // "distance": 2.2 // }, // { // "id": "97603deebb83f610f73acf5d0def2bce", // "enabled": true, // "code": "3401003", // "name": "SWES眠花糖合肥安粮国贸体验店", // "customerId": null, // "setNetCustomerKid": null, // "customer": null, // "kingdeeId": "", // "channel": null, // "salePersonId": "69297c65588adde4ee5de3c43a2c4033", // "salePerson": null, // "deptId": 3, // "deptName": null, // "dept": null, // "introduction": "", // "mobile": "18655643429", // "hotline": "0551-65156985", // "city": "合肥市", // "district": "政务新区", // "addressDetail": "安徽省合肥市蜀山区合作化南路16号", // "image": "", // "latitude": "31.82018", // "longitude": "117.25367", // "isDel": false, // "isAppShow": true, // "business": true, // "authEndTime": null, // "createTime": 1701133473000, // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", // "updateTime": 1709193752000, // "updateAdminId": null, // "distance": 3.5 // }, // { // "id": "b6b588d7ff6b248115ee3e5951cf39a1", // "enabled": true, // "code": "3301001", // "name": "SWES眠花糖杭州南星桥旗舰店", // "customerId": null, // "setNetCustomerKid": null, // "customer": null, // "kingdeeId": "", // "channel": null, // "salePersonId": "f3a5e7935f65e94bc5aa6b2d63211e61", // "salePerson": null, // "deptId": 33, // "deptName": null, // "dept": null, // "introduction": "", // "mobile": "15222919097", // "hotline": "0571-86718606", // "city": "杭州市", // "district": "上城区", // "addressDetail": "浙江省杭州市上城区飞云江路45号一层102室", // "image": "", // "latitude": "30.21667", // "longitude": "120.17757", // "isDel": false, // "isAppShow": true, // "business": true, // "authEndTime": null, // "createTime": 1701135379000, // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", // "updateTime": 1709194185000, // "updateAdminId": null, // "distance": 332.1 // }, // { // "id": "38fdbb715dc7bfddae3e32685c288e49", // "enabled": true, // "code": "3102001", // "name": "SWES眠花糖上海复兴荟旗舰店", // "customerId": null, // "setNetCustomerKid": null, // "customer": null, // "kingdeeId": "", // "channel": null, // "salePersonId": "4ae944badb423197bc54c0a6ec252944", // "salePerson": null, // "deptId": 32, // "deptName": null, // "dept": null, // "introduction": "", // "mobile": "13053037959", // "hotline": "021-63391962", // "city": "上海市", // "district": "黄浦区", // "addressDetail": "上海市黄浦区复兴东路1108号1层-1室", // "image": "", // "latitude": "31.22209", // "longitude": "121.494667", // "isDel": false, // "isAppShow": true, // "business": true, // "authEndTime": null, // "createTime": 1701135192000, // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", // "updateTime": 1709194151000, // "updateAdminId": null, // "distance": 407.3 // }, // { // "id": "af908e6c5d1a2c8113b1c73117e15064", // "enabled": true, // "code": "3101001", // "name": "SWES眠花糖上海外滩九里体验店", // "customerId": null, // "setNetCustomerKid": null, // "customer": null, // "kingdeeId": "", // "channel": null, // "salePersonId": "1794f729f27ad4a44afad10061446dd5", // "salePerson": null, // "deptId": 31, // "deptName": null, // "dept": null, // "introduction": "", // "mobile": "13856414205", // "hotline": "021-63391208", // "city": "上海市", // "district": "黄浦区", // "addressDetail": "上海市黄浦区紫霞路103-107号1层103-12室", // "image": "", // "latitude": "31.218434", // "longitude": "121.502098", // "isDel": false, // "isAppShow": true, // "business": true, // "authEndTime": null, // "createTime": 1701134886000, // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", // "updateTime": 1709194053000, // "updateAdminId": null, // "distance": 408.1 // }, // { // "id": "a5f1fc9a03ba827841c473e28a3fcdb2", // "enabled": true, // "code": "3101002", // "name": "SWES眠花糖上海尚悦湾旗舰店", // "customerId": null, // "setNetCustomerKid": null, // "customer": null, // "kingdeeId": "", // "channel": null, // "salePersonId": "d97ec48ee3b1060eb7ff5c81f0ffa37f", // "salePerson": null, // "deptId": 31, // "deptName": null, // "dept": null, // "introduction": "", // "mobile": "19523660595", // "hotline": "021-63336707", // "city": "上海市", // "district": "浦东新区", // "addressDetail": "上海市浦东新区银城路66号", // "image": "", // "latitude": "31.24103", // "longitude": "121.51045", // "isDel": false, // "isAppShow": true, // "business": true, // "authEndTime": null, // "createTime": 1701135694000, // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", // "updateTime": 1709194087000, // "updateAdminId": null, // "distance": 408.4 // }, // { // "id": "21ddfb547060e930f841605dc4469bec", // "enabled": true, // "code": "1101001", // "name": "SWES眠花糖北京富力城旗舰店", // "customerId": null, // "setNetCustomerKid": null, // "customer": null, // "kingdeeId": "", // "channel": null, // "salePersonId": "b66028a628ce0fcb871ab7db5c17128e", // "salePerson": null, // "deptId": 11, // "deptName": null, // "dept": null, // "introduction": "", // "mobile": "15556119960", // "hotline": "010-58766288", // "city": "北京市", // "district": "朝阳区", // "addressDetail": "北京市朝阳区天力街3号楼1至2层商业12号", // "image": "", // "latitude": "39.89862", // "longitude": "116.45851", // "isDel": false, // "isAppShow": false, // "business": true, // "authEndTime": null, // "createTime": 1701134049000, // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", // "updateTime": 1733193484000, // "updateAdminId": null, // "distance": 897.7 // }, // { // "id": "432bfdf508115827c5dca474b72dea68", // "enabled": true, // "code": "1102001", // "name": "SWES眠花糖北京英皇中心旗舰店", // "customerId": null, // "setNetCustomerKid": null, // "customer": null, // "kingdeeId": "", // "channel": null, // "salePersonId": "155848302d5b6f2768111574f0161816", // "salePerson": null, // "deptId": 12, // "deptName": null, // "dept": null, // "introduction": "", // "mobile": "18225602774", // "hotline": "010-53269059", // "city": "北京市", // "district": "朝阳区", // "addressDetail": "北京市朝阳区建国门外大街丁12号", // "image": "", // "latitude": "39.907911", // "longitude": "116.444584", // "isDel": false, // "isAppShow": true, // "business": true, // "authEndTime": null, // "createTime": 1701134158000, // "createAdminId": "f6da6faa2d50e7eff7b54bcdd55b0283", // "updateTime": 1710490644000, // "updateAdminId": null, // "distance": 898.9 // } // ]; bodysize = cc; return GestureDetector( onTap: () => FocusScope.of(context).unfocus(), child: Container( decoration: const BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/new_background.png'), // 本地图片 fit: BoxFit.fill, // 填满整个 Container ), ), child: Scaffold( // key: scaffoldKey, backgroundColor: Colors.transparent, appBar: AppBar( backgroundColor: Colors.transparent, automaticallyImplyLeading: false, iconTheme: IconThemeData(color: Colors.white), titleSpacing: 0, title: SizedBox( width: double.infinity, height: 180.rpx, child: Stack( alignment: Alignment.center, children: [ // 中间居中的标题 Text( '预约体验', textAlign: TextAlign.center, style: TextStyle( color: Colors.white, fontSize: 30.rpx, ), ), // 左侧图标 Positioned( left: 20.rpx, child: returnIconButtomNew, ), Positioned( right: 30.rpx, child: ClickableContainer( backgroundColor: Colors.transparent, highlightColor: Color(0xFF055466), padding: EdgeInsets.only(left: 0), onTap: () { Get.toNamed("/myExperiencePage"); }, child: SvgPicture.asset( 'assets/img/icon/history_store.svg', width: 35.rpx, height: 35.rpx, color: Colors.white, ))) ], ), ), centerTitle: false, ), body: SingleChildScrollView( child: Container( width: bodysize!.maxWidth, height: bodysize!.maxHeight * 1, child: Column( mainAxisSize: MainAxisSize.max, children: [ //todo Padding( padding: EdgeInsetsDirectional.fromSTEB( 0, 40.rpx, 0, 38.rpx), child: SearchWidget( keyword: controller.model.keyword, color: controller.model.color, hint: "请输入门店名称", onChange: (d) { controller.model.keyword = d; }, findCallback: () { // controller.page = 0; // controller.getData(); }, ), ), Obx(() { if (controller .model.experienceStoreModelList.length == 0) { return Empty(); } else { return Container(); } }), Expanded( child: Obx(() => ListView( controller: scrollController, shrinkWrap: true, scrollDirection: Axis.vertical, children: List.generate( controller .model .experienceStoreModelList .length, (index) { return ExperienceStoreWidget( index: index, data: controller.model .experienceStoreModelList[index]); }) .divide(const SizedBox( height: 25, )) .addToStart(SizedBox( height: AppConstants.list_start_height, )) .addToEnd(SizedBox( height: AppConstants.list_ano_end_height, ))))), ], ), ), )), )); }); } }