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