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
606b3123
Commit
606b3123
authored
Jun 30, 2020
by
杜欣
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
二级方案
parent
a8260add
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
326 additions
and
27 deletions
+326
-27
LevelTwoModel.dart
lib/ClueModel/page/levelTwo/LevelTwoModel.dart
+100
-0
LevelTwoPage.dart
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
+223
-27
TestPage.dart
lib/MainRouter/page/test/TestPage.dart
+3
-0
No files found.
lib/ClueModel/page/levelTwo/LevelTwoModel.dart
0 → 100644
View file @
606b3123
/*
* @author lsy
* @date 2020/6/29
**/
import
'package:flutter/material.dart'
;
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/LevelOneFeedList.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
LevelTwoModel
extends
BaseModel
{
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
();
List
list
=
[
"plan"
,
"hospital"
,
"doctor"
,
"diary"
];
List
pageList
=
[
1
,
1
,
1
,
1
];
List
pageHeightList
=
[
118
,
149
,
118
,
118
];
void
refreshView
(
bool
clear
,
{
RefreshController
refreshListener
})
{
Future
.
delayed
(
Duration
(
seconds:
1
),
()
{
Cards
cards
=
Cards
(
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
));
});
// int index = currentIndex;
// if (clear) {
// data.clear();
// pageList = [1, 1, 1, 1];
// }
// ClueApiImpl.getInstance()
// .getLevelOneList(
// DioUtil.getInstance().getDio(), 123, list[index], pageList[index])
// .listen((event) {})
// .addToDispose(rxDispose)
// .onError((err) {});
}
int
currentIndex
=
0
;
@override
void
dispose
()
{
showTab
.
dispost
();
cardsLive
.
dispost
();
appBarLive
.
dispost
();
rectLive
.
dispost
();
topIndexLive
.
dispost
();
topScrollLive
.
dispost
();
loadingLive
.
dispost
();
}
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
()
{}
}
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
View file @
606b3123
...
...
@@ -4,6 +4,7 @@
**/
import
'package:flutter/material.dart'
;
import
'package:gm_flutter/ClueModel/page/levelTwo/LevelTwoModel.dart'
;
import
'package:gm_flutter/commonModel/base/BaseState.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
...
...
@@ -14,6 +15,7 @@ class LevelTwoPage extends StatefulWidget {
class
_LevelTwoPageState
extends
BaseState
<
LevelTwoPage
>
with
SingleTickerProviderStateMixin
{
LevelTwoModel
_model
=
new
LevelTwoModel
();
TabController
tabController
;
@override
...
...
@@ -22,12 +24,75 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
this
.
tabController
=
TabController
(
length:
2
,
vsync:
this
);
}
@override
void
dispose
()
{
_model
.
dispose
();
super
.
dispose
();
}
@override
Widget
buildItem
(
BuildContext
context
)
{
return
Scaffold
(
body:
Column
(
body:
Stack
(
children:
<
Widget
>[
Padding
(
CustomScrollView
(
slivers:
<
Widget
>[
SliverAppBar
(
pinned:
true
,
elevation:
0
,
expandedHeight:
0
,
flexibleSpace:
FlexibleSpaceBar
(
title:
Text
(
'二级方案'
)),
),
SliverToBoxAdapter
(
child:
Column
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
mainAxisSize:
MainAxisSize
.
max
,
children:
<
Widget
>[
good
(),
rect
(),
explain
()],
)),
SliverPersistentHeader
(
pinned:
true
,
delegate:
StickyTabBarDelegate
(
child:
TabBar
(
labelColor:
Color
(
0xff282828
),
labelStyle:
TextStyle
(
fontSize:
15.0
,
fontWeight:
FontWeight
.
bold
),
labelPadding:
EdgeInsets
.
only
(
top:
15.0
),
unselectedLabelColor:
Color
(
0xffB5B5B5
),
unselectedLabelStyle:
TextStyle
(
fontSize:
15.0
),
indicatorColor:
Color
(
0xff4ABAB4
),
indicatorWeight:
3.0
,
indicatorSize:
TabBarIndicatorSize
.
label
,
indicatorPadding:
EdgeInsets
.
only
(
left:
5.0
,
right:
5.0
),
controller:
this
.
tabController
,
tabs:
<
Widget
>[
Tab
(
text:
'医院'
),
Tab
(
text:
'医生'
),
],
),
),
),
SliverFillRemaining
(
child:
TabBarView
(
controller:
this
.
tabController
,
children:
<
Widget
>[
Center
(
child:
Text
(
'医院列表'
)),
Center
(
child:
Text
(
'医生列表'
)),
],
),
),
],
),
Positioned
(
left:
0
,
right:
0
,
bottom:
0
,
child:
bottomWidget
())
],
));
}
Widget
good
()
{
return
StreamBuilder
(
stream:
_model
.
rectLive
.
stream
,
initialData:
[
"w"
,
"w"
,
"q"
,
"w"
],
builder:
(
context
,
data
)
{
return
Padding
(
padding:
EdgeInsets
.
only
(
left:
15.0
,
right:
15.0
,
top:
8.0
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
...
...
@@ -57,7 +122,7 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
color:
Color
(
0xff333333
),
fontSize:
15
,
fontWeight:
FontWeight
.
bold
)),
Padding
(
padding:
EdgeInsets
.
only
(
top:
12
)),
Padding
(
padding:
EdgeInsets
.
only
(
top:
5
)),
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
start
,
verticalDirection:
VerticalDirection
.
up
,
...
...
@@ -76,32 +141,163 @@ class _LevelTwoPageState extends BaseState<LevelTwoPage>
)),
],
),
),
Padding
(
padding:
EdgeInsets
.
only
(
top:
20
,
left:
15
,
right:
15
),
child:
Container
(
color:
Color
(
0xffF9F8FB
),
child:
Padding
(
padding:
EdgeInsets
.
only
(
top:
15
,
left:
21
,
bottom:
15
),
child:
Row
(
children:
<
Widget
>[
Column
(
children:
<
Widget
>[
Text
(
'乔雅登'
,
style:
TextStyle
(
color:
Color
(
0xff282828
),
fontSize:
14
)),
Padding
(
padding:
EdgeInsets
.
only
(
top:
12
)),
Text
(
'品牌'
,
style:
TextStyle
(
color:
Color
(
0xff999999
),
fontSize:
11
))
],
)
],
);
},
);
}
Widget
rect
()
{
return
StreamBuilder
<
List
<
String
>>(
stream:
_model
.
rectLive
.
stream
,
initialData:
[
"w"
,
"w"
,
"q"
,
"w"
],
builder:
(
c
,
data
)
{
List
<
Widget
>
list
=
List
();
for
(
int
i
=
0
;
i
<
data
.
data
.
length
;
i
+=
2
)
{
list
.
add
(
Expanded
(
child:
Container
(
alignment:
Alignment
.
center
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
baseText
(
data
.
data
[
i
],
14
,
Color
(
0xff282828
),
bold:
true
),
baseText
(
data
.
data
[
i
+
1
],
11
,
Color
(
0xff999999
)),
],
),
),
));
if
(
i
<
data
.
data
.
length
-
2
)
{
list
.
add
(
Container
(
width:
0.5
,
height:
18
,
color:
Color
(
0xFFE5E5E5
),
));
}
}
return
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
4
),
color:
Color
(
0xffF9F8FB
),
),
width:
double
.
maxFinite
,
height:
62
,
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
20
),
child:
Row
(
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
list
,
),
);
},
);
}
Widget
explain
()
{
return
StreamBuilder
<
List
<
String
>>(
stream:
_model
.
explainLive
.
stream
,
initialData:
[
"www"
,
"www"
,
"www"
,
"??"
],
builder:
(
c
,
data
)
{
List
<
Widget
>
list
=
[];
list
.
add
(
Container
(
height:
31
,
child:
Row
(
children:
<
Widget
>[
baseText
(
"项目说明"
,
15
,
Color
(
0xff282828
)),
Expanded
(
child:
Container
(),
),
GestureDetector
(
onTap:
()
{
//TODO
},
behavior:
HitTestBehavior
.
opaque
,
child:
baseText
(
"了解更多"
,
12
,
Color
(
0xff3FB5AF
)),
)
],
),
));
for
(
int
i
=
0
;
i
<
data
.
data
.
length
;
i
+=
2
)
{
list
.
add
(
Container
(
height:
28
,
child:
Row
(
children:
<
Widget
>[
baseText
(
data
.
data
[
i
],
13
,
Color
(
0xff999999
)),
Container
(
margin:
EdgeInsets
.
only
(
left:
12
),
child:
baseText
(
data
.
data
[
i
+
1
],
13
,
Color
(
0xff666666
)),
)
],
),
));
}
return
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
,
bottom:
20
),
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
list
,
),
);
},
);
}
Widget
bottomWidget
()
{
return
Container
(
width:
double
.
maxFinite
,
height:
55
,
child:
Row
(
mainAxisSize:
MainAxisSize
.
min
,
crossAxisAlignment:
CrossAxisAlignment
.
center
,
children:
<
Widget
>[
Container
(
margin:
EdgeInsets
.
only
(
left:
18
),
width:
30
,
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
children:
<
Widget
>[
Container
(
width:
22
,
height:
22
,
child:
Image
.
asset
(
"assets/vs_black.png"
),
),
Container
(
margin:
EdgeInsets
.
only
(
top:
3
),
child:
baseText
(
"去比较"
,
10
,
Color
(
0xff282828
)),
)
],
),
),
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
{},
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
15
),
width:
135
,
height:
40
,
decoration:
BoxDecoration
(
color:
Color
(
0xff51CDC7
),
borderRadius:
BorderRadius
.
circular
(
20
)),
alignment:
Alignment
.
center
,
child:
baseText
(
"咨询"
,
14
,
Colors
.
white
,
bold:
true
),
)),
),
],
));
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
{},
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
15
),
width:
135
,
height:
40
,
decoration:
BoxDecoration
(
color:
Color
(
0xffF96079
),
borderRadius:
BorderRadius
.
circular
(
20
)),
alignment:
Alignment
.
center
,
child:
baseText
(
"获取底价"
,
14
,
Colors
.
white
,
bold:
true
),
)),
Expanded
(
child:
Container
(),
)
],
),
);
}
}
...
...
lib/MainRouter/page/test/TestPage.dart
View file @
606b3123
...
...
@@ -28,6 +28,9 @@ class TestState extends BaseState<TestPage> {
list
.
add
(
listItem
(
"一级列表页"
,
()
{
JumpUtil
.
jumpToPageRight
(
context
,
RouterCenterImpl
().
findClueRouter
().
getLevelOnePage
());
}));
list
.
add
(
listItem
(
"二级列表页"
,
()
{
JumpUtil
.
jumpToPageRight
(
context
,
RouterCenterImpl
().
findClueRouter
().
getLevelTwoPage
());
}));
return
list
;
}
...
...
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