Commit 869a3860 authored by 朱翠翠's avatar 朱翠翠

Merge branch 'test' of http://git.wanmeizhensuo.com/linshengyu/gm_flutter into zcc/flutter

 Conflicts:
	lib/ClueModel/ClueRouter.dart
	lib/ClueModel/ClueRouterImpl.dart
	lib/ClueModel/server/api/ClueApi.dart
parents 5ea361b6 cac886d2
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -15,4 +15,6 @@ abstract class ClueRouter implements RouterBaser {
Widget getPlansCompareFeed();
Widget getLevelOnePage();
Widget getPlanPage();
}
......@@ -7,6 +7,7 @@ import 'package:gm_flutter/ClueModel/ClueRouter.dart';
import 'package:gm_flutter/ClueModel/page/PlansCompareFeed/PlansCompareFeedPage.dart';
import 'package:gm_flutter/ClueModel/page/ProjectDetails/ProjectDetailsPage.dart';
import 'package:gm_flutter/ClueModel/page/levelOne/LevelOnePage.dart';
import 'package:gm_flutter/ClueModel/page/plan/PlanPage.dart';
class ClueRouterImpl implements ClueRouter {
@override
......@@ -23,4 +24,9 @@ class ClueRouterImpl implements ClueRouter {
Widget getPlansCompareFeed() {
return PlansCompareFeedPage();
}
@override
Widget getPlanPage() {
return PlanPage();
}
}
......@@ -167,7 +167,7 @@ class LevelOneItem extends StatelessWidget {
Positioned(
left: 57,
top: 43.5,
child: FiveStarView(cards.hospital.star, 5),
child: FiveStarView(int.parse(cards.hospital.star), 5),
)
],
),
......
......@@ -10,6 +10,7 @@ import 'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
import 'package:gm_flutter/commonModel/rx/RxDispose.dart';
import 'package:gm_flutter/commonModel/util/PrintUtil.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
class LevelOneModel extends BaseModel {
......@@ -57,17 +58,19 @@ class LevelOneModel extends BaseModel {
cardsLive.notifyView(Pair(ENDLOADING, data));
});
// int index = currentIndex;
// if (clear) {
// data.clear();
// pageList = [1, 1, 1, 1];
// }
// ClueApiImpl.getInstance()
// .getLevelOneList(
// DioUtil.getInstance().getDio(), 123, list[index], pageList[index])
// .listen((event) {})
// .addToDispose(rxDispose)
// .onError((err) {});
int index = currentIndex;
if (clear) {
data.clear();
pageList = [1, 1, 1, 1];
}
ClueApiImpl.getInstance()
.getLevelOneList(
DioUtil.getInstance().getDio(), 123, list[index], pageList[index])
.listen((event) {})
.addToDispose(rxDispose)
.onError((err) {
PrintUtil.printBug(err);
});
}
int currentIndex = 0;
......@@ -96,5 +99,7 @@ class LevelOneModel extends BaseModel {
}
}
void loadMore() {}
void loadMore() {
}
}
......@@ -121,6 +121,8 @@ class LevelOneState extends BaseState<LevelOnePage>
}
},
)));
}
Widget home() {
......@@ -485,7 +487,6 @@ class LevelOneState extends BaseState<LevelOnePage>
height);
}
return Container(
color: Colors.yellow,
width: double.maxFinite,
height: height,
child: PageView.builder(
......
/*
* @author lsy
* @date 2020/7/1
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/commonModel/util/DartUtil.dart';
class FilterView extends StatelessWidget {
final Function(int high, int low) call;
FilterView(this.call);
int min = 0;
int max = 0;
@override
Widget build(BuildContext context) {
return Container(
color: Colors.white,
height: 186,
child: Stack(
children: <Widget>[
Positioned(
top: 54.5,
right: 15,
child: baseText("无限", 12, Color(0xff3FB5AF)),
),
Positioned(
top: 54.5,
left: 15,
child: baseText("¥0", 12, Color(0xff3FB5AF)),
),
Positioned(
top: 25,
left: 15,
child: baseText("价格区间:", 13, Color(0xff666666)),
),
Positioned(
bottom: 0,
child: Container(
width: MediaQuery.of(context).size.width,
height: 44.5,
child: Row(
children: <Widget>[
Expanded(
child: Container(
child: baseText("重置", 16, Color(0xff3FB5AF)),
alignment: Alignment.center,
).gestureDetector(() {
//TODO
}),
),
Expanded(
child: Container(
color: Color(0xff3FB5AF),
alignment: Alignment.center,
child: baseText("确定", 16, Colors.white),
).gestureDetector(() {
call(max, min);
}),
)
],
),
),
)
],
),
);
}
}
/*
* @author lsy
* @date 2020-01-02
**/
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_common/flutter_common.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
class PlanBarView extends StatelessWidget {
final LiveData<List> managerLive;
final Function(int showIndex) managerListener;
final ChangeNotifier notifier;
int showIndex = -1;
List normalData = ["全部项目", "智能排序", "筛选"];
PlanBarView(this.managerLive, this.managerListener, this.notifier) {
if (!notifier?.hasListeners) {
notifier?.addListener(() {
showIndex = -1;
managerListener(-1);
managerLive.notifyView(managerLive.data ?? normalData);
});
}
}
@override
Widget build(BuildContext context) {
return managerTop(context);
}
managerTop(BuildContext context) {
return Container(
width: double.maxFinite,
height: 45,
child: StreamBuilder<List>(
stream: managerLive.stream,
initialData: managerLive.data ?? normalData,
builder: (c, data) {
if (data.data.length != 3) {
return Container();
}
return Row(
children: <Widget>[
item(data.data[0], 0),
item(data.data[1], 1),
item(data.data[2], 2),
],
);
},
));
}
Widget item(String text, int index) {
return Expanded(
child: GestureDetector(
behavior: HitTestBehavior.opaque,
onTap: () {
if (index == showIndex) {
showIndex = -1;
} else {
showIndex = index;
}
managerListener(showIndex);
managerLive.notifyView(managerLive.data ?? normalData);
},
child: Container(
alignment: Alignment.center,
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
baseText(text, 14,
index == showIndex ? Color(0xff3FB5AF) : Color(0xff666666)),
Container(
width: 10,
height: 10,
padding: EdgeInsets.only(top: 3),
alignment: Alignment.topCenter,
child: Container(
width: 6,
height: 3.5,
child: index == showIndex
? Image.asset("assets/top_arrow.png")
: Image.asset("assets/bottom_arrow.png"),
),
)
],
),
),
),
);
}
}
/*
* @author lsy
* @date 2020/7/1
**/
import 'package:cached_network_image/cached_network_image.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
class PlanItem extends StatelessWidget {
final Plans plans;
PlanItem(this.plans);
@override
Widget build(BuildContext context) {
return Container(
margin: EdgeInsets.only(top: 10, left: 10, right: 10),
child: Container(
height: 90,
decoration: BoxDecoration(
color: Colors.white, borderRadius: BorderRadius.circular(4)),
child: Stack(
children: <Widget>[
Positioned(
top: 10,
left: 10,
child: Container(
width: 70,
height: 70,
child: ClipRRect(
borderRadius: BorderRadius.circular(4),
child: CachedNetworkImage(
imageUrl: "",
fit: BoxFit.cover,
),
),
),
),
Positioned(
left: 92,
top: 14,
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
baseText(plans.name, 14, Color(0xff282828)),
Container(
margin: EdgeInsets.only(left: 4),
child: Container(
width: 28,
height: 15,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(2),
color: Color(0xffF0F9F7)),
alignment: Alignment.center,
child: baseText("??", 11, Color(0xff3FB5AF)),
),
)
],
),
),
Positioned(
top: 13,
right: 10,
child: Row(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.end,
children: <Widget>[
baseText("好评率", 11, Color(0xff282828)),
Container(
width: 4,
),
baseText(plans.positiveRate, 14, Color(0xffFF5963))
],
),
),
Positioned(
bottom: 14,
right: 10,
child: baseText("销量${plans.salesCount}", 11, Color(0xff282828)),
),
Positioned(
left: 91,
bottom: 14,
child: Row(
mainAxisSize: MainAxisSize.min,
children: <Widget>[
baseText("¥", 10, Color(0xffFF5963)),
baseText("${plans.minPrice}-${plans.maxPrice}", 13,
Color(0xffFF5963)),
],
),
),
Positioned(
left: 92,
top: 36,
child: baseText("TODO", 11, Color(0xff999999)),
)
],
),
),
);
}
}
/*
* @author lsy
* @date 2020/6/30
**/
import 'package:flutter/foundation.dart';
import 'package:flutter_common/commonModel/live/BaseModel.dart';
import 'package:flutter_common/commonModel/live/LiveData.dart';
import 'package:flutter_common/commonModel/toast/NativeToast.dart';
import 'package:gm_flutter/ClueModel/page/plan/PlanTest.dart';
import 'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanBean.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
import 'package:gm_flutter/commonModel/rx/RxDispose.dart';
import 'package:gm_flutter/commonModel/util/PrintUtil.dart';
class PlanModel extends BaseModel {
LiveData<List> managerLive = new LiveData();
LiveData<List<double>> posLive = new LiveData();
LiveData<List<double>> backLive = new LiveData();
LiveData<List<Ranks>> picLive = LiveData();
LiveData<int> stateLive = LiveData();
double menuBottom;
int menuIndex = -1;
bool needChangBack = true;
LiveData<Pair<int, List<Plans>>> feedsLive = LiveData();
List<Plans> feedDatas = [];
List<Tags> projectData = [];
List<Orders> sortList = [];
RxDispose rxDispose = RxDispose();
String tag_id = "";
String order_by = "";
String current_city_id = "";
String min_price = "";
String max_price = "";
String rank_type = "";
int page = 1;
int sortPos = 0;
void init() {
ClueApiImpl.getInstance()
.getPlan(DioUtil.getInstance().getDio())
.listen((event) {
if (event.error == 0) {
projectData = event.data.tags;
sortList = event.data.orders;
picLive.notifyView(event.data.ranks);
stateLive.notifyView(ENDLOADING);
refreshFeed(true);
} else {
stateLive.notifyView(FAIL);
NativeToast.showNativeToast(event.message);
}
})
.addToDispose(rxDispose)
.onError((err) {
PrintUtil.printBug(err);
stateLive.notifyView(FAIL);
});
}
void projectClick(String id) {
if (tag_id == id) {
return;
}
tag_id = id;
feedsLive.notifyView(Pair(LOADING, null));
refreshFeed(true);
}
void refreshFeed(bool clear) {
if (clear) {
feedDatas.clear();
}
ClueApiImpl.getInstance()
.getPlanFeed(DioUtil.getInstance().getDio(), tag_id, order_by,
current_city_id, min_price, max_price, rank_type, page)
.listen((event) {
if (event.error == 0) {
if (event.data.plans == null || event.data.plans.isEmpty) {
feedsLive.notifyView(Pair(ENDLOADING, []));
} else {
feedDatas.addAll(event.data.plans);
feedsLive.notifyView(Pair(ENDLOADING, feedDatas));
}
} else {
NativeToast.showNativeToast(event.message);
feedsLive.notifyView(Pair(FAIL, null));
}
})
.addToDispose(rxDispose)
.onError((err) {
PrintUtil.printBug(err);
feedsLive.notifyView(Pair(FAIL, null));
});
}
@override
void dispose() {
stateLive.dispost();
picLive.dispost();
rxDispose.dispose();
managerLive.dispost();
posLive.dispost();
backLive.dispost();
feedsLive.dispost();
}
void backProgress(double pro, int index) {
if (needChangBack || menuIndex == -1) {
backLive.notifyView([0.0, menuBottom, pro]);
}
}
void loadMore() {
page++;
refreshFeed(false);
}
void sortClick(int index) {
if (index == sortPos) {
return;
}
sortPos = index;
order_by = sortList[index].id.toString();
refreshFeed(true);
}
void filterClick(int max, int min) {
if (max_price == max.toString() && min_price == min.toString()) {
return;
}
max_price = max.toString();
min_price = min.toString();
refreshFeed(true);
}
}
This diff is collapsed.
This diff is collapsed.
/*
* @author lsy
* @date 2020/7/1
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanBean.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/commonModel/bean/Pair.dart';
import 'package:gm_flutter/commonModel/util/DartUtil.dart';
class ProjectView extends StatefulWidget {
final List<Tags> datas;
final Function(String id) clickCall;
ProjectView(this.datas, this.clickCall);
@override
State<StatefulWidget> createState() => ProjectViewState();
}
class ProjectViewState extends State<ProjectView> {
int selectIndex = 0;
@override
Widget build(BuildContext context) {
if (widget.datas == null || widget.datas.isEmpty) {
return Container();
}
return Container(
height: 450,
color: Colors.white,
child: Row(
children: <Widget>[
Container(
width: 75,
child: ListView.builder(
itemBuilder: (c, index) {
return Container(
height: 50,
color:
selectIndex == index ? Colors.white : Color(0xffF4F3F8),
child: Stack(
alignment: AlignmentDirectional.center,
children: <Widget>[
baseText(
widget.datas[index].name,
14,
selectIndex == index
? Color(0xff4ABAB4)
: Color(0xff464646),
bold: selectIndex == index ? true : false),
Positioned(
left: 0,
top: 17,
child: selectIndex == index
? Container(
width: 3,
height: 16,
decoration: BoxDecoration(
color: Color(0xff4ABAB4),
borderRadius: BorderRadius.circular(1.5)),
)
: Container(),
)
],
)).gestureDetector(() {
setState(() {
selectIndex = index;
});
});
},
itemCount: widget.datas.length,
),
),
Expanded(
child: ListView.builder(
itemBuilder: (c, index) {
return Container(
margin: EdgeInsets.only(left: 20, top: 18, bottom: 18),
child: baseText(widget.datas[selectIndex].subTags[index].name,
14, Color(0xff464646)),
).gestureDetector(() {
widget.clickCall(widget.datas[selectIndex].subTags[index].id);
});
},
itemCount: widget.datas[selectIndex].subTags.length,
),
)
],
),
);
}
}
/*
* @author lsy
* @date 2020/7/1
**/
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanBean.dart';
import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import 'package:gm_flutter/commonModel/util/DartUtil.dart';
class SortView extends StatelessWidget {
final List<Orders> datas;
int selectIndex = 0;
final Function(int index) clickIndex;
SortView(this.datas, this.selectIndex, this.clickIndex);
@override
Widget build(BuildContext context) {
if (datas == null || datas.isEmpty) {
return Container();
}
return Container(
color: Colors.white,
child: ListView.builder(
itemBuilder: (c, index) {
return Container(
margin: EdgeInsets.only(left: 15, right: 15),
width: double.maxFinite,
height: 45,
child: Stack(
children: <Widget>[
Positioned(
top: 16,
child: baseText(
datas[index].name,
13,
selectIndex == index
? Color(0xff4ABAB4)
: Color(0xff464646)),
),
Positioned(
right: 0,
top: 15,
child: selectIndex == index
? Container(
width: 15,
height: 15,
child: Image.asset("assets/yes.png"),
)
: Container(),
),
Positioned(
bottom: 0,
child: Container(
height: 0.5,
width: MediaQuery.of(context).size.width - 30,
color: Color(0xffE5E5E5),
),
)
],
),
).gestureDetector(() {
clickIndex(index);
});
},
itemCount: datas.length,
));
}
}
......@@ -8,6 +8,8 @@ import 'package:flutter_common/Annotations/anno/ServiceCenter.dart';
import 'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart';
import 'package:gm_flutter/ClueModel/server/entity/ProjectDetailsItem.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanBean.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
@ServiceCenter()
abstract class ClueApi {
......@@ -21,4 +23,18 @@ abstract class ClueApi {
@Get("api/janus/plans/plan_feed")
LevelOneFeedList getLevelOneList(@Query("plan_id") int plan_id,
@Query("tab_type") String tab_type, @Query("page") int page);
@Get("api/janus/plans/options")
PlanBean getPlan();
@Get("api/janus/plans/feed")
PlanFeedBean getPlanFeed(
@Query("tag_id")String tag_id,
@Query("order_by")String order_by,
@Query("current_city_id")String current_city_id,
@Query("min_price")String min_price,
@Query("max_price")String max_price,
@Query("rank_type")String rank_type,
@Query("page")int page,
);
}
......@@ -17,6 +17,8 @@ import 'package:flutter/foundation.dart';
import 'package:gm_flutter/ClueModel/server/entity/ProjectDetailsItem.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart';
import 'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanBean.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
const bool inProduction = const bool.fromEnvironment("dart.vm.product");
......@@ -81,6 +83,47 @@ class ClueApiImpl {
});
}
Stream<PlanBean> getPlan(
Dio _dio,
) {
return Stream.fromFuture(get(_dio, 'api/janus/plans/options'))
.flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
return Stream.fromFuture(compute(parsePlanBean, value.toString()));
} else {
throw Exception("--未知网络错误--");
}
});
}
Stream<PlanFeedBean> getPlanFeed(
Dio _dio,
String tag_id,
String order_by,
String current_city_id,
String min_price,
String max_price,
String rank_type,
int page) {
return Stream.fromFuture(get(_dio, 'api/janus/plans/feed', data: {
'tag_id': tag_id,
'order_by': order_by,
'current_city_id': current_city_id,
'min_price': min_price,
'max_price': max_price,
'rank_type': rank_type,
'page': page,
})).flatMap((value) {
if (value != null &&
(value.statusCode >= 200 && value.statusCode < 300)) {
return Stream.fromFuture(compute(parsePlanFeedBean, value.toString()));
} else {
throw Exception("--未知网络错误--");
}
});
}
///==================base method==================
Future<Response> get(Dio _dio, url, {data, options, cancelToken}) async {
......@@ -229,3 +272,11 @@ PlansCompareFeed parsePlansCompareFeed(String value) {
LevelOneFeedList parseLevelOneFeedList(String value) {
return LevelOneFeedList.fromJson(json.decode(value));
}
PlanBean parsePlanBean(String value) {
return PlanBean.fromJson(json.decode(value));
}
PlanFeedBean parsePlanFeedBean(String value) {
return PlanFeedBean.fromJson(json.decode(value));
}
/*
* @author lsy
* @date 2020/7/1
**/
class PlanBean {
int error;
String message;
Null extra;
Null errorExtra;
UserType userType;
Data data;
PlanBean({this.error, this.message, this.extra, this.errorExtra, this.userType, this.data});
PlanBean.fromJson(Map<String, dynamic> json) {
error = json['error'];
message = json['message'];
extra = json['extra'];
errorExtra = json['error_extra'];
userType = json['user_type'] != null ? new UserType.fromJson(json['user_type']) : null;
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
data['extra'] = this.extra;
data['error_extra'] = this.errorExtra;
if (this.userType != null) {
data['user_type'] = this.userType.toJson();
}
if (this.data != null) {
data['data'] = this.data.toJson();
}
return data;
}
}
class UserType {
UserType();
UserType.fromJson(Map<String, dynamic> json) {
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
return data;
}
}
class Data {
List<Ranks> ranks;
List<Areas> areas;
List<Tags> tags;
List<Orders> orders;
Data({this.ranks, this.areas, this.tags, this.orders});
Data.fromJson(Map<String, dynamic> json) {
if (json['ranks'] != null) {
ranks = new List<Ranks>();
json['ranks'].forEach((v) { ranks.add(new Ranks.fromJson(v)); });
}
if (json['areas'] != null) {
areas = new List<Areas>();
json['areas'].forEach((v) { areas.add(new Areas.fromJson(v)); });
}
if (json['tags'] != null) {
tags = new List<Tags>();
json['tags'].forEach((v) { tags.add(new Tags.fromJson(v)); });
}
if (json['orders'] != null) {
orders = new List<Orders>();
json['orders'].forEach((v) { orders.add(new Orders.fromJson(v)); });
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.ranks != null) {
data['ranks'] = this.ranks.map((v) => v.toJson()).toList();
}
if (this.areas != null) {
data['areas'] = this.areas.map((v) => v.toJson()).toList();
}
if (this.tags != null) {
data['tags'] = this.tags.map((v) => v.toJson()).toList();
}
if (this.orders != null) {
data['orders'] = this.orders.map((v) => v.toJson()).toList();
}
return data;
}
}
class Ranks {
String name;
String gmUrl;
String icon;
Ranks({this.name, this.gmUrl, this.icon});
Ranks.fromJson(Map<String, dynamic> json) {
name = json['name'];
gmUrl = json['gm_url'];
icon = json['icon'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['name'] = this.name;
data['gm_url'] = this.gmUrl;
data['icon'] = this.icon;
return data;
}
}
class Areas {
bool isLocated;
String name;
List<Groups> groups;
Areas({this.isLocated, this.name, this.groups});
Areas.fromJson(Map<String, dynamic> json) {
isLocated = json['is_located'];
name = json['name'];
if (json['groups'] != null) {
groups = new List<Groups>();
json['groups'].forEach((v) { groups.add(new Groups.fromJson(v)); });
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['is_located'] = this.isLocated;
data['name'] = this.name;
if (this.groups != null) {
data['groups'] = this.groups.map((v) => v.toJson()).toList();
}
return data;
}
}
class Groups {
bool isHot;
String initial;
List<Cities> cities;
String title;
Groups({this.isHot, this.initial, this.cities, this.title});
Groups.fromJson(Map<String, dynamic> json) {
isHot = json['is_hot'];
initial = json['initial'];
if (json['cities'] != null) {
cities = new List<Cities>();
json['cities'].forEach((v) { cities.add(new Cities.fromJson(v)); });
}
title = json['title'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['is_hot'] = this.isHot;
data['initial'] = this.initial;
if (this.cities != null) {
data['cities'] = this.cities.map((v) => v.toJson()).toList();
}
data['title'] = this.title;
return data;
}
}
class Cities {
String cityName;
int id;
String name;
Cities({this.cityName, this.id, this.name});
Cities.fromJson(Map<String, dynamic> json) {
cityName = json['city_name'];
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['city_name'] = this.cityName;
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class Tags {
String id;
List<SubTags> subTags;
String name;
Tags({this.id, this.subTags, this.name});
Tags.fromJson(Map<String, dynamic> json) {
id = json['id'];
if (json['sub_tags'] != null) {
subTags = new List<SubTags>();
json['sub_tags'].forEach((v) { subTags.add(new SubTags.fromJson(v)); });
}
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
if (this.subTags != null) {
data['sub_tags'] = this.subTags.map((v) => v.toJson()).toList();
}
data['name'] = this.name;
return data;
}
}
class SubTags {
String id;
String name;
SubTags({this.id, this.name});
SubTags.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
class Orders {
int id;
String name;
Orders({this.id, this.name});
Orders.fromJson(Map<String, dynamic> json) {
id = json['id'];
name = json['name'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['id'] = this.id;
data['name'] = this.name;
return data;
}
}
/*
* @author lsy
* @date 2020/7/1
**/
class PlanFeedBean {
int error;
String message;
String extra;
String errorExtra;
UserType userType;
Data data;
PlanFeedBean(
{this.error,
this.message,
this.extra,
this.errorExtra,
this.userType,
this.data});
PlanFeedBean.fromJson(Map<String, dynamic> json) {
error = json['error'];
message = json['message'];
extra = json['extra'];
errorExtra = json['error_extra'];
userType = json['user_type'] != null
? new UserType.fromJson(json['user_type'])
: null;
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['error'] = this.error;
data['message'] = this.message;
data['extra'] = this.extra;
data['error_extra'] = this.errorExtra;
if (this.userType != null) {
data['user_type'] = this.userType.toJson();
}
if (this.data != null) {
data['data'] = this.data.toJson();
}
return data;
}
}
class UserType {
UserType();
UserType.fromJson(Map<String, dynamic> json) {}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
return data;
}
}
class Data {
List<Plans> plans;
Data({this.plans});
Data.fromJson(Map<String, dynamic> json) {
if (json['plans'] != null) {
plans = new List<Plans>();
json['plans'].forEach((v) {
plans.add(new Plans.fromJson(v));
});
}
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
if (this.plans != null) {
data['plans'] = this.plans.map((v) => v.toJson()).toList();
}
return data;
}
}
class Plans {
String cardType;
String name;
String positiveRate;
String salesCount;
List<BaseAttrs> baseAttrs;
String minPrice;
String maxPrice;
String projectImage;
Plans(
{this.cardType,
this.name,
this.positiveRate,
this.salesCount,
this.baseAttrs,
this.minPrice,
this.maxPrice,
this.projectImage});
Plans.fromJson(Map<String, dynamic> json) {
cardType = json['card_type'];
name = json['name'];
positiveRate = json['positive_rate'];
salesCount = json['sales_count'];
if (json['base_attrs'] != null) {
baseAttrs = new List<BaseAttrs>();
json['base_attrs'].forEach((v) {
baseAttrs.add(new BaseAttrs.fromJson(v));
});
}
minPrice = json['min_price'];
maxPrice = json['max_price'];
projectImage = json['project_image'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['card_type'] = this.cardType;
data['name'] = this.name;
data['positive_rate'] = this.positiveRate;
data['sales_count'] = this.salesCount;
if (this.baseAttrs != null) {
data['base_attrs'] = this.baseAttrs.map((v) => v.toJson()).toList();
}
data['min_price'] = this.minPrice;
data['max_price'] = this.maxPrice;
data['project_image'] = this.projectImage;
return data;
}
}
class BaseAttrs {
int attrId;
String attrName;
String attrValue;
BaseAttrs({this.attrId, this.attrName, this.attrValue});
BaseAttrs.fromJson(Map<String, dynamic> json) {
attrId = json['attr_id'];
attrName = json['attr_name'];
attrValue = json['attr_value'];
}
Map<String, dynamic> toJson() {
final Map<String, dynamic> data = new Map<String, dynamic>();
data['attr_id'] = this.attrId;
data['attr_name'] = this.attrName;
data['attr_value'] = this.attrValue;
return data;
}
}
......@@ -28,6 +28,9 @@ class TestState extends BaseState<TestPage> {
list.add(listItem("一级列表页", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getLevelOnePage());
}));
list.add(listItem("方案页面", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getPlanPage());
}));
return list;
}
......
......@@ -12,6 +12,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:gm_flutter/commonModel/GMBase.dart';
import 'package:gm_flutter/commonModel/util/DartUtil.dart';
import 'package:gm_flutter/commonModel/view/ImagesAnimation.dart';
import 'package:lottie/lottie.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';
double SCREENWIDTH;
......@@ -271,19 +272,23 @@ Widget baseRefreshView(RefreshController refreshController,
onRefresh: refresh,
footer: CustomFooter(
builder: (BuildContext context, LoadStatus mode) {
Widget body;
print("LOAD STATUE ${mode}");
if (mode == LoadStatus.idle) {
body = baseText("上拉加载更多", 12, Color(0xff545454));
} else if (mode == LoadStatus.loading) {
body = baseText("加载中", 12, Color(0xff545454));
} else if (mode == LoadStatus.failed) {
body = baseText("加载失败", 12, Color(0xff545454));
} else if (mode == LoadStatus.noMore) {
body = baseText("没有更多数据了", 12, Color(0xff545454));
}
else {
body = Container();
Widget body = Container();
// print("LOAD STATUE ${mode}");
// if (mode == LoadStatus.idle) {
// body = baseText("上拉加载更多", 12, Color(0xff545454));
// } else if (mode == LoadStatus.loading) {
// body = baseText("加载中", 12, Color(0xff545454));
// } else if (mode == LoadStatus.failed) {
// body = baseText("加载失败", 12, Color(0xff545454));
// } else if (mode == LoadStatus.noMore) {
// body = baseText("没有更多数据了", 12, Color(0xff545454));
// }
// else {
// body = Container();
// }
if (mode == LoadStatus.loading) {
body = Lottie.asset("assets/smart_refresh_header.json",
repeat: true, reverse: false);
}
return Container(
height: 55.0,
......@@ -306,26 +311,29 @@ Widget baseRefreshView(RefreshController refreshController,
Widget normalRefreshHeader() {
return CustomHeader(
builder: (BuildContext context, RefreshStatus mode) {
Widget body;
Widget body=Container();
// if (mode == RefreshStatus.idle) {
//
// } else
if (mode == RefreshStatus.refreshing) {
body = ImagesAnimation(
w: 46,
h: 15,
durationSeconds: 1500,
entry: ImagesAnimationEntry(1, 20, "assets/ptr_header_loading"));
// body = ImagesAnimation(
// w: 46,
// h: 15,
// durationSeconds: 1500,
// entry: ImagesAnimationEntry(1, 20, "assets/ptr_header_loading"));
body = Lottie.asset("assets/smart_refresh_header.json",
repeat: true, reverse: false);
}
// else if (mode == RefreshStatus.failed) {
// body = Text("Load Failed!Click retry!");
// }
else {
body = Image.asset(
"assets/ptr_header_loading01.png",
width: 46,
height: 15,
);
// body = Image.asset(
// "assets/ptr_header_loading01.png",
// width: 46,
// height: 15,
// );
}
return Container(
height: 55.0,
......@@ -335,7 +343,6 @@ Widget normalRefreshHeader() {
);
}
Widget emptyItem({String detail}) {
return Column(
mainAxisSize: MainAxisSize.min,
......
......@@ -15,6 +15,7 @@ class BasePopMenu extends StatefulWidget {
final int maxHeight;
final Widget child;
final BaseMenuListener listener;
final Function(double progress) proListener;
BasePopMenu(
{this.leftPos,
......@@ -23,11 +24,13 @@ class BasePopMenu extends StatefulWidget {
this.width,
this.height,
this.child,
this.listener});
this.listener,
this.proListener});
@override
State<StatefulWidget> createState() {
return BasePopMenuState();;
return BasePopMenuState();
;
}
}
......@@ -37,6 +40,7 @@ class BasePopMenuState extends State<BasePopMenu>
AnimationController animationController;
LiveData<double> _liveData = LiveData();
bool isOpen = false;
bool isDestory = false;
@override
void initState() {
......@@ -45,12 +49,15 @@ class BasePopMenuState extends State<BasePopMenu>
duration: const Duration(milliseconds: 300), vsync: this)
..addListener(() {
_liveData.notifyView(animation.value * widget.maxHeight);
if (widget.proListener != null && !isDestory) {
widget.proListener(animation.value);
}
});
animation = new Tween(begin: 0.0, end: 1.0).animate(animationController);
widget.listener.addListener(() {
if(widget.listener.isShow){
if (widget.listener.isShow) {
animationController.forward();
}else{
} else {
animationController.reverse();
}
});
......@@ -77,6 +84,7 @@ class BasePopMenuState extends State<BasePopMenu>
@override
void dispose() {
isDestory = true;
_liveData.dispost();
animationController.dispose();
super.dispose();
......
......@@ -5,10 +5,12 @@ import 'package:flutter_boost/flutter_boost.dart';
import 'package:flutter_common/Annotations/anno/RouterCenter.dart';
import 'package:flutter_common/commonModel/util/WindowUtil.dart';
import 'package:gm_flutter/main.mark.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'DemoPage.dart';
import 'DemoPage1.dart';
import 'commonModel/base/BaseUtil.dart';
import 'commonModel/cache/CacheManager.dart';
import 'commonModel/nav/NavigationService.dart';
import 'main.mark.dart';
......@@ -31,6 +33,9 @@ void main() {
runApp(
MyAppWidget(),
);
SharedPreferences.getInstance().then((value) {
sharedPreferences = value;
});
RouterCenterImpl().findMainRouter().init();
}, (Object error, StackTrace stack) {
//TODO
......
......@@ -106,6 +106,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.2.0+1"
characters:
dependency: transitive
description:
name: characters
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.0.0"
charcode:
dependency: transitive
description:
......@@ -356,6 +363,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.11.4"
lottie:
dependency: "direct main"
description:
name: lottie
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.4.0+1"
matcher:
dependency: transitive
description:
......
......@@ -31,6 +31,7 @@ dependencies:
permission_handler: ^5.0.0
#轻量级存储
shared_preferences: ^0.5.7+1
lottie: ^0.4.0+1
dev_dependencies:
......
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