Commit 2463d3fb authored by 林生雨's avatar 林生雨

commit

parent 96727ad9
/*
* @author lsy
* @date 2020/7/8
**/
import 'package:flutter/material.dart';
class StickyTabBarDelegateWithSize extends SliverPersistentHeaderDelegate {
final Widget child;
final double height;
StickyTabBarDelegateWithSize({@required this.child, this.height});
@override
Widget build(
BuildContext context, double shrinkOffset, bool overlapsContent) {
return this.child;
}
@override
double get maxExtent => height ?? 40;
@override
double get minExtent => height ?? 40;
@override
bool shouldRebuild(SliverPersistentHeaderDelegate oldDelegate) {
return true;
}
}
......@@ -11,6 +11,7 @@ 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/common/StickyTabBarDelegateWithSize.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';
......@@ -60,6 +61,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
@override
void initState() {
print("LSY PLAN INIT");
// DioUtil.getInstance().setProxy("172.30.8.245");
super.initState();
_model.init();
......@@ -89,191 +91,163 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
removeTop: true,
context: context,
child: SafeArea(
top: false,
child: Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
child: Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
top: false,
child: baseStateView(
MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height,
_model.stateLive,
newHome(), () {
_model.stateLive.notifyView(LOADING);
_model.init();
}, paddingTop: stateBarHeight + kToolbarHeight)),
));
}
Widget newHome() {
return Container(
width: MediaQuery.of(context).size.width,
//主页 剪去tabbar高度
height: MediaQuery.of(context).size.height - 79,
child: Stack(
children: <Widget>[
Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height - 79,
// child: child(),
child: homeWarp(),
),
StreamBuilder<List<double>>(
stream: _model.backLive.stream,
initialData: [0.0, 0.0, 0.0],
builder: (c, data) {
return Positioned(
left: 0.0,
top: 0.0,
child: Visibility(
visible: data.data[2] > 0.1,
child: Container(
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,
color: Colors.transparent,
),
Container(
height: 45,
child: Row(
children: <Widget>[
Expanded(
child:
Container().gestureDetector(() {
clickIndexOther(0);
}),
),
Expanded(
child:
Container().gestureDetector(() {
clickIndexOther(1);
}),
),
Expanded(
child:
Container().gestureDetector(() {
clickIndexOther(2);
}),
),
],
),
),
Expanded(
child: Container(
color: Color.fromARGB(
(data.data[2] * 153).toInt(),
0,
0,
0),
).gestureDetector(() {
hideAllMenuListener.notifyListeners();
}),
)
],
),
child: homeWarp(),
),
StreamBuilder<List<double>>(
stream: _model.backLive.stream,
initialData: [0.0, 0.0, 0.0],
builder: (c, data) {
return Positioned(
left: 0.0,
top: 0.0,
child: Visibility(
visible: data.data[2] > 0.1,
child: Container(
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,
color: Colors.transparent,
),
Container(
height: 45,
child: Row(
children: <Widget>[
Expanded(
child: Container().gestureDetector(() {
clickIndexOther(0);
}),
),
Expanded(
child: Container().gestureDetector(() {
clickIndexOther(1);
}),
),
Expanded(
child: Container().gestureDetector(() {
clickIndexOther(2);
}),
),
],
),
),
);
}),
StreamBuilder<List<double>>(
stream: _model.posLive.stream,
initialData: [0.0, 0.0],
builder: (c, data) {
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery.of(context).size.width,
maxHeight: 450,
listener: projectMenuListener,
child: ProjectView(_model.projectData, (id) {
clickIndexOther(0);
_model.projectClick(id);
}),
proListener: (pro) {
_model.backProgress(pro, 0);
},
);
}),
StreamBuilder<List<double>>(
stream: _model.posLive.stream,
initialData: [0.0, 0.0],
builder: (c, data) {
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery.of(context).size.width,
maxHeight: 272,
listener: sortMenuListener,
child:
SortView(_model.sortList, _model.sortPos, (index) {
clickIndexOther(1);
_model.sortClick(index);
}),
proListener: (pro) {
_model.backProgress(pro, 1);
},
);
},
Expanded(
child: Container(
color: Color.fromARGB(
(data.data[2] * 153).toInt(), 0, 0, 0),
).gestureDetector(() {
hideAllMenuListener.notifyListeners();
}),
)
],
),
),
),
StreamBuilder<List<double>>(
stream: _model.posLive.stream,
initialData: [0.0, 0.0],
builder: (c, data) {
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery.of(context).size.width,
maxHeight: 186,
listener: filterMenuListener,
child: FilterView((max, min) {
clickIndexOther(2);
_model.filterClick(max, min);
}),
proListener: (pro) {
_model.backProgress(pro, 2);
},
);
}),
StreamBuilder<bool>(
stream: _model.showTab.stream,
initialData: _model.showTab.data ?? false,
builder: (c, data) {
return Visibility(
visible: data.data,
child: Container(
color: Colors.white,
child: planBarView,
),
);
},
)
],
),
),
StreamBuilder(
stream: _model.stateLive.stream,
initialData: _model.stateLive.data ?? LOADING,
);
}),
StreamBuilder<List<double>>(
stream: _model.posLive.stream,
initialData: [0.0, 0.0],
builder: (c, data) {
if (data.data == LOADING) {
return Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
color: Colors.white,
child: loadingItem(),
);
} else if (data.data == FAIL) {
return Container(
color: Colors.white,
child: errorItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height, () {
_model.stateLive.notifyView(LOADING);
_model.init();
}, paddingTop: stateBarHeight + kToolbarHeight),
);
} else {
return Container(
width: 0,
height: 0,
);
}
},
)
],
),
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery.of(context).size.width,
maxHeight: 450,
listener: projectMenuListener,
child: ProjectView(_model.projectData, (id) {
clickIndexOther(0);
_model.projectClick(id);
}),
proListener: (pro) {
_model.backProgress(pro, 0);
},
);
}),
StreamBuilder<List<double>>(
stream: _model.posLive.stream,
initialData: [0.0, 0.0],
builder: (c, data) {
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery.of(context).size.width,
maxHeight: 272,
listener: sortMenuListener,
child: SortView(_model.sortList, _model.sortPos, (index) {
clickIndexOther(1);
_model.sortClick(index);
}),
proListener: (pro) {
_model.backProgress(pro, 1);
},
);
},
),
StreamBuilder<List<double>>(
stream: _model.posLive.stream,
initialData: [0.0, 0.0],
builder: (c, data) {
return BasePopMenu(
leftPos: data.data[0],
topPos: data.data[1],
width: MediaQuery.of(context).size.width,
maxHeight: 186,
listener: filterMenuListener,
child: FilterView((max, min) {
clickIndexOther(2);
_model.filterClick(max, min);
}),
proListener: (pro) {
_model.backProgress(pro, 2);
},
);
}),
StreamBuilder<bool>(
stream: _model.showTab.stream,
initialData: _model.showTab.data ?? false,
builder: (c, data) {
return Visibility(
visible: data.data,
child: Container(
color: Colors.white,
child: planBarView,
),
);
},
)
],
),
));
);
}
//搜索框
Widget head() {
return Container(
height: topHeight,
......@@ -364,7 +338,8 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
}, childCount: 2)),
SliverPersistentHeader(
pinned: true,
delegate: StickyTabBarDelegate(child: planBar()),
delegate:
StickyTabBarDelegateWithSize(child: planBar(), height: 45),
)
];
},
......
......@@ -32,6 +32,7 @@ class TopListState extends State<TopList>
@override
void initState() {
super.initState();
_model.tagId="${widget.id}";
_model.getData(true);
refresh = (str) {
_model.stateLive.notifyView(LOADING);
......
......@@ -43,12 +43,10 @@ class TopListModel extends BaseModel {
datasLive.notifyView([]);
}
} else {
stateLive.notifyView(ENDLOADING);
datas.addAll(event.data.plans);
datasLive.notifyView(datas);
}
if (page == 1) {
stateLive.notifyView(ENDLOADING);
}
} else {
NativeToast.showNativeToast(event.message);
stateLive.notifyView(FAIL);
......
......@@ -521,7 +521,10 @@ Widget baseStateView(double width, double height, LiveData<int> stateLive,
initialData: stateLive.data ?? LOADING,
builder: (c, data) {
if (data.data == LOADING) {
return loadingItem();
return Container(
color: Colors.white,
child: loadingItem(),
);
} else if (data.data == FAIL) {
return errorItem(width, height, retry, paddingTop: paddingTop);
} else if (data.data == EMPTY) {
......
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