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

comit

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