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

Merge branch 'test' into featrue/duxin

parents 59341041 a5a10489
......@@ -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;
}
}
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