Commit bec8036f authored by 朱璇's avatar 朱璇

Merge branch 'test' of git.wanmeizhensuo.com:linshengyu/gm_flutter into zx/gmFlutter

parents d8041060 59af1797
...@@ -42,10 +42,10 @@ class LevelOneState extends BaseState<LevelOnePage> ...@@ -42,10 +42,10 @@ class LevelOneState extends BaseState<LevelOnePage>
@override @override
void initState() { void initState() {
super.initState(); super.initState();
Future.delayed(Duration(seconds: 3), () { // Future.delayed(Duration(seconds: 3), () {
_model.loadingLive.notifyView(false); // _model.loadingLive.notifyView(false);
_model.refreshView(true); // _model.refreshView(true);
}); // });
pageController.addListener(() { pageController.addListener(() {
if (screenWidth != null) { if (screenWidth != null) {
_model.topScrollLive.notifyView( _model.topScrollLive.notifyView(
...@@ -121,8 +121,6 @@ class LevelOneState extends BaseState<LevelOnePage> ...@@ -121,8 +121,6 @@ class LevelOneState extends BaseState<LevelOnePage>
} }
}, },
))); )));
} }
Widget home() { Widget home() {
...@@ -492,7 +490,7 @@ class LevelOneState extends BaseState<LevelOnePage> ...@@ -492,7 +490,7 @@ class LevelOneState extends BaseState<LevelOnePage>
child: PageView.builder( child: PageView.builder(
itemBuilder: (c, pageIndex) { itemBuilder: (c, pageIndex) {
if (data.data.first == FAIL) { if (data.data.first == FAIL) {
return errorItem(() { return errorItem(MediaQuery.of(context).size.width, height, () {
_model.refreshView(true); _model.refreshView(true);
}); });
} }
...@@ -502,7 +500,7 @@ class LevelOneState extends BaseState<LevelOnePage> ...@@ -502,7 +500,7 @@ class LevelOneState extends BaseState<LevelOnePage>
} }
if (data.data.second.length == 0) { if (data.data.second.length == 0) {
if (_model.pageList[pageIndex] == 1) { if (_model.pageList[pageIndex] == 1) {
return emptyItem(); return emptyItem(MediaQuery.of(context).size.width, height);
} else { } else {
_refreshController.loadNoData(); _refreshController.loadNoData();
} }
......
...@@ -185,7 +185,8 @@ class PlanState extends BaseState<PlanPage> { ...@@ -185,7 +185,8 @@ class PlanState extends BaseState<PlanPage> {
width: MediaQuery.of(context).size.width, width: MediaQuery.of(context).size.width,
maxHeight: 272, maxHeight: 272,
listener: sortMenuListener, listener: sortMenuListener,
child: SortView(_model.sortList, _model.sortPos, (index) { child: SortView(_model.sortList, _model.sortPos,
(index) {
clickIndexOther(1); clickIndexOther(1);
_model.sortClick(index); _model.sortClick(index);
}), }),
...@@ -207,7 +208,7 @@ class PlanState extends BaseState<PlanPage> { ...@@ -207,7 +208,7 @@ class PlanState extends BaseState<PlanPage> {
listener: filterMenuListener, listener: filterMenuListener,
child: FilterView((max, min) { child: FilterView((max, min) {
clickIndexOther(2); clickIndexOther(2);
_model.filterClick(max,min); _model.filterClick(max, min);
}), }),
proListener: (pro) { proListener: (pro) {
_model.backProgress(pro, 2); _model.backProgress(pro, 2);
...@@ -232,14 +233,13 @@ class PlanState extends BaseState<PlanPage> { ...@@ -232,14 +233,13 @@ class PlanState extends BaseState<PlanPage> {
child: loadingItem(), child: loadingItem(),
); );
} else if (data.data == FAIL) { } else if (data.data == FAIL) {
return Container( return errorItem(
width: MediaQuery.of(context).size.width, MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height, MediaQuery.of(context).size.height,
color: Colors.white, () {
child: errorItem(() {
_model.stateLive.notifyView(LOADING); _model.stateLive.notifyView(LOADING);
_model.init(); _model.init();
}), },
); );
} else { } else {
return Container( return Container(
...@@ -455,7 +455,8 @@ class PlanState extends BaseState<PlanPage> { ...@@ -455,7 +455,8 @@ class PlanState extends BaseState<PlanPage> {
physics: NeverScrollableScrollPhysics(), physics: NeverScrollableScrollPhysics(),
itemBuilder: (c, index) { itemBuilder: (c, index) {
if (data.data.first == FAIL) { if (data.data.first == FAIL) {
return errorItem(() { return errorItem(MediaQuery.of(context).size.width, height,
() {
_model.refreshFeed(true); _model.refreshFeed(true);
}); });
} }
...@@ -464,7 +465,7 @@ class PlanState extends BaseState<PlanPage> { ...@@ -464,7 +465,7 @@ class PlanState extends BaseState<PlanPage> {
} }
if (data.data.second.length == 0) { if (data.data.second.length == 0) {
if (_model.page == 1) { if (_model.page == 1) {
return emptyItem(); return emptyItem(MediaQuery.of(context).size.width, height);
} else { } else {
refreshController.loadNoData(); refreshController.loadNoData();
} }
......
...@@ -93,10 +93,14 @@ class PlanProgressBarState extends State<PlanProgressBar> { ...@@ -93,10 +93,14 @@ class PlanProgressBarState extends State<PlanProgressBar> {
height: 42, height: 42,
color: Color(0x66000000), color: Color(0x66000000),
alignment: Alignment.center, alignment: Alignment.center,
child: baseText( child: Column(
"${(widget.maxlow + (isLeftMove?leftPosTempPercent:rightPosTempPercent+0.03) * distance).toInt()}", children: <Widget>[
13, baseText(
Colors.white), "${(widget.maxlow + (isLeftMove?leftPosTempPercent:rightPosTempPercent+0.03) * distance).toInt()}",
13,
Colors.white)
],
),
), ),
), ),
), ),
...@@ -144,7 +148,6 @@ class PlanProgressBarState extends State<PlanProgressBar> { ...@@ -144,7 +148,6 @@ class PlanProgressBarState extends State<PlanProgressBar> {
}, },
onPointerMove: (p) { onPointerMove: (p) {
var d = p.localPosition.dx - rightDowPos; var d = p.localPosition.dx - rightDowPos;
print("D ${d}");
rightPosTempPercent = rightStarPosPercent + (d / totle); rightPosTempPercent = rightStarPosPercent + (d / totle);
if (rightPosTempPercent < if (rightPosTempPercent <
leftPosTempPercent + scrollDistance) { leftPosTempPercent + scrollDistance) {
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
* @date 2019-10-13 * @date 2019-10-13
**/ **/
import 'package:app_settings/app_settings.dart';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
...@@ -138,56 +139,72 @@ Widget loadingItem({bool needBackground = false}) { ...@@ -138,56 +139,72 @@ Widget loadingItem({bool needBackground = false}) {
Widget netErrorItem() {} Widget netErrorItem() {}
Widget errorItem(VoidCallback retry, {String errorText, String retryText}) { Widget errorItem(double width, double height, VoidCallback retry,
{String errorText, String retryText}) {
return Container( return Container(
width: SCREENWIDTH, width: width,
height: SCREENHEIGHT, height: height,
color: Colors.white, color: Colors.white,
alignment: Alignment.center, alignment: Alignment.topCenter,
child: Container( child: Container(
height: SCREENHEIGHT, width: 180,
child: Container( height: 315.5,
margin: EdgeInsets.only(top: 70), margin: EdgeInsets.only(top: 62),
width: 175, child: Stack(
height: 249, alignment: AlignmentDirectional.center,
child: Stack( children: <Widget>[
children: <Widget>[ Positioned(
Positioned( left: 0,
left: 0, top: 0,
top: 0, child: Container(
child: Container( width: 180,
width: 175, height: 186.5,
height: 199, child: Image.asset("assets/error.png"),
child: Image.asset("assets/error.png"), ),
), ),
), Positioned(
Positioned( top: 166,
left: 0, child: Container(
top: 166, width: 180,
child: Container( alignment: Alignment.center,
width: 175, child: baseText(
alignment: Alignment.center, errorText ?? "原谅我一看到美人就不淡定", 15, Color(0xff666666)),
child: baseText(errorText ?? "网络错误", 15, Color(0xff666666)), ),
),
),
Positioned(
top: 216,
left: 12,
child: Container(
width: 150,
height: 33,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(22.5),
color: Color(0xff51CDC7)),
alignment: Alignment.center,
child: baseText(retryText ?? "重新加载", 16, Colors.white),
).gestureDetector(() {
retry();
}),
)
],
), ),
))); Positioned(
bottom: 60,
child: Container(
width: 150,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
gradient: LinearGradient(
colors: [Color(0xFFFF5963), Color(0xffFF7096)],
begin: FractionalOffset(1, 0),
end: FractionalOffset(0, 1))),
alignment: Alignment.center,
child: baseText(retryText ?? "重新加载", 16, Colors.white),
).gestureDetector(() {
retry();
}),
),
Positioned(
bottom: 0,
child: Container(
width: 150,
height: 40,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(20),
border: Border.all(color: Color(0xffFF5963), width: 0.5)),
alignment: Alignment.center,
child: baseText("检查网络设置", 16, Color(0xffFF5963)),
).gestureDetector(() {
AppSettings.openWIFISettings();
}),
)
],
),
));
} }
//TODO //TODO
...@@ -352,21 +369,30 @@ Widget normalRefreshHeader() { ...@@ -352,21 +369,30 @@ Widget normalRefreshHeader() {
); );
} }
Widget emptyItem({String detail}) { Widget emptyItem(double width, double height, {String detail}) {
return Column( return Container(
mainAxisSize: MainAxisSize.min, width: width,
mainAxisAlignment: MainAxisAlignment.center, height: height,
children: <Widget>[ color: Colors.white,
Container( alignment: Alignment.topCenter,
height: 210, child: Container(
width: 210, width: 175,
color: Colors.red, height: 188,
), margin: EdgeInsets.only(top: 62.5),
Container( child: Stack(
margin: EdgeInsets.only(top: 8), alignment: AlignmentDirectional.bottomCenter,
child: baseText( children: <Widget>[
detail == null ? "暂无消息,找人聊聊去" : detail, 15, Color(0xff9B9B9B)), Container(
width: 175,
height: 188,
child: Image.asset("assets/empty.png"),
),
Positioned(
bottom: 17,
child: baseText(detail ?? "此处太寂寥,转转别处吧", 15, Color(0xff666666)),
)
],
), ),
], ),
); );
} }
...@@ -15,6 +15,13 @@ packages: ...@@ -15,6 +15,13 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "0.39.10" version: "0.39.10"
app_settings:
dependency: "direct main"
description:
name: app_settings
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.1+1"
archive: archive:
dependency: transitive dependency: transitive
description: description:
......
...@@ -32,6 +32,7 @@ dependencies: ...@@ -32,6 +32,7 @@ dependencies:
#轻量级存储 #轻量级存储
shared_preferences: ^0.5.7+1 shared_preferences: ^0.5.7+1
lottie: ^0.4.0+1 lottie: ^0.4.0+1
app_settings: ^4.0.1+1
dev_dependencies: dev_dependencies:
......
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