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
54917347
Commit
54917347
authored
Jul 04, 2020
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit
parent
0bf3f8ad
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
295 additions
and
23 deletions
+295
-23
DiscussLowPriceModel.dart
lib/ClueModel/page/DiscussLowPrice/DiscussLowPriceModel.dart
+6
-6
DiscussLowPricePopView.dart
...lueModel/page/DiscussLowPrice/DiscussLowPricePopView.dart
+0
-0
LevelOnePage.dart
lib/ClueModel/page/levelOne/LevelOnePage.dart
+5
-5
TopModel.dart
lib/ClueModel/page/top/TopModel.dart
+3
-1
TopPage.dart
lib/ClueModel/page/top/TopPage.dart
+27
-6
ClueApi.dart
lib/ClueModel/server/api/ClueApi.dart
+4
-0
ClueApi.serv.dart
lib/ClueModel/server/api/ClueApi.serv.dart
+19
-0
PlanOverViewBean.dart
lib/ClueModel/server/entity/PlanOverViewBean.dart
+217
-0
BaseComponent.dart
lib/commonModel/base/BaseComponent.dart
+14
-5
No files found.
lib/ClueModel/page/DiscussLowPrice/DiscussLowPriceModel.dart
View file @
54917347
...
@@ -4,6 +4,7 @@
...
@@ -4,6 +4,7 @@
* @Last Modified by: zx
* @Last Modified by: zx
* @Last Modified time: 2020-07-04 12:20:45
* @Last Modified time: 2020-07-04 12:20:45
*/
*/
import
'package:dio/dio.dart'
;
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/BaseModel.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.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/api/ClueApi.serv.dart'
;
...
@@ -16,8 +17,6 @@ import 'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceAuthBean.dart'
...
@@ -16,8 +17,6 @@ import 'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceAuthBean.dart'
class
DiscussLowPriceModel
extends
BaseModel
{
class
DiscussLowPriceModel
extends
BaseModel
{
LiveData
<
Pair
<
int
,
DiscussLowPriceModelBean
>>
popViewLive
=
LiveData
();
LiveData
<
Pair
<
int
,
DiscussLowPriceModelBean
>>
popViewLive
=
LiveData
();
LiveData
<
bool
>
phoneAuthLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
RxDispose
rxDispose
=
RxDispose
();
fetchPopviewData
(
String
planId
,
String
hospitalId
,
String
doctorId
)
{
fetchPopviewData
(
String
planId
,
String
hospitalId
,
String
doctorId
)
{
...
@@ -43,26 +42,27 @@ class DiscussLowPriceModel extends BaseModel {
...
@@ -43,26 +42,27 @@ class DiscussLowPriceModel extends BaseModel {
});
});
}
}
givePhoneAuth
(
int
leadPhoneRequestId
)
{
givePhoneAuth
(
int
leadPhoneRequestId
,
VoidCallback
callback
)
{
popViewLive
.
notifyView
(
Pair
(
ENDLOADING
,
null
));
ClueApiImpl
.
getInstance
()
ClueApiImpl
.
getInstance
()
.
givePhoneAuth
(
DioUtil
.
getInstance
().
getDio
(),
leadPhoneRequestId
)
.
givePhoneAuth
(
DioUtil
.
getInstance
().
getDio
(),
leadPhoneRequestId
)
.
listen
((
event
)
{
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
if
(
event
.
error
==
0
)
{
phoneAuthLive
.
notifyView
(
event
.
data
.
success
);
}
else
{
}
else
{
NativeToast
.
showNativeToast
(
event
.
message
);
NativeToast
.
showNativeToast
(
event
.
message
);
phoneAuthLive
.
notifyView
(
false
);
}
}
callback
();
})
})
.
addToDispose
(
rxDispose
)
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
.
onError
((
err
)
{
phoneAuthLive
.
notifyView
(
false
);
NativeToast
.
showNativeToast
(
err
.
message
);
NativeToast
.
showNativeToast
(
err
.
message
);
callback
();
});
});
}
}
@override
@override
void
dispose
()
{
void
dispose
()
{
popViewLive
.
dispost
();
popViewLive
.
dispost
();
rxDispose
.
dispose
();
}
}
}
}
lib/ClueModel/page/DiscussLowPrice/DiscussLowPricePopView.dart
View file @
54917347
This diff is collapsed.
Click to expand it.
lib/ClueModel/page/levelOne/LevelOnePage.dart
View file @
54917347
...
@@ -41,10 +41,10 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -41,10 +41,10 @@ class LevelOneState extends BaseState<LevelOnePage>
@override
@override
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
//
Future.delayed(Duration(seconds: 3), () {
Future
.
delayed
(
Duration
(
seconds:
3
),
()
{
//
_model.loadingLive.notifyView(false);
_model
.
loadingLive
.
notifyView
(
false
);
//
_model.refreshView(true);
_model
.
refreshView
(
true
);
//
});
});
pageController
.
addListener
(()
{
pageController
.
addListener
(()
{
if
(
screenWidth
!=
null
)
{
if
(
screenWidth
!=
null
)
{
_model
.
topScrollLive
.
notifyView
(
_model
.
topScrollLive
.
notifyView
(
...
@@ -501,8 +501,8 @@ class LevelOneState extends BaseState<LevelOnePage>
...
@@ -501,8 +501,8 @@ class LevelOneState extends BaseState<LevelOnePage>
controller:
pageController
,
controller:
pageController
,
itemCount:
4
,
itemCount:
4
,
onPageChanged:
(
index
)
{
onPageChanged:
(
index
)
{
_refreshController
.
resetNoData
();
setState
(()
{
setState
(()
{
_refreshController
.
resetNoData
();
});
});
_model
.
topIndexLive
.
notifyView
(
index
);
_model
.
topIndexLive
.
notifyView
(
index
);
_model
.
selectPage
(
index
);
_model
.
selectPage
(
index
);
...
...
lib/ClueModel/page/top/TopModel.dart
View file @
54917347
...
@@ -18,6 +18,7 @@ class TopModel extends BaseModel {
...
@@ -18,6 +18,7 @@ class TopModel extends BaseModel {
LiveData
<
String
>
titleLive
=
new
LiveData
();
LiveData
<
String
>
titleLive
=
new
LiveData
();
LiveData
<
String
>
imageLive
=
LiveData
();
LiveData
<
String
>
imageLive
=
LiveData
();
LiveData
<
double
>
textLive
=
LiveData
();
LiveData
<
int
>
stateLive
=
LiveData
();
LiveData
<
int
>
stateLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
RxDispose
rxDispose
=
RxDispose
();
String
rank_type
;
String
rank_type
;
...
@@ -29,6 +30,7 @@ class TopModel extends BaseModel {
...
@@ -29,6 +30,7 @@ class TopModel extends BaseModel {
titleLive
.
dispost
();
titleLive
.
dispost
();
imageLive
.
dispost
();
imageLive
.
dispost
();
stateLive
.
dispost
();
stateLive
.
dispost
();
textLive
.
dispost
();
}
}
void
selectTab
(
int
index
)
{
void
selectTab
(
int
index
)
{
...
@@ -44,7 +46,7 @@ class TopModel extends BaseModel {
...
@@ -44,7 +46,7 @@ class TopModel extends BaseModel {
.
listen
((
event
)
{
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
if
(
event
.
error
==
0
)
{
stateLive
.
notifyView
(
ENDLOADING
);
stateLive
.
notifyView
(
ENDLOADING
);
imageUrl
=
event
.
data
.
bannerImage
;
imageUrl
=
event
.
data
.
bannerImage
;
tabs
=
event
.
data
.
tabs
;
tabs
=
event
.
data
.
tabs
;
back
(
tabs
.
length
);
back
(
tabs
.
length
);
}
else
{
}
else
{
...
...
lib/ClueModel/page/top/TopPage.dart
View file @
54917347
...
@@ -9,6 +9,7 @@ import 'package:flutter/cupertino.dart';
...
@@ -9,6 +9,7 @@ import 'package:flutter/cupertino.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoPage.dart'
;
import
'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoPage.dart'
;
import
'package:gm_flutter/ClueModel/page/top/TopModel.dart'
;
import
'package:gm_flutter/ClueModel/page/top/TopModel.dart'
;
import
'package:gm_flutter/ClueModel/util/PosUtil.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseState.dart'
;
import
'package:gm_flutter/commonModel/base/BaseState.dart'
;
import
'package:gm_flutter/commonModel/util/DartUtil.dart'
;
import
'package:gm_flutter/commonModel/util/DartUtil.dart'
;
...
@@ -23,8 +24,8 @@ class TopPage extends StatefulWidget {
...
@@ -23,8 +24,8 @@ class TopPage extends StatefulWidget {
class
TopPageState
extends
BaseState
<
TopPage
>
with
TickerProviderStateMixin
{
class
TopPageState
extends
BaseState
<
TopPage
>
with
TickerProviderStateMixin
{
RefreshController
refreshController
=
RefreshController
();
RefreshController
refreshController
=
RefreshController
();
TabController
tabController
;
TopModel
_model
=
TopModel
();
TopModel
_model
=
TopModel
();
GlobalKey
globalKey
=
GlobalKey
();
@override
@override
void
initState
()
{
void
initState
()
{
...
@@ -34,7 +35,6 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
...
@@ -34,7 +35,6 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
void
init
()
{
void
init
()
{
_model
.
init
((
i
)
{
_model
.
init
((
i
)
{
tabController
=
TabController
(
length:
i
,
vsync:
this
);
setState
(()
{});
setState
(()
{});
});
});
}
}
...
@@ -60,9 +60,29 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
...
@@ -60,9 +60,29 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
height:
MediaQuery
.
of
(
context
).
size
.
height
,
height:
MediaQuery
.
of
(
context
).
size
.
height
,
child:
NotificationListener
(
child:
NotificationListener
(
onNotification:
(
scrollNotification
)
{
onNotification:
(
scrollNotification
)
{
if
(
scrollNotification
is
KeepAliveNotification
||
scrollNotification
is
OverscrollIndicatorNotification
)
{
return
false
;
}
if
(
scrollNotification
is
ScrollUpdateNotification
&&
if
(
scrollNotification
is
ScrollUpdateNotification
&&
scrollNotification
.
metrics
.
axisDirection
.
index
==
2
)
{
scrollNotification
.
metrics
.
axisDirection
.
index
==
2
)
{}
print
(
"
${scrollNotification}
"
);
print
(
"NOT
${scrollNotification}
${scrollNotification is KeepAliveNotification}
"
);
if
(
scrollNotification
.
depth
==
0
)
{
if
(
scrollNotification
.
metrics
.
pixels
>
80
)
{
_model
.
textLive
.
notifyView
(
(
scrollNotification
.
metrics
.
pixels
-
80
)
/
40
>
1.0
?
1.0
:
(
scrollNotification
.
metrics
.
pixels
-
80
)
/
40
);
}
else
{
_model
.
textLive
.
notifyView
(
0.0
);
}
}
else
if
(
scrollNotification
.
depth
==
2
)
{
if
(
scrollNotification
.
metrics
.
pixels
<
50
&&
scrollNotification
.
metrics
.
pixels
>
0
)
{
_model
.
textLive
.
notifyView
(
1.0
);
}
}
}
return
false
;
return
false
;
},
},
...
@@ -72,7 +92,8 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
...
@@ -72,7 +92,8 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
baseSliverBack
(()
{
baseSliverBack
(()
{
Navigator
.
of
(
context
).
pop
();
Navigator
.
of
(
context
).
pop
();
}),
}),
baseSliverTitle
(
"title"
,
MediaQuery
.
of
(
context
).
size
.
width
),
baseSliverTitle
(
"title"
,
MediaQuery
.
of
(
context
).
size
.
width
,
_model
.
textLive
)
],
],
),
()
{
),
()
{
init
();
init
();
...
@@ -84,7 +105,7 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
...
@@ -84,7 +105,7 @@ class TopPageState extends BaseState<TopPage> with TickerProviderStateMixin {
List
<
Widget
>
list
=
[];
List
<
Widget
>
list
=
[];
var
d
=
MediaQueryData
.
fromWindow
(
window
).
padding
.
top
;
var
d
=
MediaQueryData
.
fromWindow
(
window
).
padding
.
top
;
for
(
int
i
=
0
;
i
<
_model
.
tabs
.
length
;
i
++)
{
for
(
int
i
=
0
;
i
<
_model
.
tabs
.
length
;
i
++)
{
list
.
add
(
TopList
(
_model
.
tabs
[
i
].
id
,
48
+
d
).
toActive
());
list
.
add
(
TopList
(
_model
.
tabs
[
i
].
id
,
48
+
d
).
toActive
());
}
}
return
DefaultTabController
(
return
DefaultTabController
(
length:
_model
.
tabs
.
length
,
length:
_model
.
tabs
.
length
,
...
...
lib/ClueModel/server/api/ClueApi.dart
View file @
54917347
...
@@ -8,6 +8,7 @@ import 'package:flutter_common/Annotations/anno/ServiceCenter.dart';
...
@@ -8,6 +8,7 @@ import 'package:flutter_common/Annotations/anno/ServiceCenter.dart';
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/LevelOneFeedList.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBarBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBarBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanCompareDetail.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanCompareDetail.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanOverViewBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.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/ProjectDetailsItem.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBean.dart'
;
...
@@ -58,4 +59,7 @@ abstract class ClueApi {
...
@@ -58,4 +59,7 @@ abstract class ClueApi {
@Get
(
"api/janus/plans/agree_phone_authorize"
)
@Get
(
"api/janus/plans/agree_phone_authorize"
)
DiscussLowPriceAuthBean
givePhoneAuth
(
DiscussLowPriceAuthBean
givePhoneAuth
(
@Query
(
"lead_phone_request_id"
)
int
leadPhoneRequestId
);
@Query
(
"lead_phone_request_id"
)
int
leadPhoneRequestId
);
@Get
(
"api/janus/plans/plan_overview"
)
PlanOverViewBean
getPlanOverView
(
@Query
(
"plan_id"
)
int
plan_id
);
}
}
lib/ClueModel/server/api/ClueApi.serv.dart
View file @
54917347
...
@@ -23,6 +23,7 @@ import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
...
@@ -23,6 +23,7 @@ import 'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart';
import
'package:gm_flutter/ClueModel/server/entity/PlanBarBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBarBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceModelBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceModelBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceAuthBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/DiscussLowPriceAuthBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanOverViewBean.dart'
;
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
...
@@ -189,6 +190,20 @@ class ClueApiImpl {
...
@@ -189,6 +190,20 @@ class ClueApiImpl {
});
});
}
}
Stream
<
PlanOverViewBean
>
getPlanOverView
(
Dio
_dio
,
int
plan_id
)
{
return
Stream
.
fromFuture
(
get
(
_dio
,
'api/janus/plans/plan_overview'
,
data:
{
'plan_id'
:
plan_id
,
})).
flatMap
((
value
)
{
if
(
value
!=
null
&&
(
value
.
statusCode
>=
200
&&
value
.
statusCode
<
300
))
{
return
Stream
.
fromFuture
(
compute
(
parsePlanOverViewBean
,
value
.
toString
()));
}
else
{
throw
Exception
(
"--未知网络错误--"
);
}
});
}
///==================base method==================
///==================base method==================
Future
<
Response
>
get
(
Dio
_dio
,
url
,
{
data
,
options
,
cancelToken
})
async
{
Future
<
Response
>
get
(
Dio
_dio
,
url
,
{
data
,
options
,
cancelToken
})
async
{
...
@@ -361,3 +376,7 @@ DiscussLowPriceModelBean parseDiscussLowPriceModelBean(String value) {
...
@@ -361,3 +376,7 @@ DiscussLowPriceModelBean parseDiscussLowPriceModelBean(String value) {
DiscussLowPriceAuthBean
parseDiscussLowPriceAuthBean
(
String
value
)
{
DiscussLowPriceAuthBean
parseDiscussLowPriceAuthBean
(
String
value
)
{
return
DiscussLowPriceAuthBean
.
fromJson
(
json
.
decode
(
value
));
return
DiscussLowPriceAuthBean
.
fromJson
(
json
.
decode
(
value
));
}
}
PlanOverViewBean
parsePlanOverViewBean
(
String
value
)
{
return
PlanOverViewBean
.
fromJson
(
json
.
decode
(
value
));
}
lib/ClueModel/server/entity/PlanOverViewBean.dart
0 → 100644
View file @
54917347
/*
* @author lsy
* @date 2020/7/3
**/
class
PlanOverViewBean
{
int
error
;
String
message
;
Null
extra
;
Null
errorExtra
;
UserType
userType
;
Data
data
;
PlanOverViewBean
(
{
this
.
error
,
this
.
message
,
this
.
extra
,
this
.
errorExtra
,
this
.
userType
,
this
.
data
});
PlanOverViewBean
.
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
{
Banner
banner
;
String
name
;
String
positiveRate
;
String
salesCount
;
String
planDescription
;
String
guidePrice
;
List
<
OverviewAttrs
>
overviewAttrs
;
List
<
ExplanationAttrs
>
explanationAttrs
;
List
<
Tabs
>
tabs
;
Data
(
{
this
.
banner
,
this
.
name
,
this
.
positiveRate
,
this
.
salesCount
,
this
.
planDescription
,
this
.
guidePrice
,
this
.
overviewAttrs
,
this
.
explanationAttrs
,
this
.
tabs
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
banner
=
json
[
'banner'
]
!=
null
?
new
Banner
.
fromJson
(
json
[
'banner'
])
:
null
;
name
=
json
[
'name'
];
positiveRate
=
json
[
'positive_rate'
];
salesCount
=
json
[
'sales_count'
];
planDescription
=
json
[
'plan_description'
];
guidePrice
=
json
[
'guide_price'
];
if
(
json
[
'overview_attrs'
]
!=
null
)
{
overviewAttrs
=
new
List
<
OverviewAttrs
>();
json
[
'overview_attrs'
].
forEach
((
v
)
{
overviewAttrs
.
add
(
new
OverviewAttrs
.
fromJson
(
v
));
});
}
if
(
json
[
'explanation_attrs'
]
!=
null
)
{
explanationAttrs
=
new
List
<
ExplanationAttrs
>();
json
[
'explanation_attrs'
].
forEach
((
v
)
{
explanationAttrs
.
add
(
new
ExplanationAttrs
.
fromJson
(
v
));
});
}
if
(
json
[
'tabs'
]
!=
null
)
{
tabs
=
new
List
<
Tabs
>();
json
[
'tabs'
].
forEach
((
v
)
{
tabs
.
add
(
new
Tabs
.
fromJson
(
v
));
});
}
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
if
(
this
.
banner
!=
null
)
{
data
[
'banner'
]
=
this
.
banner
.
toJson
();
}
data
[
'name'
]
=
this
.
name
;
data
[
'positive_rate'
]
=
this
.
positiveRate
;
data
[
'sales_count'
]
=
this
.
salesCount
;
data
[
'plan_description'
]
=
this
.
planDescription
;
data
[
'guide_price'
]
=
this
.
guidePrice
;
if
(
this
.
overviewAttrs
!=
null
)
{
data
[
'overview_attrs'
]
=
this
.
overviewAttrs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
explanationAttrs
!=
null
)
{
data
[
'explanation_attrs'
]
=
this
.
explanationAttrs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
if
(
this
.
tabs
!=
null
)
{
data
[
'tabs'
]
=
this
.
tabs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
}
return
data
;
}
}
class
Banner
{
String
type
;
String
imageUrl
;
String
videoUrl
;
Banner
({
this
.
type
,
this
.
imageUrl
,
this
.
videoUrl
});
Banner
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
type
=
json
[
'type'
];
imageUrl
=
json
[
'image_url'
];
videoUrl
=
json
[
'video_url'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'type'
]
=
this
.
type
;
data
[
'image_url'
]
=
this
.
imageUrl
;
data
[
'video_url'
]
=
this
.
videoUrl
;
return
data
;
}
}
class
OverviewAttrs
{
int
attrId
;
String
attrName
;
String
attrValue
;
OverviewAttrs
({
this
.
attrId
,
this
.
attrName
,
this
.
attrValue
});
OverviewAttrs
.
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
;
}
}
class
Tabs
{
String
tabType
;
String
name
;
Tabs
({
this
.
tabType
,
this
.
name
});
Tabs
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
tabType
=
json
[
'tab_type'
];
name
=
json
[
'name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'tab_type'
]
=
this
.
tabType
;
data
[
'name'
]
=
this
.
name
;
return
data
;
}
}
class
ExplanationAttrs
{
int
attrId
;
String
attrName
;
String
attrValue
;
ExplanationAttrs
({
this
.
attrId
,
this
.
attrName
,
this
.
attrValue
});
ExplanationAttrs
.
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
;
}
}
lib/commonModel/base/BaseComponent.dart
View file @
54917347
...
@@ -470,13 +470,22 @@ Widget baseSliverBack(VoidCallback tap) {
...
@@ -470,13 +470,22 @@ Widget baseSliverBack(VoidCallback tap) {
);
);
}
}
Widget
baseSliverTitle
(
String
text
,
double
width
)
{
Widget
baseSliverTitle
(
String
text
,
double
width
,
LiveData
liveData
)
{
return
Positioned
(
return
Positioned
(
top:
57
,
top:
57
,
child:
Container
(
child:
StreamBuilder
(
alignment:
Alignment
.
center
,
stream:
liveData
.
stream
,
width:
width
,
initialData:
liveData
.
data
??
0.0
,
child:
baseText
(
text
,
18
,
Color
(
0xff333333
)),
builder:
(
c
,
data
)
{
return
Opacity
(
opacity:
data
.
data
,
child:
Container
(
alignment:
Alignment
.
center
,
width:
width
,
child:
baseText
(
text
,
18
,
Color
(
0xff333333
)),
),
);
},
),
),
);
);
}
}
...
...
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