Commit a8260add authored by 杜欣's avatar 杜欣

Merge branch 'test' into featrue/duxin

# Conflicts:
#	lib/main.dart
parents 3a5d1c31 54cb8cd7
assets/left_arrow.png

776 Bytes | W: | H:

assets/left_arrow.png

992 Bytes | W: | H:

assets/left_arrow.png
assets/left_arrow.png
assets/left_arrow.png
assets/left_arrow.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,6 +2,7 @@
* @author lsy
* @date 2020/6/29
**/
import 'package:flutter/material.dart';
import 'package:flutter_common/commonModel/live/BaseModel.dart';
import 'package:flutter_common/commonModel/live/LiveData.dart';
import 'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart';
......@@ -18,27 +19,55 @@ class LevelOneModel extends BaseModel {
LiveData<bool> showTab = LiveData();
LiveData<int> topIndexLive = new LiveData();
LiveData<double> topScrollLive = new LiveData();
LiveData<bool> loadingLive = LiveData();
RxDispose rxDispose = RxDispose();
LiveData<Pair<int,List<Cards>>> cardsLive = LiveData();
LiveData<Pair<int, List<Cards>>> cardsLive = LiveData();
Map<int, List<Cards>> data = new Map();
List list = ["plan", "hospital", "doctor", "diary"];
List pageList = [1, 1, 1, 1];
List pageHeightList = [118, 149, 118, 118];
void refreshView(bool clear, {RefreshController refreshListener}) {
int index = currentIndex;
if (clear) {
data.clear();
pageList = [1, 1, 1, 1];
}
ClueApiImpl.getInstance()
.getLevelOneList(
DioUtil.getInstance().getDio(), 123, list[index], pageList[index])
.listen((event) {
}).addToDispose(rxDispose).onError((err) {
Future.delayed(Duration(seconds: 1), () {
Cards cards = Cards(
cardType: "plan",
plan: Plan(planName: "ww", minPrice: "50", maxPrice: "500"));
List<Cards> a = [
cards,
cards,
cards,
cards,
cards,
cards,
cards,
cards,
cards,
cards,
cards,
cards,
];
List<Cards> b = [cards];
print("INDEX ${currentIndex}");
if (currentIndex == 1) {
data[currentIndex] = b;
} else {
data[currentIndex] = a;
}
cardsLive.notifyView(Pair(ENDLOADING, data));
});
// int index = currentIndex;
// if (clear) {
// data.clear();
// pageList = [1, 1, 1, 1];
// }
// ClueApiImpl.getInstance()
// .getLevelOneList(
// DioUtil.getInstance().getDio(), 123, list[index], pageList[index])
// .listen((event) {})
// .addToDispose(rxDispose)
// .onError((err) {});
}
int currentIndex = 0;
......@@ -51,6 +80,7 @@ class LevelOneModel extends BaseModel {
rectLive.dispost();
topIndexLive.dispost();
topScrollLive.dispost();
loadingLive.dispost();
}
void selectPage(int index) {
......@@ -58,5 +88,13 @@ class LevelOneModel extends BaseModel {
return;
}
currentIndex = index;
if (data[currentIndex] == null) {
cardsLive.notifyView(Pair(LOADING, null));
refreshView(true);
} else {
cardsLive.notifyView(Pair(ENDLOADING, data[currentIndex]));
}
}
void loadMore() {}
}
......@@ -10,4 +10,6 @@ import 'MainRouterImpl.dart';
@Router("MainRouter", MainRouterImpl, true)
abstract class MainRouter extends RouterBaser {
void init();
Widget getTestPage();
}
......@@ -4,6 +4,7 @@
**/
import 'package:flutter/src/widgets/framework.dart';
import 'package:gm_flutter/MainRouter/manager/MainManager.dart';
import 'package:gm_flutter/MainRouter/page/test/TestPage.dart';
import 'MainRouter.dart';
......@@ -12,4 +13,9 @@ class MainRouterImpl implements MainRouter {
void init() {
MainManager.getInstance().startInit();
}
@override
Widget getTestPage() {
return TestPage();
}
}
......@@ -8,6 +8,7 @@ import 'package:flutter_common/commonModel/util/JumpUtil.dart';
import 'package:gm_flutter/MainRouter/page/proxy/NetProxyPage.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/commonModel/base/BaseState.dart';
import 'package:gm_flutter/main.mark.dart';
import 'TP.dart';
......@@ -24,8 +25,8 @@ class TestState extends BaseState<TestPage> {
list.add(listItem("设置代理页面", () {
JumpUtil.jumpToPageRight(context, NetProxyPage());
}));
list.add(listItem("测试测试", () {
JumpUtil.jumpToPageRight(context, TP());
list.add(listItem("一级列表页", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getLevelOnePage());
}));
return list;
}
......@@ -40,7 +41,7 @@ class TestState extends BaseState<TestPage> {
Navigator.pop(context);
}),
body: Container(
child: Column(
child: ListView(
children: innerList(),
),
),
......
......@@ -70,7 +70,7 @@ AppBar _baseAppBarChangeTitle(
width: 30,
height: 30,
child: Image.asset(
"images/left_arrow.png",
"assets/left_arrow.png",
color: Color(0xff323232),
),
))),
......@@ -272,16 +272,17 @@ Widget baseRefreshView(RefreshController refreshController,
footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode) {
Widget body;
// if (mode == LoadStatus.idle) {
// body = baseText("准备加载", 12, Color(0xff545454));
// } else
if (mode == LoadStatus.loading) {
print("LOAD STATUE ${mode}");
if (mode == LoadStatus.idle) {
body = baseText("上拉加载更多", 12, Color(0xff545454));
} else if (mode == LoadStatus.loading) {
body = baseText("加载中", 12, Color(0xff545454));
} else if (mode == LoadStatus.failed) {
body = baseText("加载失败", 12, Color(0xff545454));
} else if (mode == LoadStatus.noMore) {
body = baseText("没有更多数据了", 12, Color(0xff545454));
} else {
}
else {
body = Container();
}
return Container(
......@@ -333,3 +334,23 @@ Widget normalRefreshHeader() {
},
);
}
Widget emptyItem({String detail}) {
return Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Container(
height: 210,
width: 210,
color: Colors.red,
),
Container(
margin: EdgeInsets.only(top: 8),
child: baseText(
detail == null ? "暂无消息,找人聊聊去" : detail, 15, Color(0xff9B9B9B)),
),
],
);
}
......@@ -69,9 +69,19 @@ class MyApp extends State<MyAppWidget> {
Widget build(BuildContext context) {
WindowUtil.setBarStatus(true);
return MaterialApp(
theme: ThemeData(),
theme: ThemeData(
primaryColor: Colors.white,
cursorColor: Color(0xff20BDBB),
canvasColor: Colors.white),
builder: FlutterBoost.init(postPush: _onRoutePushed),
home: RouterCenterImpl().findClueRouter().getLevelTwoPage());
home: isDebug
? RouterCenterImpl().findMainRouter().getTestPage()
: Container(
color: Colors.white,
child: Center(
child: loadingItem(),
),
));
}
void _onRoutePushed(
......
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