Commit c22fb1c0 authored by 林生雨's avatar 林生雨

Merge branch 'zcc/flutter' into 'test'

Zcc/flutter

See merge request !5
parents 109daea9 e297f014
......@@ -22,8 +22,11 @@ class PlansCompareFeedItemView extends StatelessWidget {
}
getFirstLevelItem() {
Container(
margin: EdgeInsets.all(4.0),
return Container(
width: double.maxFinite,
height: 90,
alignment: Alignment.centerLeft,
padding: EdgeInsets.only(left: 15, right: 15, top: 20, bottom: 20),
child: Row(
children: <Widget>[
Radio(
......@@ -32,51 +35,56 @@ class PlansCompareFeedItemView extends StatelessWidget {
onChanged: (value) {
groupValue = value;
}),
ClipRRect(
borderRadius: BorderRadius.circular(2.0),
child: Image.network(
plan.projectImage,
width: 50,
height: 50,
fit: BoxFit.fill,
Container(
margin: EdgeInsets.only(left: 15, right: 15),
child: ClipRRect(
borderRadius: BorderRadius.circular(2.0),
child: Image.network(
plan.projectImage,
width: 50,
height: 50,
fit: BoxFit.fill,
),
),
),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 8.0),
Container(
height: 50,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Row(
children: <Widget>[
Text(
plan.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFF282828)),
maxLines: 1,
),
Text(
"好评率 ",
style: TextStyle(fontSize: 11, color: Color(0xFF282828)),
maxLines: 1,
),
Text(
plan.positiveRate,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFFFF5963)),
maxLines: 1,
),
],
Container(
margin: EdgeInsets.only(top: 2, bottom: 5),
child: Row(
children: <Widget>[
Text(
plan.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFF282828)),
maxLines: 1,
),
Text(
"好评率 ",
style:
TextStyle(fontSize: 11, color: Color(0xFF282828)),
maxLines: 1,
),
Text(
plan.positiveRate,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFFFF5963)),
maxLines: 1,
),
],
),
),
Row(
children: <Widget>[
Text(
'¥${plan.minPrice}-${plan.maxPrice})',
'¥${plan.minPrice}-${plan.maxPrice}',
style: TextStyle(fontSize: 13, color: Color(0xFFFF5963)),
),
Text(
......@@ -88,15 +96,18 @@ class PlansCompareFeedItemView extends StatelessWidget {
)
],
),
))
)
],
),
);
}
getSecondLevelItem() {
Container(
margin: EdgeInsets.all(4.0),
return Container(
width: double.maxFinite,
height: 77,
alignment: Alignment.centerLeft,
margin: EdgeInsets.only(left: 15, right: 15),
child: Row(
children: <Widget>[
Radio(
......@@ -105,37 +116,44 @@ class PlansCompareFeedItemView extends StatelessWidget {
onChanged: (value) {
groupValue = value;
}),
Expanded(
child: Container(
margin: EdgeInsets.only(left: 8.0),
height: 50,
Container(
margin: EdgeInsets.only(left: 15.0),
height: 77,
alignment: Alignment.centerLeft,
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
plan.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFF282828)),
maxLines: 1,
Container(
margin: EdgeInsets.only(top: 13.0, bottom: 12),
child: Text(
plan.name,
style: TextStyle(
fontWeight: FontWeight.bold,
fontSize: 14,
color: Color(0xFF282828)),
maxLines: 1,
),
),
Row(
children: <Widget>[
Text(
'¥${plan.minPrice}-${plan.maxPrice})',
'¥${plan.minPrice}-${plan.maxPrice}',
style: TextStyle(fontSize: 13, color: Color(0xFFFF5963)),
),
Text(
"指导价:¥${plan.guidePrice}",
style: TextStyle(fontSize: 11, color: Color(0xFF282828)),
maxLines: 1,
)
Container(
alignment: Alignment.centerRight,
child: Text(
"指导价:¥${plan.guidePrice}",
style:
TextStyle(fontSize: 11, color: Color(0xFF282828)),
maxLines: 1,
),
),
],
)
],
),
))
)
],
),
);
......
......@@ -4,6 +4,7 @@ import 'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart';
import 'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart';
import 'package:gm_flutter/commonModel/net/DioUtil.dart';
import 'package:gm_flutter/commonModel/rx/RxDispose.dart';
import 'package:gm_flutter/commonModel/util/PrintUtil.dart';
class PlansCompareFeedModel extends BaseModel {
LiveData<PlansCompareFeed> liveData = LiveData();
......@@ -13,12 +14,12 @@ class PlansCompareFeedModel extends BaseModel {
ClueApiImpl.getInstance()
.getPlansCompareFeed(DioUtil.getInstance().getDio(), 123, 1)
.listen((event) {
if (event.error == 0) {
liveData.notifyView(event);
}
liveData.notifyView(event);
})
.addToDispose(rxDispose)
.onError((err) {});
.onError((err) {
PrintUtil.printBug(err);
});
}
@override
......
......@@ -38,9 +38,12 @@ class PlansCompareFeedState extends BaseState<PlansCompareFeedPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("方案对比"),
),
appBar: baseAppBar(
title: "方案对比",
centerTitle: true,
backClick: () {
Navigator.pop(context);
}),
body: Center(
child: getBody(),
),
......@@ -75,11 +78,19 @@ class PlansCompareFeedState extends BaseState<PlansCompareFeedPage> {
getBody() {
return StreamBuilder(
stream: _model.liveData.stream,
initialData: PlansCompareFeed(),
initialData: _model.liveData.data ?? null,
builder: (c, data) {
if (_model.liveData.data == null) {
return loadingItem();
}
PlansCompareFeed item = data.data;
if (item == null || item.data == null || item.data.plans == null) {
return loadingItem();
return emptyItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height);
}
if (item.error != 0) {
return errorItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height, () {});
}
return getList(item.data.plans);
},
......
......@@ -18,13 +18,22 @@ class ProjectDetailsItemView extends StatelessWidget {
for (var item in listData.attrs) {
tiles.add(getItem(item));
}
var row = Row(
var column = Column(
children: <Widget>[
Container(
padding: EdgeInsets.only(top: 8.0, bottom: 8.0, left: 20),
padding: EdgeInsets.only(left: 15.0),
margin: EdgeInsets.only(bottom: 16.0),
alignment: Alignment.centerLeft,
width: double.maxFinite,
height: 55,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage("assets/bg_project_detail_item.png"),
fit: BoxFit.cover)),
child: Text(
listData.name,
style: TextStyle(
fontWeight: FontWeight.bold,
color: Color(0xFF000000),
fontSize: 15.0,
),
......@@ -36,30 +45,38 @@ class ProjectDetailsItemView extends StatelessWidget {
],
);
return Container(
margin: EdgeInsets.only(bottom: 5, left: 20),
child: row,
margin: EdgeInsets.only(bottom: 5),
child: column,
);
}
getItem(Attrs attrs) {
var row = Container(
margin: EdgeInsets.only(bottom: 25),
width: double.maxFinite,
margin: EdgeInsets.only(bottom: 25, left: 15, right: 15),
child: Row(
children: <Widget>[
Text(
attrs.attrName,
style: TextStyle(
color: Color(0xFF999999),
fontSize: 13.0,
Container(
margin: EdgeInsets.only(right: 25.0),
alignment: Alignment.centerLeft,
width: 78,
child: Text(
attrs.attrName,
style: TextStyle(
color: Color(0xFF999999),
fontSize: 13.0,
),
),
),
Text(
attrs.attrValue,
style: TextStyle(
color: Color(0xFF282828),
fontSize: 14.0,
Container(
alignment: Alignment.centerLeft,
child: Text(
attrs.attrValue,
style: TextStyle(
color: Color(0xFF282828),
fontSize: 14.0,
),
),
maxLines: 1,
),
],
),
......
......@@ -20,15 +20,12 @@ class ProjectDetailsModel extends BaseModel {
ClueApiImpl.getInstance()
.getProjectDetails(DioUtil.getInstance().getDio(), 123)
.listen((event) {
print(event);
if (event.error == 0) {
liveData.notifyView(event);
}
liveData.notifyView(event);
})
.addToDispose(rxDispose)
.onError((err) {
PrintUtil.printBug(err);
});
PrintUtil.printBug(err);
});
}
@override
......
......@@ -38,11 +38,12 @@ class ProjectDetailsState extends BaseState<ProjectDetailsPage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: baseAppBar(title: "项目说明",
centerTitle: true,
backClick: (){
Navigator.pop(context);
}),
appBar: baseAppBar(
title: "项目说明",
centerTitle: true,
backClick: () {
Navigator.pop(context);
}),
body: Center(
child: getBody(),
),
......@@ -52,11 +53,19 @@ class ProjectDetailsState extends BaseState<ProjectDetailsPage> {
getBody() {
return StreamBuilder(
stream: _model.liveData.stream,
initialData: ProjectDetailsItem(),
initialData: _model.liveData.data ?? null,
builder: (c, data) {
if (_model.liveData.data == null) {
return loadingItem();
}
ProjectDetailsItem item = data.data;
if (item == null || item.data == null || item.data.groups == null) {
return loadingItem();
return emptyItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height);
}
if (item.error != 0) {
return errorItem(MediaQuery.of(context).size.width,
MediaQuery.of(context).size.height, () {});
}
return ListView.builder(
itemCount: item.data.groups.length,
......
......@@ -14,11 +14,11 @@ import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
@ServiceCenter()
abstract class ClueApi {
@Get("/api/janus/plans/plan_detail")
ProjectDetailsItem getProjectDetails(@Query("plan_id") int plan_id);
ProjectDetailsItem getProjectDetails(@Query("plan_id") double plan_id);
@Get("/api/janus/plans/compare_feed")
PlansCompareFeed getPlansCompareFeed(
@Query("plan_id") int plan_id, @Query("plan_type") int plan_type);
@Query("plan_id") double plan_id, @Query("plan_type") double plan_type);
@Get("api/janus/plans/plan_feed")
LevelOneFeedList getLevelOneList(@Query("plan_id") int plan_id,
......
......@@ -37,7 +37,7 @@ class ClueApiImpl {
return _instance;
}
Stream<ProjectDetailsItem> getProjectDetails(Dio _dio, int plan_id) {
Stream<ProjectDetailsItem> getProjectDetails(Dio _dio, double plan_id) {
return Stream.fromFuture(get(_dio, '/api/janus/plans/plan_detail', data: {
'plan_id': plan_id,
})).flatMap((value) {
......@@ -52,7 +52,7 @@ class ClueApiImpl {
}
Stream<PlansCompareFeed> getPlansCompareFeed(
Dio _dio, int plan_id, int plan_type) {
Dio _dio, double plan_id, double plan_type) {
return Stream.fromFuture(get(_dio, '/api/janus/plans/compare_feed', data: {
'plan_id': plan_id,
'plan_type': plan_type,
......
......@@ -3,7 +3,7 @@ class PlansCompareFeed {
String message;
String extra;
String errorExtra;
String userType;
UserType userType;
Data data;
PlansCompareFeed(
......@@ -19,7 +19,9 @@ class PlansCompareFeed {
message = json['message'];
extra = json['extra'];
errorExtra = json['error_extra'];
userType = json['user_type'];
userType = json['user_type'] != null
? new UserType.fromJson(json['user_type'])
: null;
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
......@@ -29,7 +31,9 @@ class PlansCompareFeed {
data['message'] = this.message;
data['extra'] = this.extra;
data['error_extra'] = this.errorExtra;
data['user_type'] = this.userType;
if (this.userType != null) {
data['user_type'] = this.userType.toJson();
}
if (this.data != null) {
data['data'] = this.data.toJson();
}
......@@ -37,6 +41,17 @@ class PlansCompareFeed {
}
}
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;
......
......@@ -3,7 +3,7 @@ class ProjectDetailsItem {
String message;
String extra;
String errorExtra;
String userType;
UserType userType;
Data data;
ProjectDetailsItem(
......@@ -19,7 +19,9 @@ class ProjectDetailsItem {
message = json['message'];
extra = json['extra'];
errorExtra = json['error_extra'];
userType = json['user_type'];
userType = json['user_type'] != null
? new UserType.fromJson(json['user_type'])
: null;
data = json['data'] != null ? new Data.fromJson(json['data']) : null;
}
......@@ -29,7 +31,9 @@ class ProjectDetailsItem {
data['message'] = this.message;
data['extra'] = this.extra;
data['error_extra'] = this.errorExtra;
data['user_type'] = this.userType;
if (this.userType != null) {
data['user_type'] = this.userType.toJson();
}
if (this.data != null) {
data['data'] = this.data.toJson();
}
......@@ -37,6 +41,17 @@ class ProjectDetailsItem {
}
}
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 {
int id;
String name;
......
......@@ -45,6 +45,9 @@ class TestState extends BaseState<TestPage> {
JumpUtil.jumpToPageRight(
context, RouterCenterImpl().findClueRouter().getProjectDetailsPage());
}));
list.add(listItem("方案对比", () {
JumpUtil.jumpToPageRight(context, RouterCenterImpl().findClueRouter().getPlansCompareFeed());
}));
return list;
}
......
......@@ -7,14 +7,14 @@ packages:
name: _fe_analyzer_shared
url: "https://pub.flutter-io.cn"
source: hosted
version: "4.0.0"
version: "5.0.0"
analyzer:
dependency: transitive
description:
name: analyzer
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.39.10"
version: "0.39.11"
app_settings:
dependency: "direct main"
description:
......@@ -453,7 +453,7 @@ packages:
name: path_provider_linux
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.0.1+1"
version: "0.0.1+2"
path_provider_macos:
dependency: transitive
description:
......@@ -731,7 +731,7 @@ packages:
name: url_launcher_web
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.1.1+6"
version: "0.1.2"
uuid:
dependency: transitive
description:
......
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