Commit 11a4f46c authored by 林生雨's avatar 林生雨

commit

parent 44fc10b9
......@@ -125,7 +125,9 @@ class LevelOneState extends BaseState<LevelOnePage>
_model.init(() {
_initTabBar();
});
})));
},paddingTop: stateBarHeight+kToolbarHeight)
)
);
}
Widget newHomeWarp() {
......
......@@ -130,7 +130,9 @@ class LevelTwoState extends BaseState<LevelTwoPage>
_model.init(() {
_initTabBar();
});
})));
},
paddingTop: MediaQueryData.fromWindow(window).padding.top +
kToolbarHeight)));
}
Widget newHomeWarp() {
......
/*
* @author lsy
* @date 2020/7/8
**/
import 'package:flutter/cupertino.dart';
class PlanList extends StatefulWidget{
@override
State<StatefulWidget> createState() =>PlanListState();
}
class PlanListState extends State<PlanList>{
@override
void initState() {
// TODO: implement initState
super.initState();
}
@override
void dispose() {
super.dispose();
}
@override
Widget build(BuildContext context) {
}
}
\ No newline at end of file
......@@ -40,10 +40,11 @@ class PlanModel extends BaseModel {
String min_price = "";
String max_price = "";
String rank_type = "";
int page = 1;
int sortPos = 0;
void init() {
void init({VoidCallback call}) {
ClueApiImpl.getInstance()
.getPlan(DioUtil.getInstance().getDio())
.listen((event) {
......@@ -52,6 +53,9 @@ class PlanModel extends BaseModel {
sortList = event.data.orders;
picLive.notifyView(event.data.ranks);
stateLive.notifyView(ENDLOADING);
if (call != null) {
call();
}
refreshFeed(true);
} else {
stateLive.notifyView(FAIL);
......@@ -77,6 +81,7 @@ class PlanModel extends BaseModel {
void refreshFeed(bool clear, {RefreshController controller}) {
if (clear) {
page = 1;
feedDatas.clear();
}
ClueApiImpl.getInstance()
......@@ -85,7 +90,11 @@ class PlanModel extends BaseModel {
.listen((event) {
if (event.error == 0) {
if (event.data.plans == null || event.data.plans.isEmpty) {
if(page==1){
feedsLive.notifyView(Pair(EMPTY, []));
}else{
feedsLive.notifyView(Pair(ENDLOADING, []));
}
} else {
feedDatas.addAll(event.data.plans);
feedsLive.notifyView(Pair(ENDLOADING, feedDatas));
......@@ -134,6 +143,7 @@ class PlanModel extends BaseModel {
}
sortPos = index;
order_by = sortList[index].id.toString();
feedsLive.notifyView(Pair(LOADING, null));
refreshFeed(true);
}
......@@ -143,6 +153,7 @@ class PlanModel extends BaseModel {
}
max_price = max.toString();
min_price = min.toString();
feedsLive.notifyView(Pair(LOADING, null));
refreshFeed(true);
}
}
......@@ -2,6 +2,7 @@
* @author lsy
* @date 2020/6/30
**/
import 'dart:async';
import 'dart:io';
import 'dart:math';
import 'dart:ui';
......@@ -9,6 +10,7 @@ import 'dart:ui';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/ClueModel/page/common/StickyTabBarDelegate.dart';
import 'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoPage.dart';
import 'package:gm_flutter/ClueModel/page/plan/FilterView.dart';
import 'package:gm_flutter/ClueModel/page/plan/PlanBar.dart';
......@@ -27,6 +29,7 @@ import 'package:gm_flutter/commonModel/popMenu/BaseMenuListener.dart';
import 'package:gm_flutter/commonModel/popMenu/BasePopMenu.dart';
import 'package:gm_flutter/commonModel/util/DartUtil.dart';
import 'package:gm_flutter/commonModel/util/WidgetUtil.dart';
import 'package:gm_flutter/commonModel/view/baseRefreshIndicator.dart';
import 'package:gm_flutter/main.mark.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
......@@ -96,17 +99,13 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Column(
children: <Widget>[
head(),
Expanded(
child: Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height:
MediaQuery.of(context).size.height - topHeight,
child: child(),
height: MediaQuery.of(context).size.height,
// child: child(),
child: homeWarp(),
),
StreamBuilder<List<double>>(
stream: _model.backLive.stream,
......@@ -133,20 +132,20 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
child: Row(
children: <Widget>[
Expanded(
child: Container()
.gestureDetector(() {
child:
Container().gestureDetector(() {
clickIndexOther(0);
}),
),
Expanded(
child: Container()
.gestureDetector(() {
child:
Container().gestureDetector(() {
clickIndexOther(1);
}),
),
Expanded(
child: Container()
.gestureDetector(() {
child:
Container().gestureDetector(() {
clickIndexOther(2);
}),
),
......@@ -161,8 +160,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
0,
0),
).gestureDetector(() {
hideAllMenuListener
.notifyListeners();
hideAllMenuListener.notifyListeners();
}),
)
],
......@@ -200,8 +198,8 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
width: MediaQuery.of(context).size.width,
maxHeight: 272,
listener: sortMenuListener,
child: SortView(_model.sortList, _model.sortPos,
(index) {
child:
SortView(_model.sortList, _model.sortPos, (index) {
clickIndexOther(1);
_model.sortClick(index);
}),
......@@ -245,9 +243,6 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
)
],
),
)
],
),
),
StreamBuilder(
stream: _model.stateLive.stream,
......@@ -263,14 +258,11 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
} else if (data.data == FAIL) {
return Container(
color: Colors.white,
child: errorItem(
MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height,
() {
child: errorItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height, () {
_model.stateLive.notifyView(LOADING);
_model.init();
},
),
}, paddingTop: stateBarHeight + kToolbarHeight),
);
} else {
return Container(
......@@ -344,15 +336,71 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
);
}
Widget child() {
return NotificationListener(
onNotification: (scrollNotification) {
if (scrollNotification is ScrollUpdateNotification &&
scrollNotification.metrics.axisDirection.index == 2) {
_onScroll(scrollNotification.metrics.pixels);
Widget homeWarp() {
return BaseNestedScrollViewRefreshIndicator(
onRefresh: () async {
Completer completer = new Completer();
_model.init(call: () {
completer.complete();
});
return completer.future;
},
child: home());
}
return false;
Widget home() {
return NestedScrollView(
headerSliverBuilder: (BuildContext context, bool innerBoxIsScrolled) {
return <Widget>[
SliverOverlapAbsorber(
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: baseSliverAppBar(null,
height: kToolbarHeight + stateBarHeight, needpic: false)),
SliverList(
delegate: SliverChildBuilderDelegate((BuildContext c, int i) {
if (i == 0) {
return Container(
height: kToolbarHeight,
);
}
return towPic();
}, childCount: 2)),
SliverPersistentHeader(
pinned: true,
delegate: StickyTabBarDelegate(child: planBar()),
)
];
},
body: child());
}
Widget child() {
return StreamBuilder<Pair<int, List<Plans>>>(
stream: _model.feedsLive.stream,
initialData: _model.feedsLive.data ?? Pair(LOADING, null),
builder: (c, data) {
if (data.data.first == FAIL) {
return errorItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height, () {
_model.feedsLive.notifyView(Pair(LOADING, null));
_model.refreshFeed(true);
});
}
if (data.data.first == LOADING) {
return Container(
color: Colors.white,
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: loadingItem(),
);
}
if (data.data.first == EMPTY) {
return emptyItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height);
}
return Container(
color: Color(0xffF7F6FA),
child: baseRefreshView(
refreshController,
() {
......@@ -365,15 +413,25 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
return planList[index];
if (data.data.second.length == 0) {
if (_model.page != 1) {
refreshController.loadNoData();
}
} else {
refreshController.loadComplete();
}
return PlanItem(_model.feedDatas[index]);
},
childCount: planList.length,
childCount: _model.feedDatas.length,
),
),
onLoading: () {
_model.loadMore();
},
pullDown: false,
pullUp: true));
},
);
}
Widget towPic() {
......@@ -436,6 +494,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
Widget planBar() {
return Container(
color: Colors.white,
key: globalKey,
child: planBarView,
);
......@@ -457,7 +516,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
double bottom =
// WidgetUtil.buttonLeftMenuPosition(globalKey.currentContext)?.top ??
topPos == null ? 0.0 : topPos.dy + 45 - topHeight;
topPos == null ? 0.0 : topPos.dy + 45;
if (bottom < 45) {
bottom = 45;
}
......
......@@ -43,6 +43,7 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
@override
void initState() {
// DioUtil.getInstance().setProxy("172.30.8.245");
_model.rank_type = widget.rank_type;
init();
super.initState();
......@@ -94,7 +95,9 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
child: homeWarp()),
), () {
init();
}),
},
paddingTop:
MediaQueryData.fromWindow(window).padding.top + kToolbarHeight),
);
}
......
......@@ -57,7 +57,7 @@ class Data {
tags = new List<Tags>();
json['tags'].forEach((v) { tags.add(new Tags.fromJson(v)); });
}
areas = json['areas'] != null ? new Areas.fromJson(json['areas']) : null;
// areas = json['areas'] != null ? new Areas.fromJson(json['areas']) : null;
if (json['orders'] != null) {
orders = new List<Orders>();
json['orders'].forEach((v) { orders.add(new Orders.fromJson(v)); });
......
......@@ -6,7 +6,7 @@ class PlanFeedBean {
int error;
String message;
Map extra;
Map errorCode;
int errorCode;
Map errorExtra;
Data data;
UserType userType;
......@@ -101,8 +101,8 @@ class Plans {
positiveRate = json['positive_rate'];
salesCount = json['sales_count'];
baseAttrs = json['base_attrs'].cast<String>();
minPrice = json['min_price'];
maxPrice = json['max_price'];
minPrice = json['min_price'] is int? "${json['min_price']}":json['min_price'];
maxPrice = json['max_price'] is int? "${json['max_price']}":json['max_price'];
projectImage = json['project_image'];
}
......
......@@ -59,18 +59,20 @@ class MainManager {
innerSetData(map, IS_WIFI);
innerSetData(map, HARDWARE_MODEL);
innerSetData(map, USER_ID);
// innerSetData(map, COOKIE);
innerSetData(map, USER_AGENT);
if (map[COOKIE] == null) {
CacheManager.getInstance().get(MEMORY_CACHE).save(COOKIE,
"_gm_token=1da6071594101423; csrftoken=rUrkkYYMOVZfIIQnU2IH09QIGmsfe8tE; sessionid=uz7f70uap76r6og48znci5l2hbr9vm5c; _gtid=5af9a5deba8511ea8d4082a085c393c93393");
}else{
innerSetData(map, COOKIE);
}
innerSetData(map, BASE_URL);
DioUtil.setDefOptions(
baseUrl: "${map[BASE_URL]}/",
cookie: map[COOKIE],
agent: map[USER_AGENT]);
if (map[COOKIE] == null) {
CacheManager.getInstance().get(MEMORY_CACHE).save(COOKIE,
"_gm_token=1da6071594101423; csrftoken=rUrkkYYMOVZfIIQnU2IH09QIGmsfe8tE; sessionid=uz7f70uap76r6og48znci5l2hbr9vm5c; _gtid=5af9a5deba8511ea8d4082a085c393c93393");
}
print(
"LSY QQWWEERRTTYY ${CacheManager.getInstance().get(MEMORY_CACHE).get(COOKIE)}");
DioUtil.getInstance().changeOpt();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment