Browse Source

门店设置成功刷新数据

wr_2023_business
wurong 1 year ago
parent
commit
67a4ad30a8
  1. 22
      lib/business_system/mine/business_mine_page.dart

22
lib/business_system/mine/business_mine_page.dart

@ -8,6 +8,7 @@ import 'package:huixiang/view_widget/custom_image.dart';
import 'package:huixiang/view_widget/my_footer.dart'; import 'package:huixiang/view_widget/my_footer.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart'; import 'package:pull_to_refresh/pull_to_refresh.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:visibility_detector/visibility_detector.dart';
import '../../generated/l10n.dart'; import '../../generated/l10n.dart';
import '../../retrofit/business_api.dart'; import '../../retrofit/business_api.dart';
@ -35,11 +36,11 @@ class _BusinessMinePage extends State<BusinessMinePage>
final RefreshController refreshController = RefreshController(); final RefreshController refreshController = RefreshController();
BusinessApiService businessService; BusinessApiService businessService;
List<Records> records = []; List<Records> records = [];
double visiblePercentage;
@override @override
void initState() { void initState() {
super.initState(); super.initState();
queryStoreList();
} }
@override @override
@ -50,9 +51,9 @@ class _BusinessMinePage extends State<BusinessMinePage>
/// ///
queryStoreList() async { queryStoreList() async {
EasyLoading.show( // EasyLoading.show(
status: S.current.zhengzaijiazai, // status: S.current.zhengzaijiazai,
maskType: EasyLoadingMaskType.black); // maskType: EasyLoadingMaskType.black);
if (businessService == null) { if (businessService == null) {
businessService = BusinessApiService(Dio(), businessService = BusinessApiService(Dio(),
context: context, context: context,
@ -71,7 +72,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
if (baseData != null && baseData.isSuccess) { if (baseData != null && baseData.isSuccess) {
records = baseData.data.records ?? []; records = baseData.data.records ?? [];
refreshController.refreshCompleted(); refreshController.refreshCompleted();
EasyLoading.dismiss(); // EasyLoading.dismiss();
} else { } else {
SmartDialog.showToast(baseData.msg, alignment: Alignment.center); SmartDialog.showToast(baseData.msg, alignment: Alignment.center);
} }
@ -80,7 +81,14 @@ class _BusinessMinePage extends State<BusinessMinePage>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
super.build(context); super.build(context);
return Column( return VisibilityDetector(
key: Key('my-widget-key'),
onVisibilityChanged: (visibilityInfo) {
visiblePercentage = visibilityInfo.visibleFraction;
if(visiblePercentage == 1)
queryStoreList();
},
child: Column(
children: [ children: [
Expanded( Expanded(
child: Container( child: Container(
@ -132,7 +140,7 @@ class _BusinessMinePage extends State<BusinessMinePage>
height: 76.h, height: 76.h,
), ),
], ],
); ));
} }
Widget mineInfo() { Widget mineInfo() {

Loading…
Cancel
Save