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