Commit 8c323111 authored by 杜欣's avatar 杜欣

Merge branch 'test' into featrue/duxin

parents 59341041 a5a10489
...@@ -25,10 +25,10 @@ class FilterView extends StatelessWidget { ...@@ -25,10 +25,10 @@ class FilterView extends StatelessWidget {
children: <Widget>[ children: <Widget>[
Positioned( Positioned(
bottom: 74.5, bottom: 74.5,
left: 15, left: 0,
child: Container( child: Container(
width: MediaQuery.of(context).size.width - 30, width: MediaQuery.of(context).size.width,
child: PlanProgressBar(0, 5, 0, 10,padding: 15,), child: PlanProgressBar(0, 5, 0, 10000,padding: 15,),
), ),
), ),
Positioned( Positioned(
......
...@@ -50,14 +50,22 @@ class PlanProgressBarState extends State<PlanProgressBar> { ...@@ -50,14 +50,22 @@ class PlanProgressBarState extends State<PlanProgressBar> {
@override @override
Widget build(BuildContext context) { 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; scrollDistance = 0.05;
double textL = textLeft * totle - 67.5 / 2 + 9; int textInt = (widget.maxlow +
if (textL < 0) { (isLeftMove ? leftPosTempPercent : rightPosTempPercent + 0.03) *
textL = 0; distance)
} else if (textL + 67.5 > totle) { .toInt();
textL = totle - 67.5; 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( return Container(
width: double.maxFinite, width: double.maxFinite,
height: 65, height: 65,
...@@ -65,7 +73,7 @@ class PlanProgressBarState extends State<PlanProgressBar> { ...@@ -65,7 +73,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
children: <Widget>[ children: <Widget>[
Positioned( Positioned(
bottom: 7.5, bottom: 7.5,
left: 4, left: 15,
child: Container( child: Container(
width: totle, width: totle,
height: 4, height: 4,
...@@ -75,7 +83,7 @@ class PlanProgressBarState extends State<PlanProgressBar> { ...@@ -75,7 +83,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
), ),
), ),
Positioned( Positioned(
left: leftPosTempPercent * totle + 5, left: leftPosTempPercent * totle + 5+15,
bottom: 7.5, bottom: 7.5,
child: Container( child: Container(
height: 4, height: 4,
...@@ -84,21 +92,43 @@ class PlanProgressBarState extends State<PlanProgressBar> { ...@@ -84,21 +92,43 @@ class PlanProgressBarState extends State<PlanProgressBar> {
), ),
), ),
Positioned( Positioned(
left: textL, left: textL+11,
bottom: 23, bottom: 23,
child: Visibility( child: Visibility(
visible: textLeft >= 0, visible: true,
// textLeft >= 0
child: Container( child: Container(
width: 67.5, width: textWidth,
height: 42, height: 42,
color: Color(0x66000000), child: Stack(
alignment: Alignment.center, alignment: AlignmentDirectional.topCenter,
child: Column(
children: <Widget>[ children: <Widget>[
baseText( Container(
"${(widget.maxlow + (isLeftMove?leftPosTempPercent:rightPosTempPercent+0.03) * distance).toInt()}", width: textWidth,
13, height: 37,
Colors.white) 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> { ...@@ -106,7 +136,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
), ),
Positioned( Positioned(
bottom: 0, bottom: 0,
left: leftPosTempPercent * totle, left: leftPosTempPercent * totle+11,
child: Listener( child: Listener(
onPointerDown: (p) { onPointerDown: (p) {
leftDowPos = p.localPosition.dx; leftDowPos = p.localPosition.dx;
...@@ -140,7 +170,7 @@ class PlanProgressBarState extends State<PlanProgressBar> { ...@@ -140,7 +170,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
)), )),
Positioned( Positioned(
bottom: 0, bottom: 0,
left: rightPosTempPercent * totle, left: rightPosTempPercent * totle+11,
child: Listener( child: Listener(
onPointerDown: (p) { onPointerDown: (p) {
rightDowPos = p.localPosition.dx; rightDowPos = p.localPosition.dx;
...@@ -177,3 +207,32 @@ class PlanProgressBarState extends State<PlanProgressBar> { ...@@ -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;
}
}
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