Commit fc13ae98 authored by 林生雨's avatar 林生雨

w

parent ef179381
......@@ -173,15 +173,20 @@ class LevelOneItem extends StatelessWidget {
),
),
),
Positioned(
left: 0,
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.width - 30,
height: 0.5,
color: Color(0xffE5E5E5),
),
)
allSize != null && position != null && position < allSize - 1
? Positioned(
left: 0,
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.width - 30,
height: 0.5,
color: Color(0xffE5E5E5),
),
)
: Container(
width: 0,
height: 0,
)
],
),
),
......@@ -305,15 +310,20 @@ class LevelOneItem extends StatelessWidget {
// top: 47,
// child: FiveStarView(int.parse(cards.hospital.star), 5),
// ),
Positioned(
left: 0,
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.width - 30,
height: 0.5,
color: Color(0xffE5E5E5),
),
)
allSize != null && position != null && position < allSize - 1
? Positioned(
left: 0,
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.width - 30,
height: 0.5,
color: Color(0xffE5E5E5),
),
)
: Container(
width: 0,
height: 0,
)
],
),
));
......@@ -634,11 +644,15 @@ class LevelOneItem extends StatelessWidget {
],
),
),
Container(
width: double.maxFinite,
height: 0.5,
color: Color(0xffE5E5E5),
)
allSize != null && position != null && position < allSize - 1
? Container(
width: double.maxFinite,
height: 0.5,
color: Color(0xffE5E5E5),
)
: Container(
height: 0.5,
)
],
),
).gestureDetector(() {
......
......@@ -134,7 +134,7 @@ class FilterViewState extends State<FilterView> {
),
Expanded(
child: Container(
color: Color(0xff3FB5AF),
color: Color(0xff51CDC7),
alignment: Alignment.center,
child: baseText("确定", 16, Colors.white),
).gestureDetector(() {
......
......@@ -60,10 +60,21 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
PlanBarView planBarView;
double stateBarHeight;
double topHeight;
Function(String str) func;
@override
void initState() {
_model.init(needCache: true);
if (RouterCenterImpl().findMainRouter().isWithNative() &&
CacheManager.getInstance().get(MEMORY_CACHE).get(BASE_URL).empty()) {
func = (str) {
if (str == "init") {
_model.init(needCache: true);
}
};
SimpleEventBus.instance().resignEvent("clueModel|Plan|PlanPage", func);
} else {
_model.init(needCache: true);
}
super.initState();
planBarView =
PlanBarView(_model.managerLive, clickIndex, hideAllMenuListener);
......@@ -71,6 +82,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
@override
void dispose() {
SimpleEventBus.instance().unResignEvent("clueModel|Plan|PlanPage", func);
hideAllMenuListener.dispose();
projectMenuListener.dispose();
sortMenuListener.dispose();
......@@ -84,24 +96,15 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
@override
Widget buildItem(BuildContext context) {
stateBarHeight = MediaQueryData
.fromWindow(window)
.padding
.top;
stateBarHeight = MediaQueryData.fromWindow(window).padding.top;
topHeight = stateBarHeight + kToolbarHeight;
return Scaffold(
body: MediaQuery.removePadding(
removeTop: true,
context: context,
child: baseStateView(
MediaQuery
.of(context)
.size
.width,
MediaQuery
.of(context)
.size
.height,
MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height,
_model.stateLive,
newHome(), () {
_model.stateLive.notifyView(LOADING);
......@@ -113,26 +116,14 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
Widget newHome() {
double diff = Platform.isAndroid ? 50.0 : 0.0;
return Container(
width: MediaQuery
.of(context)
.size
.width,
width: MediaQuery.of(context).size.width,
//主页 剪去tabbar高度
height: MediaQuery
.of(context)
.size
.height -diff,
height: MediaQuery.of(context).size.height - diff,
child: Stack(
children: <Widget>[
Container(
width: MediaQuery
.of(context)
.size
.width,
height: MediaQuery
.of(context)
.size
.height - diff,
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - diff,
// child: child(),
child: homeWarp(),
),
......@@ -146,19 +137,13 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
child: Visibility(
visible: data.data[2] > 0.1,
child: Container(
width: MediaQuery
.of(context)
.size
.width,
height: MediaQuery
.of(context)
.size
.height,
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Column(
children: <Widget>[
Container(
height:
data.data[1] - 45 < 0 ? 0 : data.data[1] - 45,
data.data[1] - 45 < 0 ? 0 : data.data[1] - 45,
color: Colors.transparent,
),
Container(
......@@ -204,18 +189,15 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery
.of(context)
.size
.width,
width: MediaQuery.of(context).size.width,
maxHeight: 450,
listener: projectMenuListener,
child:
ProjectView(_model.projectSelectIndex, _model.projectData,
ProjectView(_model.projectSelectIndex, _model.projectData,
(id, name, index) {
clickIndexOther(0);
_model.projectClick(id, name, index);
}),
clickIndexOther(0);
_model.projectClick(id, name, index);
}),
proListener: (pro) {
_model.backProgress(pro, 0);
},
......@@ -228,10 +210,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery
.of(context)
.size
.width,
width: MediaQuery.of(context).size.width,
maxHeight: 45 * _model.sortList.length,
listener: sortMenuListener,
child: SortView(_model.sortList, _model.sortPos, (index) {
......@@ -251,14 +230,11 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery
.of(context)
.size
.width,
width: MediaQuery.of(context).size.width,
maxHeight: 186,
listener: filterMenuListener,
child: FilterView(
(max, min) {
(max, min) {
clickIndexOther(2);
_model.filterClick(max, min);
},
......@@ -369,23 +345,23 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
return <Widget>[
SliverOverlapAbsorber(
handle:
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
NestedScrollView.sliverOverlapAbsorberHandleFor(context),
sliver: baseSliverAppBar(null,
height: kToolbarHeight + stateBarHeight - 39,
needpic: false)),
SliverList(
delegate: SliverChildBuilderDelegate((BuildContext c, int i) {
if (i == 0) {
return Container(
height: kToolbarHeight,
);
}
return towPic();
}, childCount: 2)),
if (i == 0) {
return Container(
height: kToolbarHeight,
);
}
return towPic();
}, childCount: 2)),
SliverPersistentHeader(
pinned: true,
delegate:
StickyTabBarDelegateWithSize(child: planBar(), height: 45),
StickyTabBarDelegateWithSize(child: planBar(), height: 45),
)
];
},
......@@ -398,47 +374,29 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
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);
});
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,
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 emptyItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height);
}
return Container(
color: Color(0xffF7F6FA),
child: baseRefreshView(
refreshController,
() {
() {
_model.refreshFeed(true, controller: refreshController);
},
null,
......@@ -448,7 +406,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
slivers: <Widget>[
SliverList(
delegate: SliverChildBuilderDelegate(
(BuildContext context, int index) {
(BuildContext context, int index) {
if (data.data.second.length == 0) {
if (_model.page != 1) {
refreshController.loadNoData();
......@@ -486,8 +444,10 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
margin: EdgeInsets.only(left: 15, right: 15, top: 0, bottom: 0),
child: Row(
children: <Widget>[
Expanded(
child: Container(
// Expanded(
// child:
AspectRatio(
aspectRatio: 335/180,
child: StreamBuilder<List<Ranks>>(
stream: _model.picLive.stream,
initialData: _model.picLive.data ?? null,
......@@ -496,7 +456,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
borderRadius: BorderRadius.circular(3),
child: CachedNetworkImage(
imageUrl:
data.data == null ? "" : data.data[0].icon ?? "",
data.data == null ? "" : data.data[0].icon ?? "",
fit: BoxFit.cover,
)).gestureDetector(() {
Map<String, dynamic> map = {
......@@ -514,13 +474,18 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
},
),
),
),
Container(
width: 10,
),
Expanded(
child: Container(
child: StreamBuilder<List<Ranks>>(
// ),
Expanded(
child: Container(),
),
// Container(
// width: 10,
// ),
// Expanded(
// child:
AspectRatio(
aspectRatio: 335/180,
child: StreamBuilder<List<Ranks>>(
stream: _model.picLive.stream,
initialData: _model.picLive.data ?? null,
builder: (c, data) {
......@@ -528,7 +493,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
borderRadius: BorderRadius.circular(3),
child: CachedNetworkImage(
imageUrl:
data.data == null ? "" : data.data[1].icon ?? "",
data.data == null ? "" : data.data[1].icon ?? "",
fit: BoxFit.cover,
)).gestureDetector(() {
Map<String, dynamic> map = {
......@@ -545,7 +510,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
});
},
),
),
// ),
)
],
),
......@@ -585,7 +550,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
double bottom =
// WidgetUtil.buttonLeftMenuPosition(globalKey.currentContext)?.top ??
topPos == null ? 0.0 : topPos.dy + 45;
topPos == null ? 0.0 : topPos.dy + 45;
if (bottom < 45) {
bottom = 45;
}
......
......@@ -81,9 +81,7 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
@override
Widget buildItem(BuildContext context) {
return Scaffold(
body: SafeArea(
top: false,
child: baseStateView(
body: baseStateView(
MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height,
_model.stateLive,
......@@ -104,7 +102,7 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
},
paddingTop:
MediaQueryData.fromWindow(window).padding.top + kToolbarHeight),
));
);
}
Widget homeWarp() {
......
......@@ -12,6 +12,7 @@ import 'package:flutter_common/commonModel/toast/toast.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/base/BaseUtil.dart';
import 'package:gm_flutter/commonModel/cache/CacheManager.dart';
import 'package:gm_flutter/commonModel/eventbus/SimpleEventBus.dart';
import 'package:gm_flutter/commonModel/util/DartUtil.dart';
import '../../commonModel/App.dart';
......@@ -72,7 +73,15 @@ class MainManager {
innerSetData(map, USER_ID);
innerSetData(map, USER_AGENT);
// innerSetData(map, BASE_URL);
innerSetData(map, BASE_URL);
if (map[BASE_URL] != null) {
DioUtil.getInstance();
DioUtil.setDefOptions(
baseUrl: "${map[BASE_URL]}/", agent: map[USER_AGENT]);
DioUtil.getInstance().changeOpt();
}
SimpleEventBus.instance().notifyListener("clueModel|Plan|PlanPage", "init");
// if (map[COOKIE] == null) {
// CacheManager.getInstance().get(MEMORY_CACHE).save(COOKIE,
// "_gm_token=1da6071594101423; csrftoken=rUrkkYYMOVZfIIQnU2IH09QIGmsfe8tE; sessionid=uz7f70uap76r6og48znci5l2hbr9vm5c; _gtid=5af9a5deba8511ea8d4082a085c393c93393");
......@@ -88,11 +97,7 @@ class MainManager {
print(
"LSY QQWWEERRTTYY ${CacheManager.getInstance().get(MEMORY_CACHE).get(COOKIE)}"
" ${CacheManager.getInstance().get(MEMORY_CACHE).get(COOKIE) is String}");
if (map[BASE_URL] != null) {
DioUtil.setDefOptions(
baseUrl: "${map[BASE_URL]}/", agent: map[USER_AGENT]);
DioUtil.getInstance().changeOpt();
}
// SimpleEventBus.instance().notifyListener("PlanPage!initState", "");
}
......
......@@ -547,7 +547,7 @@ Widget baseSliverTitle(String text, double width, LiveData liveData) {
child: Container(
alignment: Alignment.center,
width: width,
child: baseText(text, 18, Color(0xff333333)),
child: baseText(text, 16, Color(0xff333333)),
),
);
},
......
......@@ -53,7 +53,7 @@ class DioUtil {
(_dio.httpClientAdapter as DefaultHttpClientAdapter).onHttpClientCreate =
(client) {
client.findProxy = (url) {
return 'PROXY $proxy:${port??8888}';
return 'PROXY $proxy:${port ?? 8888}';
};
};
}
......@@ -62,7 +62,7 @@ class DioUtil {
return _dio;
}
static void setDefOptions({String baseUrl, String cookie, String agent}) {
static void setDefOptions({String baseUrl, String agent}) {
_options.connectTimeout = 10 * 1000;
_options.receiveTimeout = 20 * 1000;
_options.responseType = ResponseType.plain;
......@@ -71,10 +71,8 @@ class DioUtil {
if (agent != null) {
headers['User-Agent'] = agent;
}
if (cookie != null) {
headers[HttpHeaders.cookieHeader] = cookie;
}
_options.headers = headers;
_options.baseUrl = baseUrl ?? Api.getInstance().getBaseUrl() + "/";
print("ISEMPTY ?? ${baseUrl}");
_options.baseUrl = baseUrl ?? "${Api.getInstance().getBaseUrl()}/";
}
}
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