Commit 68bd27f1 authored by 林生雨's avatar 林生雨

comit

parent 2c32540d
......@@ -15,9 +15,17 @@ class FilterView extends StatelessWidget {
int min = 0;
int max = 0;
PlanProgressBar planProgressBar;
@override
Widget build(BuildContext context) {
planProgressBar = PlanProgressBar(
0,
5,
0,
10000,
padding: 15,
);
return Container(
color: Colors.white,
height: 186,
......@@ -28,7 +36,7 @@ class FilterView extends StatelessWidget {
left: 0,
child: Container(
width: MediaQuery.of(context).size.width,
child: PlanProgressBar(0, 5, 0, 10000,padding: 15,),
child: planProgressBar,
),
),
Positioned(
......@@ -58,7 +66,7 @@ class FilterView extends StatelessWidget {
child: baseText("重置", 16, Color(0xff3FB5AF)),
alignment: Alignment.center,
).gestureDetector(() {
//TODO
planProgressBar.changeNotifier.notifyListeners();
}),
),
Expanded(
......
......@@ -51,6 +51,7 @@ class PlanModel extends BaseModel {
int sortPos = 0;
void init({VoidCallback call}) {
print("LSY PLANMODEL IIIIIINT ");
if (CacheManager.getInstance().get(MEMORY_CACHE).get(PLAN_MODEL_BUFFER) !=
null) {
var event = PlanBean.fromJson(json.decode(
......
......@@ -12,6 +12,7 @@ class PlanProgressBar extends StatefulWidget {
int maxlow;
int maxHigh;
int padding;
ChangeNotifier changeNotifier;
PlanProgressBar(this.low, this.high, this.maxlow, this.maxHigh,
{this.padding});
......@@ -32,8 +33,6 @@ class PlanProgressBarState extends State<PlanProgressBar> {
double scrollDistance;
double leftPos;
double textLeft = -1;
bool isLeftMove = true;
......@@ -41,6 +40,18 @@ class PlanProgressBarState extends State<PlanProgressBar> {
void initState() {
super.initState();
distance = widget.maxHigh - widget.maxlow - 0.0;
widget.changeNotifier = ChangeNotifier();
init();
if (widget.changeNotifier != null && !widget.changeNotifier.hasListeners) {
widget.changeNotifier.addListener(() {
print("HHH");
init();
setState(() {});
});
}
}
void init() {
leftStarPosPercent = (widget.low / distance);
leftPosTempPercent = leftStarPosPercent;
......@@ -48,6 +59,12 @@ class PlanProgressBarState extends State<PlanProgressBar> {
rightPosTempPercent = rightStarPosPercent;
}
@override
void dispose() {
widget.changeNotifier.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
double totle = MediaQuery.of(context).size.width - widget.padding * 2;
......@@ -58,7 +75,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
.toInt();
String textStr = "¥${textInt}";
double textWidth = textStr.length*12.0;
double textWidth = textStr.length * 12.0;
double textL = textLeft * totle - textWidth / 2 + 9;
// if (textL < 0) {
......@@ -83,7 +100,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
),
),
Positioned(
left: leftPosTempPercent * totle + 5+15,
left: leftPosTempPercent * totle + 5 + 15,
bottom: 7.5,
child: Container(
height: 4,
......@@ -92,7 +109,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
),
),
Positioned(
left: textL+11,
left: textL + 11,
bottom: 23,
child: Visibility(
visible: true,
......@@ -136,7 +153,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
),
Positioned(
bottom: 0,
left: leftPosTempPercent * totle+11,
left: leftPosTempPercent * totle + 11,
child: Listener(
onPointerDown: (p) {
leftDowPos = p.localPosition.dx;
......@@ -170,7 +187,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
)),
Positioned(
bottom: 0,
left: rightPosTempPercent * totle+11,
left: rightPosTempPercent * totle + 11,
child: Listener(
onPointerDown: (p) {
rightDowPos = p.localPosition.dx;
......
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