Commit 99e2f6f0 authored by 林生雨's avatar 林生雨

commit

parent 095cf284
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
**/ **/
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:gm_flutter/ClueModel/page/plan/PlanProgressBar.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart'; import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/commonModel/util/DartUtil.dart'; import 'package:gm_flutter/commonModel/util/DartUtil.dart';
...@@ -22,6 +23,14 @@ class FilterView extends StatelessWidget { ...@@ -22,6 +23,14 @@ class FilterView extends StatelessWidget {
height: 186, height: 186,
child: Stack( child: Stack(
children: <Widget>[ children: <Widget>[
Positioned(
bottom: 74.5,
left: 15,
child: Container(
width: MediaQuery.of(context).size.width - 30,
child: PlanProgressBar(0, 5, 0, 10,padding: 15,),
),
),
Positioned( Positioned(
top: 54.5, top: 54.5,
right: 15, right: 15,
......
/*
* @author lsy
* @date 2020/7/1
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
class PlanProgressBar extends StatefulWidget {
int low;
int high;
int maxlow;
int maxHigh;
int padding;
PlanProgressBar(this.low, this.high, this.maxlow, this.maxHigh,
{this.padding});
@override
State<StatefulWidget> createState() => PlanProgressBarState();
}
class PlanProgressBarState extends State<PlanProgressBar> {
double distance;
double leftStarPosPercent;
double leftPosTempPercent;
double rightStarPosPercent;
double rightPosTempPercent;
double leftDowPos;
double rightDowPos;
double scrollDistance;
double leftPos;
double textLeft = -1;
bool isLeftMove = true;
@override
void initState() {
super.initState();
distance = widget.maxHigh - widget.maxlow - 0.0;
leftStarPosPercent = (widget.low / distance);
leftPosTempPercent = leftStarPosPercent;
rightStarPosPercent = (widget.high / distance);
rightPosTempPercent = rightStarPosPercent;
}
@override
Widget build(BuildContext context) {
double totle = MediaQuery.of(context).size.width - widget.padding * 2 - 8;
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;
}
return Container(
width: double.maxFinite,
height: 65,
child: Stack(
children: <Widget>[
Positioned(
bottom: 7.5,
left: 4,
child: Container(
width: totle,
height: 4,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(50),
color: Color(0xffD5D5D5)),
),
),
Positioned(
left: leftPosTempPercent * totle + 5,
bottom: 7.5,
child: Container(
height: 4,
width: (rightPosTempPercent - leftPosTempPercent) * totle,
color: Color(0xff51CDC7),
),
),
Positioned(
left: textL,
bottom: 23,
child: Visibility(
visible: textLeft >= 0,
child: Container(
width: 67.5,
height: 42,
color: Color(0x66000000),
alignment: Alignment.center,
child: baseText(
"${(widget.maxlow + (isLeftMove?leftPosTempPercent:rightPosTempPercent+0.03) * distance).toInt()}",
13,
Colors.white),
),
),
),
Positioned(
bottom: 0,
left: leftPosTempPercent * totle,
child: Listener(
onPointerDown: (p) {
leftDowPos = p.localPosition.dx;
isLeftMove = true;
},
onPointerMove: (p) {
var d = p.localPosition.dx - leftDowPos;
leftPosTempPercent = leftStarPosPercent + (d / totle);
if (leftPosTempPercent < 0.0) {
leftPosTempPercent = 0;
} else if (leftPosTempPercent >
rightPosTempPercent - scrollDistance) {
leftPosTempPercent = rightPosTempPercent - scrollDistance;
}
textLeft = leftPosTempPercent;
setState(() {});
},
onPointerUp: (p) {
textLeft = -1;
leftStarPosPercent = leftPosTempPercent;
setState(() {});
},
child: Container(
width: 19,
height: 19,
alignment: Alignment.centerLeft,
child: Image.asset(
"assets/progress_inner.png",
),
),
)),
Positioned(
bottom: 0,
left: rightPosTempPercent * totle,
child: Listener(
onPointerDown: (p) {
rightDowPos = p.localPosition.dx;
isLeftMove = false;
},
onPointerMove: (p) {
var d = p.localPosition.dx - rightDowPos;
print("D ${d}");
rightPosTempPercent = rightStarPosPercent + (d / totle);
if (rightPosTempPercent <
leftPosTempPercent + scrollDistance) {
rightPosTempPercent = leftPosTempPercent + scrollDistance;
} else if (rightPosTempPercent > 1.0 - 0.03) {
rightPosTempPercent = 1.0 - 0.03;
}
textLeft = rightPosTempPercent;
setState(() {});
},
onPointerUp: (p) {
textLeft = -1;
rightStarPosPercent = rightPosTempPercent;
setState(() {});
},
child: Container(
width: 19,
height: 19,
alignment: Alignment.centerLeft,
child: Image.asset(
"assets/progress_inner.png",
),
),
)),
],
),
);
}
}
...@@ -5,8 +5,8 @@ ...@@ -5,8 +5,8 @@
class PlanBean { class PlanBean {
int error; int error;
String message; String message;
Null extra; String extra;
Null errorExtra; String errorExtra;
UserType userType; UserType userType;
Data data; Data data;
...@@ -39,7 +39,6 @@ class PlanBean { ...@@ -39,7 +39,6 @@ class PlanBean {
class UserType { class UserType {
UserType(); UserType();
UserType.fromJson(Map<String, dynamic> json) { UserType.fromJson(Map<String, dynamic> json) {
...@@ -177,14 +176,14 @@ class Groups { ...@@ -177,14 +176,14 @@ class Groups {
class Cities { class Cities {
String cityName; String cityName;
int id; String id;
String name; String name;
Cities({this.cityName, this.id, this.name}); Cities({this.cityName, this.id, this.name});
Cities.fromJson(Map<String, dynamic> json) { Cities.fromJson(Map<String, dynamic> json) {
cityName = json['city_name']; cityName = json['city_name'];
id = json['id']; id = json['id'].toString();
name = json['name']; name = json['name'];
} }
...@@ -205,7 +204,7 @@ class Tags { ...@@ -205,7 +204,7 @@ class Tags {
Tags({this.id, this.subTags, this.name}); Tags({this.id, this.subTags, this.name});
Tags.fromJson(Map<String, dynamic> json) { Tags.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'].toString();
if (json['sub_tags'] != null) { if (json['sub_tags'] != null) {
subTags = new List<SubTags>(); subTags = new List<SubTags>();
json['sub_tags'].forEach((v) { subTags.add(new SubTags.fromJson(v)); }); json['sub_tags'].forEach((v) { subTags.add(new SubTags.fromJson(v)); });
...@@ -231,7 +230,7 @@ class SubTags { ...@@ -231,7 +230,7 @@ class SubTags {
SubTags({this.id, this.name}); SubTags({this.id, this.name});
SubTags.fromJson(Map<String, dynamic> json) { SubTags.fromJson(Map<String, dynamic> json) {
id = json['id']; id = json['id'].toString();
name = json['name']; name = json['name'];
} }
......
...@@ -113,18 +113,27 @@ Widget baseDivideWidth(double width, double padding) { ...@@ -113,18 +113,27 @@ Widget baseDivideWidth(double width, double padding) {
} }
Widget loadingItem({bool needBackground = false}) { Widget loadingItem({bool needBackground = false}) {
// return
// Center(
// child: Container(
// width: 77,
// height: 77,
// decoration: BoxDecoration(
// borderRadius: BorderRadius.circular(8),
// color: needBackground ? Colors.black : Colors.transparent),
// alignment: Alignment.center,
// child: MyCupertinoActivityIndicator(
// backColor: needBackground ? Colors.white : Colors.black,
// ),
// ));
return Center( return Center(
child: Container( child: Container(
width: 77, width: 80,
height: 77, height: 80,
decoration: BoxDecoration( child: Lottie.asset("assets/smart_refresh_header.json",
borderRadius: BorderRadius.circular(8), repeat: true, reverse: false),
color: needBackground ? Colors.black : Colors.transparent),
alignment: Alignment.center,
child: MyCupertinoActivityIndicator(
backColor: needBackground ? Colors.white : Colors.black,
), ),
)); );
} }
Widget netErrorItem() {} Widget netErrorItem() {}
...@@ -311,7 +320,7 @@ Widget baseRefreshView(RefreshController refreshController, ...@@ -311,7 +320,7 @@ Widget baseRefreshView(RefreshController refreshController,
Widget normalRefreshHeader() { Widget normalRefreshHeader() {
return CustomHeader( return CustomHeader(
builder: (BuildContext context, RefreshStatus mode) { builder: (BuildContext context, RefreshStatus mode) {
Widget body=Container(); Widget body = Container();
// if (mode == RefreshStatus.idle) { // if (mode == RefreshStatus.idle) {
// //
// } else // } else
......
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