Browse Source

联盟更新

zyh
w-R 3 years ago
parent
commit
d7637e8550
  1. 8
      lib/home/home_page.dart
  2. 2
      lib/home/home_view/shortcut_operation.dart
  3. 6
      lib/home/home_view/union_entry.dart
  4. 11
      lib/main_page.dart
  5. 6
      lib/order/order_history_page.dart
  6. 4
      lib/order/order_utils.dart
  7. 4
      lib/retrofit/min_api.g.dart
  8. 2
      lib/retrofit/retrofit_api.g.dart
  9. 0
      lib/union/un_page.dart
  10. 393
      lib/union/union_list.dart
  11. 127
      lib/union/union_page.dart

8
lib/home/home_page.dart

@ -487,13 +487,13 @@ class HomePageState extends State<HomePage> with AutomaticKeepAliveClientMixin {
HomeBanner(bannerData, controller), HomeBanner(bannerData, controller),
/// ///
UnionEntry(() { UnionEntry((int jpIndex) {
widget.changeTab(1); widget.changeTab(1,jpIndex);
}), }),
/// ///
ShortcutOperation(() { ShortcutOperation((int jpIndex) {
widget.changeTab(1); widget.changeTab(1,jpIndex);
}), }),
///广 ///广

2
lib/home/home_view/shortcut_operation.dart

@ -37,7 +37,7 @@ class _ShortcutOperation extends State<ShortcutOperation> {
children: [ children: [
Expanded(child:GestureDetector( Expanded(child:GestureDetector(
onTap: (){ onTap: (){
widget.goToOrder(); widget.goToOrder(0);
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,

6
lib/home/home_view/union_entry.dart

@ -37,7 +37,7 @@ class _UnionEntry extends State<UnionEntry> {
children: [ children: [
Expanded(child:GestureDetector( Expanded(child:GestureDetector(
onTap: (){ onTap: (){
widget.goToOrder(); widget.goToOrder(1);
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
@ -80,7 +80,7 @@ class _UnionEntry extends State<UnionEntry> {
) ), ) ),
Expanded(child:GestureDetector( Expanded(child:GestureDetector(
onTap: (){ onTap: (){
widget.goToOrder(); widget.goToOrder(2);
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,
@ -123,7 +123,7 @@ class _UnionEntry extends State<UnionEntry> {
) ), ) ),
Expanded(child: GestureDetector( Expanded(child: GestureDetector(
onTap: (){ onTap: (){
widget.goToOrder(); widget.goToOrder(3);
}, },
child: Container( child: Container(
width: double.infinity, width: double.infinity,

11
lib/main_page.dart

@ -51,6 +51,7 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
List<String> icons; List<String> icons;
final GlobalKey homePageKey = GlobalKey(); final GlobalKey homePageKey = GlobalKey();
final GlobalKey minePageKey = GlobalKey(); final GlobalKey minePageKey = GlobalKey();
final GlobalKey unionPageKey = GlobalKey();
// List<String> iconn; // List<String> iconn;
ApiService apiService; ApiService apiService;
@ -113,13 +114,19 @@ class _MainPage extends State<MainPage> with WidgetsBindingObserver {
_widgetOptions = <Widget>[ _widgetOptions = <Widget>[
// BrandPage(), // BrandPage(),
HomePage(homePageKey,(index) { HomePage(homePageKey,(index,jpIndex) {
if(index == 1){
if(unionPageKey?.currentState != null) {
UnionPageState state = unionPageKey.currentState;
state.jumpIndex(jpIndex);
}else _widgetOptions[1] = UnionPage(unionPageKey,jpIndex);
}
setState(() { setState(() {
pageController.jumpToPage(index); pageController.jumpToPage(index);
}); });
},invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,), },invite:invite,interviewCouponList:interviewCouponList,firstLoginCouponList:firstLoginCouponList,),
// MainHomePage(), // MainHomePage(),
UnionPage(), UnionPage(unionPageKey,0),
// (Theme.of(context).platform == TargetPlatform.android) ? OrderPage() :CommunityPage(), // (Theme.of(context).platform == TargetPlatform.android) ? OrderPage() :CommunityPage(),
CommunityPage(), CommunityPage(),
MinePage(minePageKey), MinePage(minePageKey),

6
lib/order/order_history_page.dart

@ -570,9 +570,9 @@ class _OrderHistoryList extends State<OrderHistoryList>
payChannel, payChannel,
minService, minService,
orderInfo, orderInfo,
() { (BaseData baseData) {
SmartDialog.showToast("订单支付成功"); SmartDialog.showToast(baseData?.msg == "ok" ?"订单支付成功" :baseData?.msg,alignment: Alignment.center);
Future.delayed(Duration(seconds: 1), () { Future.delayed(Duration(seconds: 3), () {
_onRefresh(); _onRefresh();
}); });
}, },

4
lib/order/order_utils.dart

@ -19,7 +19,7 @@ class OrderUtils {
placeOrderFirst.isTakeOut = orderInfo.isTakeOut; placeOrderFirst.isTakeOut = orderInfo.isTakeOut;
placeOrderFirst.notes = orderInfo.notes; placeOrderFirst.notes = orderInfo.notes;
placeOrderFirst.id = orderInfo.id; placeOrderFirst.id = orderInfo.id;
placeOrderFirst.orderProductVOList = orderInfo.orderDetail.orderProductList; placeOrderFirst.orderProductVOList = orderInfo.orderDetail?.orderProductList;
placeOrderFirst.numberOfPeople = "0"; placeOrderFirst.numberOfPeople = "0";
placeOrderFirst.orderSource = orderInfo.orderSource; placeOrderFirst.orderSource = orderInfo.orderSource;
placeOrderFirst.orderType = "${orderInfo.orderType}"; placeOrderFirst.orderType = "${orderInfo.orderType}";
@ -68,7 +68,7 @@ class OrderUtils {
); );
weChatResponseEventHandler.listen((event) async { weChatResponseEventHandler.listen((event) async {
print("payCallback: ${event.errCode}"); print("payCallback: ${event.errCode}");
queryDetails(); queryDetails(null);
}); });
} }
} else { } else {

4
lib/retrofit/min_api.g.dart

@ -330,7 +330,7 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<WxPay>.fromJson( final value = BaseData<WxPay>.fromJson(
_result.data, _result.data,
(json) => WxPay.fromJson(json), (json) => json==null?null:(WxPay.fromJson(json)),
); );
return value; return value;
} }
@ -352,7 +352,7 @@ class _MinApiService implements MinApiService {
data: _data); data: _data);
final value = BaseData<dynamic>.fromJson( final value = BaseData<dynamic>.fromJson(
_result.data, _result.data,
(json) => json as dynamic, (json) => json==null?null:(json as dynamic),
); );
return value; return value;
} }

2
lib/retrofit/retrofit_api.g.dart

@ -1252,7 +1252,7 @@ class _ApiService implements ApiService {
data: _data); data: _data);
final value = BaseData<String>.fromJson( final value = BaseData<String>.fromJson(
_result.data, _result.data,
(json) => json as String, (json) => json==null?null:(json as String),
); );
return value; return value;
} }

0
lib/union/un_page.dart

393
lib/union/union_list.dart

@ -0,0 +1,393 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:huixiang/generated/l10n.dart';
import 'package:huixiang/retrofit/data/store.dart';
import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/view_widget/border_text.dart';
import 'package:huixiang/view_widget/classic_header.dart';
import 'package:huixiang/view_widget/custom_image.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:huixiang/view_widget/request_permission.dart';
import 'package:huixiang/view_widget/round_button.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class UnionList extends StatefulWidget {
final RefreshController refreshController;
final List<Store> storeList;
final Function onRefresh;
UnionList(this.refreshController,this.storeList,this.onRefresh);
@override
State<StatefulWidget> createState() {
return _UnionList();
}
}
class _UnionList extends State<UnionList> {
final TextEditingController editingController = TextEditingController();
@override
Widget build(BuildContext context) {
return Column(
children: [
Container(
height: MediaQuery.of(context).size.height -
103.h -
MediaQuery.of(context).padding.top,
child: SmartRefresher(
controller: widget.refreshController,
enablePullUp: false,
enablePullDown: true,
physics: BouncingScrollPhysics(),
header: MyHeader(),
onRefresh: widget.onRefresh,
child: ListView.builder(
itemCount:widget.storeList == null ? 0 : widget.storeList.length,
padding: EdgeInsets.only(
top: 8.h,
bottom: 84.h, /* + (375.h - 88.h) + 4.h*/
),
physics: NeverScrollableScrollPhysics(),
itemBuilder: (context, position) {
return InkWell(
onTap: () {
if (widget.storeList[position].posType.code == "NORMALSTORE") {
showDeleteDialog();
} else if (widget.storeList[position].posType.code ==
"RETAILSTORE" &&
widget.storeList[position].storeName == "一心回乡商城") {
Navigator.of(context).pushNamed(
'/router/shopping_mall_home',
arguments: {
"type": 0,
"id": widget.storeList[position].id,
"tenant": widget.storeList[position].tenantCode,
"storeName": widget.storeList[position].storeName
},
);
} else {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": widget.storeList[position].id,
"tenant": widget.storeList[position].tenantCode,
"storeName": widget.storeList[position].storeName
},
);
}
},
child: buildStoreItem(widget.storeList[position], position),
);
})),
)
],
);
}
Widget buildSearchItem() {
return Container(
height: 36.h,
margin: EdgeInsets.fromLTRB(6.w, 0, 14.w, 0),
padding: EdgeInsets.fromLTRB(0, 6.h, 0, 6.h),
decoration: BoxDecoration(
color: Color(0xFFF5FAF7),
borderRadius: BorderRadius.circular(4),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(12),
offset: Offset(0, 3),
blurRadius: 14,
spreadRadius: 0,
),
],
),
child: TextField(
textInputAction: TextInputAction.search,
onEditingComplete: () {
// startLocation();
},
controller: editingController,
cursorHeight: 30.h,
decoration: InputDecoration(
contentPadding: EdgeInsets.symmetric(
vertical: 12.h,
),
prefixIcon: Icon(
Icons.search,
size: 24,
color: Colors.black,
),
suffixIcon: InkWell(
onTap: () {
editingController.clear();
},
child: Icon(
Icons.close,
size: 19,
color: Colors.grey,
),
),
border: InputBorder.none,
),
),
);
}
Widget buildStoreItem(Store store, position) {
return Container(
margin: EdgeInsets.fromLTRB(16.w, 8.h, 16.w, 8.h),
// padding: EdgeInsets.fromLTRB(20.w, 20.h, 20.w, 20.h),
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.all(Radius.circular(8)),
boxShadow: [
BoxShadow(
color: Colors.black.withAlpha(25),
offset: Offset(0, 1),
blurRadius: 12,
spreadRadius: 0,
)
]),
width: double.infinity,
height: 228,
child: Stack(
children: [
Positioned(
top: 0,
left: 0,
right: 0,
child: ClipRRect(
child: MImage(
store.facade,
width: double.infinity,
height: 140,
fit: BoxFit.cover,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
borderRadius: BorderRadius.vertical(
top: Radius.circular(4),
),
),
),
Positioned(
bottom: 0,
left: 0,
right: 0,
child: Container(),
),
Positioned(
bottom: 16,
left: 12,
right: 0,
child: Container(
height: 100,
child: Row(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
MImage(
store.logo,
width: 57,
height: 57,
fit: BoxFit.cover,
isCircle: true,
errorSrc: "assets/image/default_1.webp",
fadeSrc: "assets/image/default_1.webp",
),
SizedBox(
width: 6.w,
),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 40.h,
),
Text(
store.storeName,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF0D0D0D),
fontSize: 14.sp,
fontWeight: MyFontWeight.bold,
),
),
SizedBox(
height: 5.h,
),
Text(
"${S.of(context).dizhi}:${store.address}",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: TextStyle(
color: Color(0xFF4D4D4D),
fontSize: 12.sp,
fontWeight: MyFontWeight.regular,
),
),
],
)),
Container(
width: 59.w,
height: 18.h,
alignment: Alignment.center,
margin: EdgeInsets.only(top: 20.h),
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Color(0xFF32A060),
),
child: Visibility(
child: Text(
(store.distance ?? 0) > 1000
? S.of(context).gongli(
((store.distance ?? 0) / 1000 * 100).toInt() /
100.0)
: S.of(context).mi(
((store.distance ?? 0) * 100).toInt() / 100.0),
style: TextStyle(
color: Color(0xFFFFFFFF),
fontSize: 10.sp,
),
),
visible: store.distance != null,
),
),
],
),
),
),
],
),
);
}
///
showDeleteDialog() {
showDialog(
context: context,
builder: (context) {
return AlertDialog(
content: Container(
width: MediaQuery.of(context).size.width - 84,
height: 130.h,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"您即将进行扫码点餐",
style: TextStyle(
fontSize: 17.sp,
fontWeight: FontWeight.bold,
color: Colors.black,
),
),
SizedBox(
height: 30.h,
),
Row(
children: [
Expanded(
child: InkWell(
child: BorderText(
text: "取消",
textColor: Color(0xFF32A060),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
borderColor: Color(0xFF32A060),
radius: 4,
padding: EdgeInsets.all(12),
borderWidth: 1,
),
onTap: () {
Navigator.of(context).pop();
},
),
flex: 1,
),
SizedBox(
width: 16.w,
),
Expanded(
child: InkWell(
child: RoundButton(
text: "确定",
textColor: Colors.white,
radius: 4,
padding: EdgeInsets.all(12),
backgroup: Color(0xFF32A060),
fontSize: 16.sp,
fontWeight: FontWeight.bold,
),
onTap: () {
toScan();
Navigator.of(context).pop();
},
),
flex: 1,
),
],
)
],
),
),
);
},
);
}
///
toScan() async {
if (await Permission.camera.isPermanentlyDenied) {
showCupertinoDialog(
context: context,
builder: (context) {
return RequestPermission(
"assets/image/icon_camera_permission_tips.webp",
S.of(context).ninxiangjiquanxianweikaiqi,
S.of(context).weilekaipaizhaoxuanzhetouxiang,
S.of(context).kaiqiquanxian,
(result) async {
if (result) {
await openAppSettings();
}
},
heightRatioWithWidth: 0.82,
);
});
} else if (await Permission.camera.isGranted) {
// http://pos.app.gznl.top/placeorder/?tableId=1315903669597634560&tenantCode=1166&shopId=1300372027722432512
var result = await Navigator.of(context).pushNamed('/router/qr_scan');
// String result = await scanner.scan();
Uri uri = Uri.parse(result);
String tableId = uri.queryParameters["tableId"];
String tenantCode = uri.queryParameters["tenantCode"];
String shopId = uri.queryParameters["shopId"];
if (tableId != null &&
tableId != "" &&
tenantCode != null &&
tenantCode != "" &&
shopId != null &&
shopId != "") {
Navigator.of(context).pushNamed(
'/router/store_order',
arguments: {
"id": shopId,
"tenant": tenantCode,
"storeName": "",
"tableId": int.tryParse(tableId),
},
);
}
} else {
await Permission.camera.request();
}
}
}

127
lib/union/union_page.dart

@ -12,6 +12,7 @@ import 'package:huixiang/main.dart';
import 'package:huixiang/retrofit/data/base_data.dart'; import 'package:huixiang/retrofit/data/base_data.dart';
import 'package:huixiang/retrofit/data/store.dart'; import 'package:huixiang/retrofit/data/store.dart';
import 'package:huixiang/retrofit/retrofit_api.dart'; import 'package:huixiang/retrofit/retrofit_api.dart';
import 'package:huixiang/union/union_list.dart';
import 'package:huixiang/utils/event_type.dart'; import 'package:huixiang/utils/event_type.dart';
import 'package:huixiang/utils/font_weight.dart'; import 'package:huixiang/utils/font_weight.dart';
import 'package:huixiang/utils/location.dart'; import 'package:huixiang/utils/location.dart';
@ -30,14 +31,20 @@ import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart'; import 'package:flutter_baidu_mapapi_base/flutter_baidu_mapapi_base.dart';
class UnionPage extends StatefulWidget { class UnionPage extends StatefulWidget {
final int initialIndex;
UnionPage(Key key,this.initialIndex): super(key: key);
@override @override
State<StatefulWidget> createState() { State<StatefulWidget> createState() {
return _UnionPage(); return UnionPageState();
} }
} }
class _UnionPage extends State<UnionPage> class UnionPageState extends State<UnionPage>
with AutomaticKeepAliveClientMixin, WidgetsBindingObserver,SingleTickerProviderStateMixin { with
AutomaticKeepAliveClientMixin,
WidgetsBindingObserver,
SingleTickerProviderStateMixin {
final RefreshController refreshController = final RefreshController refreshController =
RefreshController(initialRefresh: false); RefreshController(initialRefresh: false);
final RefreshController refreshController1 = final RefreshController refreshController1 =
@ -50,7 +57,9 @@ class _UnionPage extends State<UnionPage>
bool isKeyBoardShow = false; bool isKeyBoardShow = false;
BMFCoordinate latLng; BMFCoordinate latLng;
jumpIndex(jpIndex){
tabController.index = jpIndex;
}
@override @override
void dispose() { void dispose() {
@ -61,6 +70,9 @@ class _UnionPage extends State<UnionPage>
Location.getInstance().aMapFlutterLocation.stopLocation(); Location.getInstance().aMapFlutterLocation.stopLocation();
if (refreshController != null) refreshController.dispose(); if (refreshController != null) refreshController.dispose();
if (refreshController1 != null) refreshController1.dispose();
if (refreshController2 != null) refreshController2.dispose();
if (refreshController3 != null) refreshController3.dispose();
} }
@override @override
@ -86,10 +98,10 @@ class _UnionPage extends State<UnionPage>
void initState() { void initState() {
super.initState(); super.initState();
if (tabController == null) if (tabController == null)
tabController = TabController(length: 4, vsync: this); tabController = TabController(length: 4, vsync: this,initialIndex: widget.initialIndex);
tabController?.addListener(() { // tabController?.addListener(() {
startLocation(); // startLocation();
}); // });
WidgetsBinding.instance.addObserver(this); WidgetsBinding.instance.addObserver(this);
eventBus.on<EventType>().listen((event) { eventBus.on<EventType>().listen((event) {
@ -98,12 +110,21 @@ class _UnionPage extends State<UnionPage>
} }
}); });
getLatLng(); startLocation(false);
startLocation(); }
RefreshController tabRefresh(){
RefreshController tempRef;
if (tabController.index == 0) tempRef = refreshController;
else if (tabController.index == 1) tempRef = refreshController1;
else if (tabController.index == 2) tempRef = refreshController2;
else if (tabController.index == 3) tempRef = refreshController3;
return tempRef;
} }
startLocation() async { startLocation(bool isOnRefresh) async {
// EasyLoading.show(status: S.current.zhengzaijiazai); if(!isOnRefresh)
EasyLoading.show(status: S.current.zhengzaijiazai);
Location.getInstance() Location.getInstance()
.aMapFlutterLocation .aMapFlutterLocation
.onResultCallback() .onResultCallback()
@ -135,7 +156,7 @@ class _UnionPage extends State<UnionPage>
event["province"], event["province"],
event["city"], event["city"],
event["district"], event["district"],
editingController.text); editingController.text,-1);
if (_mapController != null) if (_mapController != null)
_mapController.updateMapOptions(BMFMapOptions( _mapController.updateMapOptions(BMFMapOptions(
center: value, center: value,
@ -143,7 +164,8 @@ class _UnionPage extends State<UnionPage>
)); ));
}); });
} else { } else {
EasyLoading.dismiss(); getLatLng();
// EasyLoading.dismiss();
} }
}); });
@ -151,7 +173,7 @@ class _UnionPage extends State<UnionPage>
Location.getInstance().startLocation(context).then((value) { Location.getInstance().startLocation(context).then((value) {
if (!value) { if (!value) {
EasyLoading.dismiss(); EasyLoading.dismiss();
refreshController.refreshFailed(); tabRefresh().refreshFailed();
} }
}); });
} }
@ -168,10 +190,10 @@ class _UnionPage extends State<UnionPage>
getLatLng() async { getLatLng() async {
SharedPreferences.getInstance().then( SharedPreferences.getInstance().then(
(value) => { (value) => {
apiService = ApiService(Dio(), // apiService = ApiService(Dio(),
context: context, // context: context,
token: value.getString('token'), // token: value.getString('token'),
showLoading: false), // showLoading: false),
if (value.containsKey("latitude") && if (value.containsKey("latitude") &&
value.containsKey("longitude") && value.containsKey("longitude") &&
value.containsKey("province") && value.containsKey("province") &&
@ -186,8 +208,7 @@ class _UnionPage extends State<UnionPage>
value.getString("province"), value.getString("province"),
value.getString("city"), value.getString("city"),
value.getString("district"), value.getString("district"),
editingController.text editingController.text,-1),
),
setState(() { setState(() {
if (_mapController != null) { if (_mapController != null) {
_mapController.updateMapOptions(BMFMapOptions( _mapController.updateMapOptions(BMFMapOptions(
@ -199,15 +220,26 @@ class _UnionPage extends State<UnionPage>
} }
else else
{ {
queryStore("", "", "", "", "", editingController.text), queryStore("", "", "", "", "", editingController.text,-1),
} }
}, },
); );
} }
List<Store> storeList; List<Store> storeList;
List<Store> storeList1;
List<Store> storeList2;
List<Store> storeList3;
queryStore(latitude, longitude, province, city, district, searchKey) async { queryStore(latitude, longitude, province, city, district, searchKey,int index) async {
if (apiService == null) {
SharedPreferences value = await SharedPreferences.getInstance();
apiService = ApiService(
Dio(),
context: context,
token: value.getString("token"),
);
}
BaseData<List<Store>> baseData = await apiService.queryStore({ BaseData<List<Store>> baseData = await apiService.queryStore({
"city": city, "city": city,
"district": district, "district": district,
@ -215,19 +247,40 @@ class _UnionPage extends State<UnionPage>
"latitude": latitude, "latitude": latitude,
"longitude": longitude, "longitude": longitude,
"searchKey": searchKey, "searchKey": searchKey,
"serviceType":tabController.index == 0 ?"":(tabController.index==1?"EATSTORE":(tabController.index == 2?"DRINKSTORE":"HAPPYSTORE")), "serviceType": (tabController.index == 0 && index == -1) || index == 0
? ""
: ((tabController.index == 1 && index == -1) || index == 1
? "EATSTORE"
: ((tabController.index == 2 && index == -1) || index == 2 ? "DRINKSTORE" : "HAPPYSTORE")),
}).catchError((error) { }).catchError((error) {
refreshController.refreshFailed(); if(index == -1)
tabRefresh().refreshFailed();
}); });
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
storeList = baseData.data; if(index == -1 && storeList == null){
refreshController.refreshCompleted(); if (tabController.index != 0)
queryStore(latitude, longitude, province, city, district, searchKey,0);
if (tabController.index != 1)
queryStore(latitude, longitude, province, city, district, searchKey,1);
if (tabController.index != 2)
queryStore(latitude, longitude, province, city, district, searchKey,2);
if (tabController.index != 3)
queryStore(latitude, longitude, province, city, district, searchKey,3);
}
if ((tabController.index == 0 && index == -1) || index == 0) storeList = baseData.data;
else if ((tabController.index == 1 && index == -1) || index == 1) storeList1 = baseData.data;
else if ((tabController.index == 2 && index == -1) || index == 2) storeList2 = baseData.data;
else if ((tabController.index == 3 && index == -1) || index == 3) storeList3 = baseData.data;
if(index == -1)
tabRefresh().refreshCompleted();
} else { } else {
refreshController.refreshFailed(); if(index == -1)
tabRefresh().refreshFailed();
} }
EasyLoading.dismiss(); EasyLoading.dismiss();
setState(() {}); setState(() {});
} }
TabController tabController; TabController tabController;
@override @override
@ -270,10 +323,10 @@ class _UnionPage extends State<UnionPage>
body: TabBarView( body: TabBarView(
controller: tabController, controller: tabController,
children: [ children: [
buildItem(refreshController), UnionList(refreshController, storeList,(){startLocation(true);}),
buildItem(refreshController1), UnionList(refreshController1, storeList1,(){startLocation(true);}),
buildItem(refreshController2), UnionList(refreshController2, storeList2,(){startLocation(true);}),
buildItem(refreshController3), UnionList(refreshController3, storeList3,(){startLocation(true);}),
], ],
), ),
); );
@ -359,7 +412,9 @@ class _UnionPage extends State<UnionPage>
// ); // );
} }
Widget buildItem(RefreshController refreshController,) { Widget buildItem(
RefreshController refreshController,
) {
return Column( return Column(
children: [ children: [
buildSearchItem(), buildSearchItem(),
@ -374,7 +429,7 @@ class _UnionPage extends State<UnionPage>
physics: BouncingScrollPhysics(), physics: BouncingScrollPhysics(),
header: MyHeader(), header: MyHeader(),
onRefresh: () { onRefresh: () {
startLocation(); startLocation(false);
}, },
child: ListView.builder( child: ListView.builder(
itemCount: storeList == null ? 0 : storeList.length, itemCount: storeList == null ? 0 : storeList.length,
@ -419,8 +474,6 @@ class _UnionPage extends State<UnionPage>
); );
} }
BMFMapController _mapController; BMFMapController _mapController;
final TextEditingController editingController = TextEditingController(); final TextEditingController editingController = TextEditingController();
@ -448,7 +501,7 @@ class _UnionPage extends State<UnionPage>
child: TextField( child: TextField(
textInputAction: TextInputAction.search, textInputAction: TextInputAction.search,
onEditingComplete: () { onEditingComplete: () {
startLocation(); startLocation(false);
}, },
controller: editingController, controller: editingController,
cursorHeight: 30.h, cursorHeight: 30.h,

Loading…
Cancel
Save