Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
gm_flutter
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
林生雨
gm_flutter
Commits
d8bc4810
Commit
d8bc4810
authored
Jul 01, 2020
by
朱璇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
对比详情
parent
074d8756
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
350 additions
and
72 deletions
+350
-72
PlanCompareDetailModel.dart
...eModel/page/PlanCompareDetail/PlanCompareDetailModel.dart
+16
-9
PlanCompareDetailPage.dart
...ueModel/page/PlanCompareDetail/PlanCompareDetailPage.dart
+271
-50
PlanCompareDetail.dart
lib/ClueModel/server/entity/PlanCompareDetail.dart
+63
-13
No files found.
lib/ClueModel/page/PlanCompareDetail/PlanCompareDetailModel.dart
View file @
d8bc4810
...
...
@@ -2,27 +2,33 @@
* @Author: zx
* @Date: 2020-06-30 17:43:13
* @Last Modified by: zx
* @Last Modified time: 2020-0
6-30 22:01:01
* @Last Modified time: 2020-0
7-01 20:04:23
*/
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanCompareDetail.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:pull_to_refresh/pull_to_refresh.dart'
;
class
PlanCompareDetailModel
extends
BaseModel
{
LiveData
<
PlanCompareDetail
>
detailLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
void
init
()
{
ClueApiImpl
.
getInstance
()
.
getPlanCompareDetail
(
DioUtil
.
getInstance
().
getDio
(),
[
1
,
2
])
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
detailLive
.
notifyView
(
event
);
}
})
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{});
}
@override
void
dispose
()
{
// showTab.dispost();
// cardsLive.dispost();
// appBarLive.dispost();
// rectLive.dispost();
// topIndexLive.dispost();
// topScrollLive.dispost();
detailLive
.
dispost
();
}
}
\ No newline at end of file
lib/ClueModel/page/PlanCompareDetail/PlanCompareDetailPage.dart
View file @
d8bc4810
...
...
@@ -2,21 +2,18 @@
* @Author: zx
* @Date: 2020-06-30 17:40:43
* @Last Modified by: zx
* @Last Modified time: 2020-07-01
17:35:34
* @Last Modified time: 2020-07-01
22:11:20
*/
import
'package:cached_network_image/cached_network_image.dart'
;
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/gestures.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:gm_flutter/ClueModel/page/PlanCompareDetail/PlanCompareDetailModel.dart'
;
import
'package:gm_flutter/ClueModel/
util/PosUt
il.dart'
;
import
'package:gm_flutter/ClueModel/
server/entity/PlanCompareDeta
il.dart'
;
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseState.dart'
;
import
'package:gm_flutter/commonModel/util/DartUtil.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
class
PlanCompareDetailPage
extends
StatefulWidget
{
@override
...
...
@@ -32,25 +29,18 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
void
initState
()
{
super
.
initState
();
pageController
.
addListener
(()
{
if
(
screenWidth
!=
null
)
{
// _model.topScrollLive.notifyView(
// pageController.offset / screenWidth * (screenWidth / 4));
}
});
viewList
.
add
(
planPopularityView
());
viewList
.
add
(
planNormalAttrsView
());
viewList
.
add
(
planEffectiveAttrsView
());
// viewList.add(Container(
// height: 5,
// color: Color(0xffF7F6FA),
// ));
Groups
groups
;
viewList
.
add
(
planNormalEffectiveAttrsView
(
groups
));
viewList
.
add
(
planNormalEffectiveAttrsView
(
groups
));
viewList
.
add
(
planNormalEffectiveAttrsView
(
groups
));
}
@override
void
dispose
()
{
_model
.
dispose
();
pageController
.
dispose
();
// _refreshController.dispose();
pageController
.
dispose
();
super
.
dispose
();
}
...
...
@@ -66,31 +56,68 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
Navigator
.
pop
(
context
);
}),
body:
Container
(
child:
home
(),
child:
// planPopularityView()
// planNormalEffectiveAttrsView()
// setupHome([], []),
reloadPage
(),
)
);
}
Widget
reloadPage
(
)
{
return
StreamBuilder
(
stream:
_model
.
detailLive
.
stream
,
initialData:
PlanCompareDetail
(),
builder:
(
c
,
data
)
{
PlanCompareDetail
detail
=
data
.
data
;
if
(
detail
==
null
||
detail
.
data
==
null
||
detail
.
data
.
groups
==
null
)
{
return
loadingItem
();
}
return
setupHome
(
detail
.
data
.
plansInfo
,
detail
.
data
.
groups
);
},
);
}
Widget
home
(
)
{
Widget
setupHome
(
List
<
PlansInfo
>
plansInfo
,
List
<
Groups
>
groups
)
{
return
Column
(
children:
<
Widget
>[
Expanded
(
child:
Stack
(
children:
<
Widget
>[
head
(),
Position
ed
(
head
(
plansInfo
),
Expand
ed
(
child:
Container
(
margin:
EdgeInsets
.
fromLTRB
(
15
,
105
,
15
,
0
),
child:
CustomScrollView
(
child:
// ListView.builder(
// itemBuilder: (BuildContext context, int index) {
// Groups group = groups[index];
// switch (group.groupType) {
// case 'hot':
// return planPopularityView(group);
// break;
// case 'normal_attrs':
// return planNormalEffectiveAttrsView(group);
// break;
// case 'effective_attrs':
// return planNormalEffectiveAttrsView(group);
// break;
// default:
// return planNormalEffectiveAttrsView(group);
// }
// },
// itemCount: groups.length,
// )
CustomScrollView
(
slivers:
<
Widget
>[
SliverList
(
delegate:
SliverChildBuilderDelegate
(
(
BuildContext
context
,
int
index
)
{
return
viewList
[
index
+
1
];
return
viewList
[
index
];
},
childCount:
viewList
.
length
-
1
,
childCount:
viewList
.
length
,
),
),
],
...
...
@@ -105,7 +132,8 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
);
}
Widget
head
()
{
Widget
head
(
List
<
PlansInfo
>
plansInfo
)
{
PlansInfo
plan
;
return
Container
(
// key: keyTop,
color:
Colors
.
yellow
,
...
...
@@ -117,11 +145,11 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
// 根据 flex系数,分配剩余空间
Expanded
(
flex:
1
,
child:
headItem
()
child:
headItem
(
plan
)
),
Expanded
(
flex:
1
,
child:
headItem
()
child:
headItem
(
plan
)
)
]
...
...
@@ -129,7 +157,7 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
);
}
Widget
headItem
()
{
Widget
headItem
(
PlansInfo
plan
)
{
return
Container
(
child:
Stack
(
children:
<
Widget
>[
...
...
@@ -153,14 +181,14 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
Positioned
(
left:
17.5
,
top:
31
,
child:
baseText
(
'11
223344
'
,
15
,
Color
(
0xff333333
),
child:
baseText
(
'11
111
'
,
15
,
Color
(
0xff333333
),
bold:
true
),
),
Positioned
(
left:
17.5
,
bottom:
31
,
child:
baseText
(
'
哈哈哈哈
'
,
14
,
Colors
.
red
,
child:
baseText
(
'
¥¥¥¥¥¥¥¥¥¥
'
,
14
,
Colors
.
red
,
bold:
true
),
),
...
...
@@ -173,7 +201,9 @@ Widget titleView() {
return
Container
(
height:
81
,
width:
screenWidth
,
// margin: EdgeInsets.fromLTRB(9.5, 0, 9.5, 0),
color:
Colors
.
cyan
,
margin:
EdgeInsets
.
fromLTRB
(
0
,
30
,
0
,
13
),
alignment:
Alignment
.
topCenter
,
child:
Container
(
child:
baseText
(
'基础属性'
,
21
,
Colors
.
black
,
bold:
true
),
),
...
...
@@ -182,43 +212,176 @@ Widget titleView() {
Widget
planPopularityView
()
{
return
Container
(
color:
Colors
.
red
,
height:
200
,
color:
Colors
.
green
,
height:
265
,
child:
Container
(
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
titleView
(),
planPopularityRateItem
(),
planPopularitySellItem
()
Row
(
children:
<
Widget
>[
Expanded
(
flex:
1
,
child:
planPopularityLeftItem
()
),
Expanded
(
flex:
1
,
child:
planPopularityRightItem
()
)
]
)
);
]
)
),
);
}
Widget
planPopularity
Rate
Item
()
{
Widget
planPopularity
Left
Item
()
{
return
Container
(
color:
Colors
.
blue
,
height:
200
,
color:
Colors
.
red
,
// height: 80,
child:
Expanded
(
child:
Stack
(
children:
<
Widget
>[
Positioned
(
right:
20
,
top:
12
,
child:
baseText
(
'99%'
,
21
,
Color
(
0xffF25874
),
bold:
true
)
),
Positioned
(
right:
20
,
top:
33
,
// bottom: 12,
child:
baseText
(
'好评率'
,
12
,
Color
(
0xff666666
),
bold:
false
),
),
Positioned
(
right:
20
,
top:
55
,
// bottom: 12,
child:
FiveStarView
(
3
,
5
),
),
Positioned
(
right:
20
,
top:
98
,
bottom:
12
,
child:
baseText
(
'13679个'
,
21
,
Color
(
0xffF25874
),
bold:
true
),
),
Positioned
(
right:
20
,
top:
112
,
bottom:
12
,
child:
baseText
(
'销量'
,
12
,
Color
(
0xff666666
),
bold:
false
),
),
Positioned
(
right:
20
,
top:
132
,
bottom:
12
,
child:
baseText
(
''
,
12
,
Color
(
0xff666666
),
bold:
false
),
),
]
)
)
);
}
}
Widget
planPopularity
Sell
Item
()
{
Widget
planPopularity
Right
Item
()
{
return
Container
(
color:
Colors
.
red
,
// height: 80,
child:
Expanded
(
child:
Stack
(
children:
<
Widget
>[
Positioned
(
left:
20
,
top:
12
,
child:
baseText
(
'99%'
,
21
,
Color
(
0xffF25874
),
bold:
true
)
),
Positioned
(
left:
20
,
top:
33
,
// bottom: 12,
child:
baseText
(
'好评率'
,
12
,
Color
(
0xff666666
),
bold:
false
),
),
Positioned
(
left:
20
,
top:
55
,
// bottom: 12,
child:
FiveStarView
(
3
,
5
),
),
Positioned
(
left:
20
,
top:
98
,
bottom:
12
,
child:
baseText
(
'13679个'
,
21
,
Color
(
0xffF25874
),
bold:
true
),
),
Positioned
(
left:
20
,
top:
112
,
bottom:
12
,
child:
baseText
(
'销量'
,
12
,
Color
(
0xff666666
),
bold:
false
),
),
Positioned
(
left:
20
,
top:
132
,
bottom:
12
,
child:
baseText
(
''
,
12
,
Color
(
0xff666666
),
bold:
false
),
),
]
)
)
);
}
Widget
planNormal
AttrsView
(
)
{
Widget
planNormal
EffectiveAttrsView
(
Groups
groups
)
{
return
Container
(
color:
Colors
.
green
,
height:
200
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
Expanded
(
child:
Stack
(
children:
<
Widget
>[
titleView
(),
Expanded
(
child:
Container
(
margin:
EdgeInsets
.
fromLTRB
(
0
,
68
,
0
,
0
),
child:
ListView
.
builder
(
itemBuilder:
(
c
,
index
)
{
return
planBaseAttrsView
();
},
itemCount:
5
,
)
)
)
]
)
)
]
)
...
...
@@ -226,18 +389,75 @@ Widget titleView() {
}
Widget
plan
Effectiv
eAttrsView
()
{
Widget
plan
Bas
eAttrsView
()
{
return
Container
(
color:
Colors
.
grey
,
height:
200
,
child:
Column
(
mainAxisAlignment:
MainAxisAlignment
.
center
,
color:
Colors
.
red
,
height:
80
,
child:
Row
(
children:
<
Widget
>[
titleView
(),
Expanded
(
flex:
1
,
child:
planBaseAttrsLeftView
()
),
Expanded
(
flex:
1
,
child:
planBaseAttrsRightView
()
)
]
)
);
}
Widget
planBaseAttrsLeftView
()
{
return
Container
(
color:
Colors
.
red
,
height:
80
,
child:
Stack
(
children:
<
Widget
>[
Positioned
(
right:
20
,
top:
12
,
child:
baseText
(
'嘻嘻嘻嘻嘻嘻'
,
14
,
Color
(
0xff3FB5AF
),
bold:
true
)
),
Positioned
(
right:
20
,
// top: 12,
bottom:
12
,
child:
baseText
(
'哈哈哈哈'
,
12
,
Color
(
0xff666666
),
bold:
false
),
),
]
)
);
}
Widget
planBaseAttrsRightView
()
{
return
Container
(
color:
Colors
.
red
,
height:
80
,
child:
Stack
(
children:
<
Widget
>[
Positioned
(
left:
20
,
top:
12
,
child:
baseText
(
'嘻嘻嘻嘻嘻嘻'
,
14
,
Color
(
0xffF25874
),
bold:
true
)
),
Positioned
(
left:
20
,
// top: 12,
bottom:
12
,
child:
baseText
(
'哈哈哈哈'
,
12
,
Color
(
0xff666666
),
bold:
false
),
),
]
)
);
}
}
\ No newline at end of file
lib/ClueModel/server/entity/PlanCompareDetail.dart
View file @
d8bc4810
...
...
@@ -2,7 +2,7 @@
* @Author: zx
* @Date: 2020-06-30 19:31:32
* @Last Modified by: zx
* @Last Modified time: 2020-0
6-30 21:51:15
* @Last Modified time: 2020-0
7-01 20:31:42
*/
...
...
@@ -11,13 +11,19 @@ import 'dart:convert';
class
PlanCompareDetail
{
int
error
;
String
message
;
Null
extra
;
Null
errorExtra
;
UserType
userType
;
Data
data
;
PlanCompareDetail
({
this
.
error
,
this
.
message
,
this
.
data
});
PlanCompareDetail
({
this
.
error
,
this
.
message
,
this
.
extra
,
this
.
errorExtra
,
this
.
userType
,
this
.
data
});
PlanCompareDetail
.
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
;
}
...
...
@@ -25,6 +31,11 @@ class PlanCompareDetail {
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
();
}
...
...
@@ -32,12 +43,31 @@ class PlanCompareDetail {
}
}
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
<
PlansInfo
>
plansInfo
;
List
<
Groups
>
groups
;
Data
({
this
.
groups
});
Data
({
this
.
plansInfo
,
this
.
groups
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
if
(
json
[
'plans_info'
]
!=
null
)
{
plansInfo
=
new
List
<
PlansInfo
>();
json
[
'plans_info'
].
forEach
((
v
)
{
plansInfo
.
add
(
new
PlansInfo
.
fromJson
(
v
));
});
}
if
(
json
[
'groups'
]
!=
null
)
{
groups
=
new
List
<
Groups
>();
json
[
'groups'
].
forEach
((
v
)
{
groups
.
add
(
new
Groups
.
fromJson
(
v
));
});
...
...
@@ -46,6 +76,9 @@ class Data {
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
plansInfo
!=
null
)
{
data
[
'plans_info'
]
=
this
.
plansInfo
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
groups
!=
null
)
{
data
[
'groups'
]
=
this
.
groups
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
...
...
@@ -53,6 +86,31 @@ class Data {
}
}
class
PlansInfo
{
int
planId
;
String
planName
;
String
minPrice
;
String
maxPrice
;
PlansInfo
({
this
.
planId
,
this
.
planName
,
this
.
minPrice
,
this
.
maxPrice
});
PlansInfo
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
planId
=
json
[
'plan_id'
];
planName
=
json
[
'plan_name'
];
minPrice
=
json
[
'min_price'
];
maxPrice
=
json
[
'max_price'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'plan_id'
]
=
this
.
planId
;
data
[
'plan_name'
]
=
this
.
planName
;
data
[
'min_price'
]
=
this
.
minPrice
;
data
[
'max_price'
]
=
this
.
maxPrice
;
return
data
;
}
}
class
Groups
{
String
groupType
;
String
groupName
;
...
...
@@ -82,20 +140,14 @@ class Groups {
class
Plans
{
int
planId
;
String
planName
;
String
minPrice
;
String
maxPrice
;
String
positiveRate
;
String
salesCount
;
List
<
Attrs
>
attrs
;
Plans
({
this
.
planId
,
this
.
p
lanName
,
this
.
minPrice
,
this
.
maxPrice
,
this
.
p
ositiveRate
,
this
.
salesCount
,
this
.
attrs
});
Plans
({
this
.
planId
,
this
.
positiveRate
,
this
.
salesCount
,
this
.
attrs
});
Plans
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
planId
=
json
[
'plan_id'
];
planName
=
json
[
'plan_name'
];
minPrice
=
json
[
'min_price'
];
maxPrice
=
json
[
'max_price'
];
positiveRate
=
json
[
'positive_rate'
];
salesCount
=
json
[
'sales_count'
];
if
(
json
[
'attrs'
]
!=
null
)
{
...
...
@@ -107,9 +159,6 @@ class Plans {
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'plan_id'
]
=
this
.
planId
;
data
[
'plan_name'
]
=
this
.
planName
;
data
[
'min_price'
]
=
this
.
minPrice
;
data
[
'max_price'
]
=
this
.
maxPrice
;
data
[
'positive_rate'
]
=
this
.
positiveRate
;
data
[
'sales_count'
]
=
this
.
salesCount
;
if
(
this
.
attrs
!=
null
)
{
...
...
@@ -140,3 +189,4 @@ class Attrs {
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment