Commit 65f6b83c authored by 朱璇's avatar 朱璇

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

parents 2c292f66 109daea9
......@@ -16,6 +16,8 @@ abstract class ClueRouter implements RouterBaser {
Widget getLevelOnePage();
Widget getLevelTwoPage();
Widget getPlanPage();
Widget getPlanCompareDetailPage();
}
......@@ -7,6 +7,7 @@ import 'package:gm_flutter/ClueModel/ClueRouter.dart';
import 'package:gm_flutter/ClueModel/page/PlansCompareFeed/PlansCompareFeedPage.dart';
import 'package:gm_flutter/ClueModel/page/ProjectDetails/ProjectDetailsPage.dart';
import 'package:gm_flutter/ClueModel/page/levelOne/LevelOnePage.dart';
import 'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoPage.dart';
import 'package:gm_flutter/ClueModel/page/plan/PlanPage.dart';
import 'package:gm_flutter/ClueModel/page/PlanCompareDetail/PlanCompareDetailPage.dart';
......@@ -20,6 +21,11 @@ class ClueRouterImpl implements ClueRouter {
Widget getLevelOnePage() {
return LevelOnePage();
}
@override
Widget getLevelTwoPage() {
return LevelTwoPage();
}
@override
Widget getPlansCompareFeed() {
......
/*
* @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';
import 'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
import 'package:gm_flutter/commonModel/rx/RxDispose.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class LevelTwoModel extends BaseModel {
LiveData<double> appBarLive = LiveData();
LiveData<List<String>> rectLive = LiveData();
LiveData<List<String>> explainLive = LiveData();
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();
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}) {
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;
@override
void dispose() {
showTab.dispost();
cardsLive.dispost();
appBarLive.dispost();
rectLive.dispost();
topIndexLive.dispost();
topScrollLive.dispost();
loadingLive.dispost();
}
void selectPage(int index) {
if (currentIndex == index) {
return;
}
currentIndex = index;
if (data[currentIndex] == null) {
cardsLive.notifyView(Pair(LOADING, null));
refreshView(true);
} else {
cardsLive.notifyView(Pair(ENDLOADING, data[currentIndex]));
}
}
void loadMore() {}
}
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:flutter_common/commonModel/picker/base/BaseBottomPicker.dart';
class MechanismBox implements IBottomPicker {
VoidCallback dismissCall;
TextEditingController textController = TextEditingController();
@override
initState(dismissCall, BuildContext context) {
this.dismissCall = dismissCall;
}
Widget build(BuildContext context) {
MediaQueryData mq = MediaQuery.of(context);
double keyHeight = MediaQuery.of(context).viewInsets.bottom;
return ClipRRect(
borderRadius: BorderRadius.only(
topLeft: Radius.circular(10.0), topRight: Radius.circular(10.0)),
child: Container(
width: mq.size.width,
height: mq.size.height - 140,
color: Colors.white,
child: Stack(
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 20, right: 20),
width: mq.size.width,
decoration: BoxDecoration(
border: Border(
bottom:
BorderSide(width: 1, color: Color(0xffE5E5E5)))),
height: 50,
child: Stack(
alignment: Alignment.center,
children: <Widget>[
Container(
child: Text(
'请选择要咨询的机构',
style: TextStyle(
color: Color(0xff282828),
fontSize: 17,
fontWeight: FontWeight.bold),
),
),
Positioned(
right: 0,
top: 16.0,
child: GestureDetector(
onTap: () {
dismissCall();
},
child: Container(
width: 14,
height: 14,
child: Image.asset("assets/close-btn.png"),
),
))
],
),
),
Container(
height: mq.size.height - 140 - 96 - 50,
width: mq.size.width,
margin: EdgeInsets.only(top: 50),
padding: EdgeInsets.only(left: 20, right: 20),
child: ListView.separated(
itemCount: 100,
itemBuilder: (BuildContext context, int index) {
return ListTile(title: Text("$index"));
},
separatorBuilder: (BuildContext context, int index) {
return Divider(color: Color(0xffE5E5E5));
},
)),
Positioned(
bottom: keyHeight == 0 ? 0 : keyHeight,
left: 0,
width: double.maxFinite,
height: 96,
child: Container(
height: 96,
color: Color(0xffF9F8FB),
child: Column(
children: <Widget>[
Container(
height: 25,
color: Colors.black,
width: double.maxFinite,
margin: EdgeInsets.only(top: 12),
child: ListView(
scrollDirection: Axis.horizontal, //横向滚动
children: <Widget>[
Container(
margin: EdgeInsets.only(left: 15, right: 8),
height: 25,
child: Text(
'我想',
style: TextStyle(
height: 2,
color: Color(0xff666666),
fontSize: 12),
)),
Container(
height: 25,
margin: EdgeInsets.only(right: 12),
padding: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5), width: 0.5),
color: Color(0xffffffff),
borderRadius: BorderRadius.circular(20)),
child: Text(
'有优惠活动吗?',
style: TextStyle(
fontSize: 12,
color: Color(0xff666666),
height: 1.8),
),
),
Container(
height: 25,
margin: EdgeInsets.only(right: 12),
padding: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5),
width: 0.5),
color: Color(0xffffffff),
borderRadius:
BorderRadius.circular(20)),
child: Text(
'111有优惠活动吗?',
style: TextStyle(
fontSize: 12,
color: Color(0xff666666),
height: 1.8),
)),
Container(
height: 25,
margin: EdgeInsets.only(right: 12),
padding: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5),
width: 0.5),
color: Color(0xffffffff),
borderRadius:
BorderRadius.circular(20)),
child: Text(
'111有优惠活动吗?',
style: TextStyle(
fontSize: 12,
color: Color(0xff666666),
height: 1.8),
)),
Container(
height: 25,
margin: EdgeInsets.only(right: 12),
padding: EdgeInsets.only(left: 8, right: 8),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5),
width: 0.5),
color: Color(0xffffffff),
borderRadius:
BorderRadius.circular(20)),
child: Text(
'111有优惠活动吗?',
style: TextStyle(
fontSize: 12,
color: Color(0xff666666),
height: 1.8),
))
],
),
),
Container(
height: 35,
margin:
EdgeInsets.only(top: 12, left: 15, right: 15),
decoration: BoxDecoration(
border: Border.all(
color: Color(0xffE5E5E5), width: 0.5),
color: Color(0xffffffff),
borderRadius: BorderRadius.circular(35)),
child: TextField(
controller: textController,
keyboardType: TextInputType.text,
textInputAction: TextInputAction.send,
onSubmitted: (txt) {},
decoration: InputDecoration(
contentPadding: EdgeInsets.all(16.0),
labelText: '文案文案文案不知道文案是啥',
border: InputBorder.none)),
)
],
)))
],
)),
);
}
@override
void dispose() {
textController.dispose();
}
}
......@@ -25,10 +25,10 @@ class FilterView extends StatelessWidget {
children: <Widget>[
Positioned(
bottom: 74.5,
left: 15,
left: 0,
child: Container(
width: MediaQuery.of(context).size.width - 30,
child: PlanProgressBar(0, 5, 0, 10,padding: 15,),
width: MediaQuery.of(context).size.width,
child: PlanProgressBar(0, 5, 0, 10000,padding: 15,),
),
),
Positioned(
......
......@@ -50,14 +50,22 @@ class PlanProgressBarState extends State<PlanProgressBar> {
@override
Widget build(BuildContext context) {
double totle = MediaQuery.of(context).size.width - widget.padding * 2 - 8;
double totle = MediaQuery.of(context).size.width - widget.padding * 2;
scrollDistance = 0.05;
double textL = textLeft * totle - 67.5 / 2 + 9;
if (textL < 0) {
textL = 0;
} else if (textL + 67.5 > totle) {
textL = totle - 67.5;
}
int textInt = (widget.maxlow +
(isLeftMove ? leftPosTempPercent : rightPosTempPercent + 0.03) *
distance)
.toInt();
String textStr = "¥${textInt}";
double textWidth = textStr.length*12.0;
double textL = textLeft * totle - textWidth / 2 + 9;
// if (textL < 0) {
// textL = 0;
// } else if (textL + textWidth > totle) {
// textL = totle - textWidth;
// }
return Container(
width: double.maxFinite,
height: 65,
......@@ -65,7 +73,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
children: <Widget>[
Positioned(
bottom: 7.5,
left: 4,
left: 15,
child: Container(
width: totle,
height: 4,
......@@ -75,7 +83,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
),
),
Positioned(
left: leftPosTempPercent * totle + 5,
left: leftPosTempPercent * totle + 5+15,
bottom: 7.5,
child: Container(
height: 4,
......@@ -84,21 +92,43 @@ class PlanProgressBarState extends State<PlanProgressBar> {
),
),
Positioned(
left: textL,
left: textL+11,
bottom: 23,
child: Visibility(
visible: textLeft >= 0,
visible: true,
// textLeft >= 0
child: Container(
width: 67.5,
width: textWidth,
height: 42,
color: Color(0x66000000),
alignment: Alignment.center,
child: Column(
child: Stack(
alignment: AlignmentDirectional.topCenter,
children: <Widget>[
baseText(
"${(widget.maxlow + (isLeftMove?leftPosTempPercent:rightPosTempPercent+0.03) * distance).toInt()}",
13,
Colors.white)
Container(
width: textWidth,
height: 37,
decoration: BoxDecoration(
color: Color(0x99000000),
borderRadius: BorderRadius.circular(6),
),
),
Positioned(
top: 36.9,
child: Container(
width: 9,
height: 5,
child: CustomPaint(
painter: TrianglePainter(Color(0x99000000)),
),
),
),
Positioned(
top: 12,
child: Container(
width: textWidth,
alignment: Alignment.topCenter,
child: baseText(textStr, 13, Colors.white),
),
)
],
),
),
......@@ -106,7 +136,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
),
Positioned(
bottom: 0,
left: leftPosTempPercent * totle,
left: leftPosTempPercent * totle+11,
child: Listener(
onPointerDown: (p) {
leftDowPos = p.localPosition.dx;
......@@ -140,7 +170,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
)),
Positioned(
bottom: 0,
left: rightPosTempPercent * totle,
left: rightPosTempPercent * totle+11,
child: Listener(
onPointerDown: (p) {
rightDowPos = p.localPosition.dx;
......@@ -177,3 +207,32 @@ class PlanProgressBarState extends State<PlanProgressBar> {
);
}
}
class TrianglePainter extends CustomPainter {
Color color; //填充颜色
Paint _paint; //画笔
Path _path; //绘制路径
double angle; //角度
TrianglePainter(this.color) {
_paint = Paint()
..color = color
..isAntiAlias = true;
_path = Path();
}
@override
void paint(Canvas canvas, Size size) {
final baseX = size.width;
final baseY = size.height;
_path.moveTo(0, 0);
_path.lineTo(baseX / 2, baseY);
_path.lineTo(baseX, 0);
canvas.drawPath(_path, _paint);
}
@override
bool shouldRepaint(CustomPainter oldDelegate) {
return false;
}
}
......@@ -26,16 +26,24 @@ class TestState extends BaseState<TestPage> {
JumpUtil.jumpToPageRight(context, NetProxyPage());
}));
list.add(listItem("一级列表页", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getLevelOnePage());
JumpUtil.jumpToPageRight(
context, RouterCenterImpl().findClueRouter().getLevelOnePage());
}));
list.add(listItem("二级列表页", () {
JumpUtil.jumpToPageRight(
context, RouterCenterImpl().findClueRouter().getLevelTwoPage());
}));
list.add(listItem("方案页面", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getPlanPage());
JumpUtil.jumpToPageRight(
context, RouterCenterImpl().findClueRouter().getPlanPage());
}));
list.add(listItem("对比详情页", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getPlanCompareDetailPage());
JumpUtil.jumpToPageRight(context,
RouterCenterImpl().findClueRouter().getPlanCompareDetailPage());
}));
list.add(listItem("项目说明", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getProjectDetailsPage());
JumpUtil.jumpToPageRight(
context, RouterCenterImpl().findClueRouter().getProjectDetailsPage());
}));
return list;
}
......
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