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
3280ec6b
Commit
3280ec6b
authored
Jul 06, 2020
by
杜欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二级方案
parent
fea4eaf7
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
223 additions
and
176 deletions
+223
-176
LevelTwoModel.dart
lib/ClueModel/page/levelTwo/LevelTwoModel.dart
+50
-75
LevelTwoPage.dart
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
+115
-70
MechanismBoxPage.dart
lib/ClueModel/page/mechanismBox/MechanismBoxPage.dart
+29
-7
MechanismModel.dart
lib/ClueModel/page/mechanismBox/MechanismModel.dart
+13
-12
PlanOverviewBean.dart
lib/ClueModel/server/entity/PlanOverviewBean.dart
+16
-12
No files found.
lib/ClueModel/page/levelTwo/LevelTwoModel.dart
View file @
3280ec6b
...
@@ -5,98 +5,73 @@
...
@@ -5,98 +5,73 @@
import
'package:flutter/material.dart'
;
import
'package:flutter/material.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:flutter_common/commonModel/toast/NativeToast.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.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/PlanOverviewBean.dart'
;
import
'package:gm_flutter/commonModel/GMBase.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/rx/RxDispose.dart'
;
import
'package:gm_flutter/commonModel/util/PrintUtil.dart'
;
import
'package:gm_flutter/commonModel/util/PrintUtil.dart'
;
import
'package:
pull_to_refresh/pull_to_refresh
.dart'
;
import
'package:
gm_flutter/commonModel/bean/Pair
.dart'
;
class
LevelTwoModel
extends
BaseModel
{
import
'../../../commonModel/bean/Pair.dart'
;
LiveData
<
double
>
appBarLive
=
LiveData
();
LiveData
<
List
<
String
>>
rectLive
=
LiveData
();
LiveData
<
List
<
String
>>
explainLive
=
LiveData
();
LiveData
<
bool
>
showTab
=
LiveData
();
LiveData
<
int
>
topIndexLive
=
new
LiveData
();
LiveData
<
double
>
topScrollLive
=
new
LiveData
();
LiveData
<
bool
>
loadingLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
LiveData
<
Pair
<
int
,
List
<
Cards
>>>
cardsLive
=
LiveData
();
Map
<
int
,
List
<
Cards
>>
data
=
new
Map
();
class
LevelTwoModel
extends
BaseModel
{
List
list
=
[
"hospital"
,
"doctor"
];
LiveData
<
Pair
<
int
,
String
>>
nameLive
=
LiveData
();
List
pageList
=
[
1
,
1
];
LiveData
<
Pair
<
int
,
String
>>
imageUrlLive
=
LiveData
();
List
pageHeightList
=
[
149
,
118
];
LiveData
<
Pair
<
int
,
List
<
OverviewAttrsEntity
>>>
overviewAttrsLive
=
LiveData
();
LiveData
<
Pair
<
int
,
List
<
ExplanationAttrsEntity
>>>
explanationAttrsLive
=
LiveData
();
LiveData
<
Pair
<
int
,
List
<
Tabs
>>>
tabsLive
=
LiveData
();
void
refreshView
(
bool
clear
,
{
RefreshController
refreshListener
})
{
LiveData
<
int
>
stateLive
=
LiveData
();
Future
.
delayed
(
Duration
(
seconds:
1
),
()
{
LiveData
<
Pair
<
int
,
List
<
Cards
>>>
cardsLive
=
LiveData
();
Cards
cards
=
Cards
(
RxDispose
rxDispose
=
RxDispose
();
cardType:
"plan"
,
plan:
Plan
(
planName:
"ww"
,
minPrice:
"50"
,
maxPrice:
"500"
));
List
<
Cards
>
a
=
[
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
cards
,
];
List
<
Cards
>
b
=
[
cards
];
print
(
"INDEX
${currentIndex}
"
);
if
(
currentIndex
==
1
)
{
data
[
currentIndex
]
=
b
;
}
else
{
data
[
currentIndex
]
=
a
;
}
cardsLive
.
notifyView
(
Pair
(
ENDLOADING
,
data
));
getPlanOverview
(
int
plan_id
)
{
});
int
index
=
currentIndex
;
if
(
clear
)
{
data
.
clear
();
pageList
=
[
1
,
1
];
}
ClueApiImpl
.
getInstance
()
ClueApiImpl
.
getInstance
()
.
getLevelOneList
(
.
getPlanOverviewBean
(
DioUtil
.
getInstance
().
getDio
(),
plan_id
)
DioUtil
.
getInstance
().
getDio
(),
123
,
list
[
index
],
pageList
[
index
])
.
listen
((
event
)
{
.
listen
((
event
)
{})
if
(
event
.
error
==
0
)
{
stateLive
.
notifyView
(
ENDLOADING
);
nameLive
.
notifyView
(
Pair
(
ENDLOADING
,
event
.
data
.
name
));
imageUrlLive
.
notifyView
(
Pair
(
ENDLOADING
,
event
.
data
.
banner
.
imageUrl
));
overviewAttrsLive
.
notifyView
(
Pair
(
ENDLOADING
,
event
.
data
.
overviewAttrs
));
explanationAttrsLive
.
notifyView
(
Pair
(
ENDLOADING
,
event
.
data
.
explanationAttrs
));
tabsLive
.
notifyView
(
Pair
(
ENDLOADING
,
event
.
data
.
tabs
));
}
else
{
NativeToast
.
showNativeToast
(
event
.
message
);
commonError
();
}
})
.
addToDispose
(
rxDispose
)
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
.
onError
((
err
)
{
PrintUtil
.
printBug
(
err
);
commonError
();
});
PrintUtil
.
printBug
(
err
);
});
}
}
int
currentIndex
=
0
;
commonError
()
{
stateLive
.
notifyView
(
FAIL
);
nameLive
.
notifyView
(
Pair
(
FAIL
,
null
));
imageUrlLive
.
notifyView
(
Pair
(
FAIL
,
null
));
overviewAttrsLive
.
notifyView
(
Pair
(
FAIL
,
null
));
explanationAttrsLive
.
notifyView
(
Pair
(
FAIL
,
null
));
tabsLive
.
notifyView
(
Pair
(
FAIL
,
null
));
}
@override
@override
void
dispose
()
{
void
dispose
()
{
showTab
.
dispost
();
nameLive
.
dispost
();
cardsLive
.
dispost
();
imageUrlLive
.
dispost
();
appBarLive
.
dispost
();
overviewAttrsLive
.
dispost
();
rectLive
.
dispost
();
explanationAttrsLive
.
dispost
();
topIndexLive
.
dispost
();
tabsLive
.
dispost
();
topScrollLive
.
dispost
();
stateLive
.
dispost
();
loadingLive
.
dispost
();
rxDispose
.
dispose
();
}
void
selectPage
(
int
index
)
{
if
(
currentIndex
==
index
)
{
return
;
}
currentIndex
=
index
;
if
(
data
[
currentIndex
]
==
null
)
{
cardsLive
.
notifyView
(
Pair
(
LOADING
,
null
));
refreshView
(
true
);
}
else
{
cardsLive
.
notifyView
(
Pair
(
ENDLOADING
,
data
[
currentIndex
]));
}
}
}
void
loadMore
()
{}
void
loadMore
()
{}
...
...
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
View file @
3280ec6b
...
@@ -11,6 +11,7 @@ import 'package:flutter_common/commonModel/picker/base/BaseBottomPicker.dart';
...
@@ -11,6 +11,7 @@ import 'package:flutter_common/commonModel/picker/base/BaseBottomPicker.dart';
import
'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoModel.dart'
;
import
'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoModel.dart'
;
import
'package:gm_flutter/ClueModel/page/mechanismBox/MechanismBoxPage.dart'
;
import
'package:gm_flutter/ClueModel/page/mechanismBox/MechanismBoxPage.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/PlanOverviewBean.dart'
;
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
import
'package:gm_flutter/commonModel/base/BaseState.dart'
;
import
'package:gm_flutter/commonModel/base/BaseState.dart'
;
import
'package:gm_flutter/commonModel/base/BaseUtil.dart'
;
import
'package:gm_flutter/commonModel/base/BaseUtil.dart'
;
...
@@ -18,6 +19,10 @@ import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
...
@@ -18,6 +19,10 @@ import 'package:gm_flutter/commonModel/base/BaseComponent.dart';
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'../../../commonModel/bean/Pair.dart'
;
import
'../../../commonModel/bean/Pair.dart'
;
import
'../../../commonModel/bean/Pair.dart'
;
class
LevelTwoPage
extends
StatefulWidget
{
class
LevelTwoPage
extends
StatefulWidget
{
@required
@required
final
int
plan_id
;
final
int
plan_id
;
...
@@ -39,6 +44,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -39,6 +44,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
void
initState
()
{
void
initState
()
{
super
.
initState
();
super
.
initState
();
this
.
tabController
=
TabController
(
length:
2
,
vsync:
this
);
this
.
tabController
=
TabController
(
length:
2
,
vsync:
this
);
_model
.
getPlanOverview
(
this
.
widget
.
plan_id
);
}
}
@override
@override
...
@@ -52,11 +58,13 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -52,11 +58,13 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
@override
@override
Widget
buildItem
(
BuildContext
context
)
{
Widget
buildItem
(
BuildContext
context
)
{
return
Scaffold
(
return
Scaffold
(
body:
StreamBuilder
<
bool
>(
body:
StreamBuilder
<
int
>(
stream:
_model
.
loading
Live
.
stream
,
stream:
_model
.
state
Live
.
stream
,
initialData:
true
,
initialData:
_model
.
stateLive
.
data
??
LOADING
,
builder:
(
c
,
data
)
{
builder:
(
c
,
data
)
{
if
(!
data
.
data
)
{
print
(
"ddsadsadsadsa"
);
print
(
data
);
if
(
data
.
data
==
FAIL
)
{
return
loadingItem
();
return
loadingItem
();
}
else
{
}
else
{
return
home
();
return
home
();
...
@@ -73,7 +81,9 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -73,7 +81,9 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
pinned:
true
,
pinned:
true
,
elevation:
0
,
elevation:
0
,
expandedHeight:
0
,
expandedHeight:
0
,
flexibleSpace:
FlexibleSpaceBar
(
title:
Text
(
'二级方案'
)),
flexibleSpace:
FlexibleSpaceBar
(
title:
title
((
data
)
{
return
Text
(
data
);
})),
),
),
SliverToBoxAdapter
(
SliverToBoxAdapter
(
child:
Column
(
child:
Column
(
...
@@ -89,81 +99,106 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -89,81 +99,106 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
scroll:
false
),
scroll:
false
),
),
),
),
),
SliverFillRemaining
(
child:
pages
())
//
SliverFillRemaining(child: pages())
]),
]),
Positioned
(
left:
0
,
right:
0
,
bottom:
0
,
child:
bottomWidget
())
Positioned
(
left:
0
,
right:
0
,
bottom:
0
,
child:
bottomWidget
())
],
],
);
);
}
}
// 方案名称
Widget
title
(
Function
text
)
{
return
StreamBuilder
<
Pair
<
int
,
String
>>(
stream:
_model
.
nameLive
.
stream
,
initialData:
_model
.
nameLive
.
data
??
Pair
(
LOADING
,
null
),
builder:
(
context
,
e
)
{
if
(
e
.
data
.
first
==
FAIL
)
{
return
Text
(
''
);
}
return
text
(
e
.
data
.
second
);
},
);
}
// 方案顶部
Widget
good
()
{
Widget
good
()
{
return
StreamBuilder
(
return
Padding
(
stream:
_model
.
rectLive
.
stream
,
padding:
EdgeInsets
.
only
(
left:
15.0
,
right:
15.0
,
top:
8.0
),
initialData:
[
"w"
,
"w"
,
"q"
,
"w"
],
child:
Row
(
builder:
(
context
,
data
)
{
crossAxisAlignment:
CrossAxisAlignment
.
start
,
return
Padding
(
mainAxisSize:
MainAxisSize
.
max
,
padding:
EdgeInsets
.
only
(
left:
15.0
,
right:
15.0
,
top:
8.0
),
children:
<
Widget
>[
child:
Row
(
StreamBuilder
<
Pair
<
int
,
String
>>(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
stream:
_model
.
imageUrlLive
.
stream
,
mainAxisSize:
MainAxisSize
.
max
,
initialData:
_model
.
imageUrlLive
.
data
??
null
,
children:
<
Widget
>[
builder:
(
context
,
e
)
{
ClipRRect
(
if
(
e
.
data
.
first
==
FAIL
)
{
borderRadius:
BorderRadius
.
circular
(
6
),
return
Container
();
child:
Container
(
}
decoration:
BoxDecoration
(
return
ClipRRect
(
borderRadius:
BorderRadius
.
circular
(
17
),
borderRadius:
BorderRadius
.
circular
(
6
),
border:
Border
.
all
(
color:
Color
(
0xffF9F8FB
),
width:
1
)),
child:
Container
(
child:
Image
.
network
(
decoration:
BoxDecoration
(
'https://img1.gamersky.com/image2019/07/20190725_ll_red_136_2/gamersky_07small_14_201972510258D0.jpg'
,
borderRadius:
BorderRadius
.
circular
(
17
),
width:
86
,
border:
height:
86
,
Border
.
all
(
color:
Color
(
0xffF9F8FB
),
width:
1
)),
fit:
BoxFit
.
cover
,
child:
Image
.
network
(
),
e
.
data
.
second
,
)),
width:
86
,
Padding
(
height:
86
,
padding:
EdgeInsets
.
only
(
left:
12
,
top:
5
),
fit:
BoxFit
.
cover
,
child:
Column
(
),
));
}),
Padding
(
padding:
EdgeInsets
.
only
(
left:
12
,
top:
5
),
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
max
,
children:
<
Widget
>[
title
((
data
)
{
return
Text
(
data
,
style:
TextStyle
(
color:
Color
(
0xff333333
),
fontSize:
15
,
fontWeight:
FontWeight
.
bold
));
}),
Padding
(
padding:
EdgeInsets
.
only
(
top:
5
)),
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
max
,
verticalDirection:
VerticalDirection
.
up
,
children:
<
Widget
>[
children:
<
Widget
>[
Text
(
'
乔雅登玻尿酸(药品类)
'
,
Text
(
'
指导价:
'
,
style:
TextStyle
(
style:
TextStyle
(
color:
Color
(
0xff333333
),
color:
Color
(
0xff999999
),
fontSize:
12
)),
fontSize:
15
,
Text
(
fontWeight:
FontWeight
.
bold
)),
'¥2000-5000'
,
Padding
(
padding:
EdgeInsets
.
only
(
top:
5
)),
style:
Row
(
TextStyle
(
color:
Color
(
0xffFF5963
),
fontSize:
12
),
crossAxisAlignment:
CrossAxisAlignment
.
start
,
verticalDirection:
VerticalDirection
.
up
,
children:
<
Widget
>[
Text
(
'指导价:'
,
style:
TextStyle
(
color:
Color
(
0xff999999
),
fontSize:
12
)),
Text
(
'¥2000-5000'
,
style:
TextStyle
(
color:
Color
(
0xffFF5963
),
fontSize:
12
),
)
],
)
)
],
],
)
),
)
],
],
),
)
),
);
],
}
,
)
,
);
);
}
}
// 方案属性
Widget
rect
()
{
Widget
rect
()
{
return
Padding
(
return
Padding
(
padding:
EdgeInsets
.
only
(
top:
20
),
padding:
EdgeInsets
.
only
(
top:
20
),
child:
StreamBuilder
<
List
<
String
>>(
child:
StreamBuilder
<
Pair
<
int
,
List
<
OverviewAttrsEntity
>
>>(
stream:
_model
.
rect
Live
.
stream
,
stream:
_model
.
overviewAttrs
Live
.
stream
,
initialData:
[
"w"
,
"w"
,
"q"
,
"w"
,
"w"
,
"w"
,
"q"
,
"w"
]
,
initialData:
_model
.
overviewAttrsLive
.
data
??
Pair
(
LOADING
,
null
)
,
builder:
(
c
,
data
)
{
builder:
(
c
,
data
)
{
if
(
data
.
data
.
first
==
FAIL
)
{
return
Center
();
}
final
overviewAttrs
=
data
.
data
.
second
;
List
<
Widget
>
list
=
List
();
List
<
Widget
>
list
=
List
();
for
(
int
i
=
0
;
i
<
data
.
data
.
length
;
i
+=
2
)
{
for
(
int
i
=
0
;
i
<
overviewAttrs
.
length
;
i
+=
2
)
{
list
.
add
(
Expanded
(
list
.
add
(
Expanded
(
child:
Container
(
child:
Container
(
alignment:
Alignment
.
center
,
alignment:
Alignment
.
center
,
...
@@ -171,13 +206,14 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -171,13 +206,14 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
mainAxisSize:
MainAxisSize
.
min
,
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
children:
<
Widget
>[
baseText
(
data
.
data
[
i
],
14
,
Color
(
0xff282828
),
bold:
true
),
baseText
(
overviewAttrs
[
i
].
attrName
,
14
,
Color
(
0xff282828
),
baseText
(
data
.
data
[
i
+
1
],
11
,
Color
(
0xff999999
)),
bold:
true
),
baseText
(
overviewAttrs
[
i
].
attrValue
,
11
,
Color
(
0xff999999
)),
],
],
),
),
),
),
));
));
if
(
i
<
data
.
data
.
length
-
2
)
{
if
(
i
<
overviewAttrs
.
length
-
2
)
{
list
.
add
(
Container
(
list
.
add
(
Container
(
width:
0.5
,
width:
0.5
,
height:
18
,
height:
18
,
...
@@ -203,12 +239,14 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -203,12 +239,14 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
);
);
}
}
// 方案项目说明
Widget
explain
()
{
Widget
explain
()
{
return
StreamBuilder
<
List
<
String
>>(
return
StreamBuilder
<
Pair
<
int
,
List
<
ExplanationAttrsEntity
>
>>(
stream:
_model
.
expla
in
Live
.
stream
,
stream:
_model
.
expla
nationAttrs
Live
.
stream
,
initialData:
[
"www"
,
"www"
,
"www"
,
"??"
]
,
initialData:
_model
.
explanationAttrsLive
.
data
??
Pair
(
LOADING
,
null
)
,
builder:
(
c
,
data
)
{
builder:
(
c
,
data
)
{
List
<
Widget
>
list
=
[];
List
<
Widget
>
list
=
[];
List
<
ExplanationAttrsEntity
>
explanationAttrs
=
data
.
data
.
second
;
list
.
add
(
Container
(
list
.
add
(
Container
(
height:
31
,
height:
31
,
child:
Row
(
child:
Row
(
...
@@ -227,15 +265,16 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -227,15 +265,16 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
],
],
),
),
));
));
for
(
int
i
=
0
;
i
<
data
.
data
.
length
;
i
+=
2
)
{
for
(
int
i
=
0
;
i
<
explanationAttrs
.
length
;
i
+=
2
)
{
list
.
add
(
Container
(
list
.
add
(
Container
(
height:
28
,
height:
28
,
child:
Row
(
child:
Row
(
children:
<
Widget
>[
children:
<
Widget
>[
baseText
(
data
.
data
[
i
]
,
13
,
Color
(
0xff999999
)),
baseText
(
explanationAttrs
[
i
].
attrName
,
13
,
Color
(
0xff999999
)),
Container
(
Container
(
margin:
EdgeInsets
.
only
(
left:
12
),
margin:
EdgeInsets
.
only
(
left:
12
),
child:
baseText
(
data
.
data
[
i
+
1
],
13
,
Color
(
0xff666666
)),
child:
baseText
(
explanationAttrs
[
i
].
attrValue
,
13
,
Color
(
0xff666666
)),
)
)
],
],
),
),
...
@@ -252,6 +291,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -252,6 +291,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
);
);
}
}
// 底部按钮
Widget
bottomWidget
()
{
Widget
bottomWidget
()
{
return
Container
(
return
Container
(
width:
double
.
maxFinite
,
width:
double
.
maxFinite
,
...
@@ -316,6 +356,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -316,6 +356,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
);
);
}
}
// 列表页面
Widget
pages
()
{
Widget
pages
()
{
return
StreamBuilder
<
Pair
<
int
,
List
<
Cards
>>>(
return
StreamBuilder
<
Pair
<
int
,
List
<
Cards
>>>(
stream:
_model
.
cardsLive
.
stream
,
stream:
_model
.
cardsLive
.
stream
,
...
@@ -326,7 +367,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -326,7 +367,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
width:
double
.
maxFinite
,
width:
double
.
maxFinite
,
child:
TabBarView
(
child:
TabBarView
(
controller:
tabController
,
controller:
tabController
,
children:
_model
.
data
[
tabController
.
index
].
map
((
e
)
{
children:
data
.
data
.
second
[
tabController
.
index
].
map
((
e
)
{
return
ListView
.
builder
(
return
ListView
.
builder
(
physics:
NeverScrollableScrollPhysics
(),
physics:
NeverScrollableScrollPhysics
(),
itemBuilder:
(
c
,
index
)
{
itemBuilder:
(
c
,
index
)
{
...
@@ -338,6 +379,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -338,6 +379,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
});
});
}
}
// 医生卡片
Widget
DoctorItem
(
BuildContext
context
,
cards
)
{
Widget
DoctorItem
(
BuildContext
context
,
cards
)
{
if
(
cards
.
doctor
==
null
&&
isDebug
)
{
if
(
cards
.
doctor
==
null
&&
isDebug
)
{
throw
new
Exception
();
throw
new
Exception
();
...
@@ -406,6 +448,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -406,6 +448,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
);
);
}
}
// 医院卡片
Widget
HospitalItem
(
BuildContext
context
,
cards
)
{
Widget
HospitalItem
(
BuildContext
context
,
cards
)
{
if
(
cards
.
hospital
==
null
&&
isDebug
)
{
if
(
cards
.
hospital
==
null
&&
isDebug
)
{
throw
new
Exception
();
throw
new
Exception
();
...
@@ -476,6 +519,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -476,6 +519,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
));
));
}
}
// 获取低价按钮
Widget
lowPriceWidget
()
{
Widget
lowPriceWidget
()
{
return
GestureDetector
(
return
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
behavior:
HitTestBehavior
.
opaque
,
...
@@ -491,6 +535,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
...
@@ -491,6 +535,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
);
);
}
}
// 咨询按钮
Widget
askWidget
()
{
Widget
askWidget
()
{
return
GestureDetector
(
return
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
behavior:
HitTestBehavior
.
opaque
,
...
...
lib/ClueModel/page/mechanismBox/MechanismBoxPage.dart
View file @
3280ec6b
...
@@ -5,6 +5,7 @@ import 'package:flutter_common/commonModel/toast/NativeToast.dart';
...
@@ -5,6 +5,7 @@ import 'package:flutter_common/commonModel/toast/NativeToast.dart';
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
import
'package:gm_flutter/ClueModel/view/FiveStarView.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/ClueModel/page/mechanismBox/MechanismModel.dart'
;
import
'package:gm_flutter/ClueModel/page/mechanismBox/MechanismModel.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
class
MechanismBox
implements
IBottomPicker
{
class
MechanismBox
implements
IBottomPicker
{
VoidCallback
dismissCall
;
VoidCallback
dismissCall
;
...
@@ -24,6 +25,30 @@ class MechanismBox implements IBottomPicker {
...
@@ -24,6 +25,30 @@ class MechanismBox implements IBottomPicker {
}
}
Widget
build
(
BuildContext
context
)
{
Widget
build
(
BuildContext
context
)
{
return
StreamBuilder
(
stream:
_model
.
stateLive
.
stream
,
initialData:
_model
.
stateLive
.
data
??
LOADING
,
builder:
(
c
,
data
)
{
if
(
data
.
data
==
FAIL
)
{
return
errorItem
(
MediaQuery
.
of
(
context
).
size
.
width
,
MediaQuery
.
of
(
context
).
size
.
height
,
()
{
_model
.
getQuestions
(
plan_id
);
});
}
if
(
data
.
data
==
LOADING
)
{
return
loadingItem
();
}
return
setupHome
(
context
);
},
);
}
@override
void
dispose
()
{
textController
.
dispose
();
}
setupHome
(
context
)
{
MediaQueryData
mq
=
MediaQuery
.
of
(
context
);
MediaQueryData
mq
=
MediaQuery
.
of
(
context
);
double
keyHeight
=
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
;
double
keyHeight
=
MediaQuery
.
of
(
context
).
viewInsets
.
bottom
;
return
ClipRRect
(
return
ClipRRect
(
...
@@ -44,11 +69,6 @@ class MechanismBox implements IBottomPicker {
...
@@ -44,11 +69,6 @@ class MechanismBox implements IBottomPicker {
);
);
}
}
@override
void
dispose
()
{
textController
.
dispose
();
}
// 弹窗标题
// 弹窗标题
Widget
title
(
mq
)
{
Widget
title
(
mq
)
{
return
Container
(
return
Container
(
...
@@ -197,14 +217,16 @@ class MechanismBox implements IBottomPicker {
...
@@ -197,14 +217,16 @@ class MechanismBox implements IBottomPicker {
fontSize:
12
),
fontSize:
12
),
)),
)),
Expanded
(
Expanded
(
child:
StreamBuilder
<
List
<
String
>>(
child:
StreamBuilder
<
Pair
<
int
,
List
<
String
>
>>(
stream:
_model
.
questionsLive
.
stream
,
stream:
_model
.
questionsLive
.
stream
,
initialData:
_model
.
questionsLive
.
data
??
null
,
initialData:
_model
.
questionsLive
.
data
??
null
,
builder:
(
c
,
e
)
{
builder:
(
c
,
e
)
{
print
(
'dssdadsadas'
);
print
(
e
.
data
.
toString
());
if
(
e
.
data
==
null
)
{
if
(
e
.
data
==
null
)
{
return
Container
();
return
Container
();
}
}
List
<
String
>
questions
=
e
.
data
;
List
<
String
>
questions
=
e
.
data
.
second
;
return
ListView
.
builder
(
return
ListView
.
builder
(
scrollDirection:
Axis
.
horizontal
,
//横向滚动
scrollDirection:
Axis
.
horizontal
,
//横向滚动
itemBuilder:
(
c
,
index
)
{
itemBuilder:
(
c
,
index
)
{
...
...
lib/ClueModel/page/mechanismBox/MechanismModel.dart
View file @
3280ec6b
...
@@ -9,17 +9,15 @@ import 'package:flutter_common/commonModel/live/BaseModel.dart';
...
@@ -9,17 +9,15 @@ 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:flutter_common/commonModel/toast/NativeToast.dart'
;
import
'package:flutter_common/commonModel/toast/NativeToast.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/ConsultQuestionsBean.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'
;
import
'package:gm_flutter/commonModel/util/PrintUtil.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'../../../commonModel/net/DioUtil.dart'
;
import
'../../../commonModel/util/PrintUtil.dart'
;
import
'../../server/api/ClueApi.serv.dart'
;
class
MechanismModel
extends
BaseModel
{
class
MechanismModel
extends
BaseModel
{
LiveData
<
List
<
String
>>
questionsLive
=
LiveData
();
LiveData
<
Pair
<
int
,
List
<
String
>>>
questionsLive
=
LiveData
();
LiveData
<
int
>
stateLive
=
LiveData
();
LiveData
messageLive
=
LiveData
();
LiveData
messageLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
RxDispose
rxDispose
=
RxDispose
();
...
@@ -28,26 +26,28 @@ class MechanismModel extends BaseModel {
...
@@ -28,26 +26,28 @@ class MechanismModel extends BaseModel {
.
getConsultQuestions
(
DioUtil
.
getInstance
().
getDio
(),
plan_id
)
.
getConsultQuestions
(
DioUtil
.
getInstance
().
getDio
(),
plan_id
)
.
listen
((
event
)
{
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
if
(
event
.
error
==
0
)
{
questionsLive
.
notifyView
(
event
.
data
.
questions
);
stateLive
.
notifyView
(
ENDLOADING
);
questionsLive
.
notifyView
(
Pair
(
ENDLOADING
,
event
.
data
.
questions
));
}
else
{
}
else
{
stateLive
.
notifyView
(
FAIL
);
questionsLive
.
notifyView
(
Pair
(
FAIL
,
null
));
NativeToast
.
showNativeToast
(
event
.
message
);
NativeToast
.
showNativeToast
(
event
.
message
);
//TODO
}
}
})
})
.
addToDispose
(
rxDispose
)
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
.
onError
((
err
)
{
stateLive
.
notifyView
(
FAIL
);
questionsLive
.
notifyView
(
Pair
(
FAIL
,
null
));
PrintUtil
.
printBug
(
err
);
PrintUtil
.
printBug
(
err
);
});
});
}
}
sendMessage
(
List
<
int
>
doctor_ids
,
String
question
,
int
plan_id
)
{
sendMessage
(
List
<
int
>
doctor_ids
,
String
question
,
int
plan_id
)
{
ClueApiImpl
.
getInstance
()
ClueApiImpl
.
getInstance
()
.
sendMessage
(
DioUtil
.
getInstance
().
getDio
(),
doctor_ids
,
.
sendMessage
(
question
,
plan_id
)
DioUtil
.
getInstance
().
getDio
(),
doctor_ids
,
question
,
plan_id
)
.
listen
((
event
)
{
.
listen
((
event
)
{
print
(
'11111'
);
if
(
event
.
error
==
0
)
{
if
(
event
.
error
==
0
)
{
print
(
'kljfjkfdhkhkdfsklkds'
);
messageLive
.
notifyView
(
event
.
data
.
success
);
messageLive
.
notifyView
(
event
.
data
.
success
);
}
else
{
}
else
{
NativeToast
.
showNativeToast
(
event
.
message
);
NativeToast
.
showNativeToast
(
event
.
message
);
...
@@ -62,6 +62,7 @@ class MechanismModel extends BaseModel {
...
@@ -62,6 +62,7 @@ class MechanismModel extends BaseModel {
@override
@override
void
dispose
()
{
void
dispose
()
{
questionsLive
.
dispost
();
questionsLive
.
dispost
();
stateLive
.
dispost
();
rxDispose
.
dispose
();
rxDispose
.
dispose
();
}
}
}
}
lib/ClueModel/server/entity/PlanOverviewBean.dart
View file @
3280ec6b
...
@@ -58,8 +58,9 @@ class Data {
...
@@ -58,8 +58,9 @@ class Data {
String
positiveRate
;
String
positiveRate
;
String
salesCount
;
String
salesCount
;
String
planDescription
;
String
planDescription
;
List
<
OverviewAttrs
>
overviewAttrs
;
String
guidePrice
;
List
<
ExplanationAttrs
>
explanationAttrs
;
List
<
OverviewAttrsEntity
>
overviewAttrs
;
List
<
ExplanationAttrsEntity
>
explanationAttrs
;
List
<
Tabs
>
tabs
;
List
<
Tabs
>
tabs
;
Data
(
Data
(
...
@@ -68,6 +69,7 @@ class Data {
...
@@ -68,6 +69,7 @@ class Data {
this
.
positiveRate
,
this
.
positiveRate
,
this
.
salesCount
,
this
.
salesCount
,
this
.
planDescription
,
this
.
planDescription
,
this
.
guidePrice
,
this
.
overviewAttrs
,
this
.
overviewAttrs
,
this
.
explanationAttrs
,
this
.
explanationAttrs
,
this
.
tabs
});
this
.
tabs
});
...
@@ -79,16 +81,17 @@ class Data {
...
@@ -79,16 +81,17 @@ class Data {
positiveRate
=
json
[
'positive_rate'
];
positiveRate
=
json
[
'positive_rate'
];
salesCount
=
json
[
'sales_count'
];
salesCount
=
json
[
'sales_count'
];
planDescription
=
json
[
'plan_description'
];
planDescription
=
json
[
'plan_description'
];
guidePrice
=
json
[
'guide_price'
];
if
(
json
[
'overview_attrs'
]
!=
null
)
{
if
(
json
[
'overview_attrs'
]
!=
null
)
{
overviewAttrs
=
new
List
<
OverviewAttrs
>();
overviewAttrs
=
new
List
<
OverviewAttrs
Entity
>();
json
[
'overview_attrs'
].
forEach
((
v
)
{
json
[
'overview_attrs'
].
forEach
((
v
)
{
overviewAttrs
.
add
(
new
OverviewAttrs
.
fromJson
(
v
));
overviewAttrs
.
add
(
new
OverviewAttrs
Entity
.
fromJson
(
v
));
});
});
}
}
if
(
json
[
'explanation_attrs'
]
!=
null
)
{
if
(
json
[
'explanation_attrs'
]
!=
null
)
{
explanationAttrs
=
new
List
<
ExplanationAttrs
>();
explanationAttrs
=
new
List
<
ExplanationAttrs
Entity
>();
json
[
'explanation_attrs'
].
forEach
((
v
)
{
json
[
'explanation_attrs'
].
forEach
((
v
)
{
explanationAttrs
.
add
(
new
ExplanationAttrs
.
fromJson
(
v
));
explanationAttrs
.
add
(
new
ExplanationAttrs
Entity
.
fromJson
(
v
));
});
});
}
}
if
(
json
[
'tabs'
]
!=
null
)
{
if
(
json
[
'tabs'
]
!=
null
)
{
...
@@ -108,6 +111,7 @@ class Data {
...
@@ -108,6 +111,7 @@ class Data {
data
[
'positive_rate'
]
=
this
.
positiveRate
;
data
[
'positive_rate'
]
=
this
.
positiveRate
;
data
[
'sales_count'
]
=
this
.
salesCount
;
data
[
'sales_count'
]
=
this
.
salesCount
;
data
[
'plan_description'
]
=
this
.
planDescription
;
data
[
'plan_description'
]
=
this
.
planDescription
;
data
[
'guide_price'
]
=
this
.
guidePrice
;
if
(
this
.
overviewAttrs
!=
null
)
{
if
(
this
.
overviewAttrs
!=
null
)
{
data
[
'overview_attrs'
]
=
data
[
'overview_attrs'
]
=
this
.
overviewAttrs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
this
.
overviewAttrs
.
map
((
v
)
=>
v
.
toJson
()).
toList
();
...
@@ -145,14 +149,14 @@ class Banner {
...
@@ -145,14 +149,14 @@ class Banner {
}
}
}
}
class
OverviewAttrs
{
class
OverviewAttrs
Entity
{
int
attrId
;
int
attrId
;
String
attrName
;
String
attrName
;
String
attrValue
;
String
attrValue
;
OverviewAttrs
({
this
.
attrId
,
this
.
attrName
,
this
.
attrValue
});
OverviewAttrs
Entity
({
this
.
attrId
,
this
.
attrName
,
this
.
attrValue
});
OverviewAttrs
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
OverviewAttrs
Entity
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
attrId
=
json
[
'attr_id'
];
attrId
=
json
[
'attr_id'
];
attrName
=
json
[
'attr_name'
];
attrName
=
json
[
'attr_name'
];
attrValue
=
json
[
'attr_value'
];
attrValue
=
json
[
'attr_value'
];
...
@@ -167,14 +171,14 @@ class OverviewAttrs {
...
@@ -167,14 +171,14 @@ class OverviewAttrs {
}
}
}
}
class
ExplanationAttrs
{
class
ExplanationAttrs
Entity
{
int
attrId
;
int
attrId
;
String
attrName
;
String
attrName
;
String
attrValue
;
String
attrValue
;
ExplanationAttrs
({
this
.
attrId
,
this
.
attrName
,
this
.
attrValue
});
ExplanationAttrs
Entity
({
this
.
attrId
,
this
.
attrName
,
this
.
attrValue
});
ExplanationAttrs
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
ExplanationAttrs
Entity
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
attrId
=
json
[
'attr_id'
];
attrId
=
json
[
'attr_id'
];
attrName
=
json
[
'attr_name'
];
attrName
=
json
[
'attr_name'
];
attrValue
=
json
[
'attr_value'
];
attrValue
=
json
[
'attr_value'
];
...
...
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