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
b1742a37
Commit
b1742a37
authored
Jul 10, 2020
by
林生雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
w
parent
b3998064
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
323 additions
and
109 deletions
+323
-109
PlanCompareDetailModel.dart
...eModel/page/PlanCompareDetail/PlanCompareDetailModel.dart
+7
-7
PlanCompareDetailPage.dart
...ueModel/page/PlanCompareDetail/PlanCompareDetailPage.dart
+27
-15
PlansCompareFeedItemView.dart
...Model/page/PlansCompareFeed/PlansCompareFeedItemView.dart
+2
-1
LevelOneList.dart
lib/ClueModel/page/levelOne/LevelOneList.dart
+2
-1
LevelOnePage.dart
lib/ClueModel/page/levelOne/LevelOnePage.dart
+11
-16
LevelTwoPage.dart
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
+5
-6
FilterView.dart
lib/ClueModel/page/plan/FilterView.dart
+59
-10
PlanItem.dart
lib/ClueModel/page/plan/PlanItem.dart
+2
-1
PlanModel.dart
lib/ClueModel/page/plan/PlanModel.dart
+76
-29
PlanModelInstance.dart
lib/ClueModel/page/plan/PlanModelInstance.dart
+17
-2
PlanPage.dart
lib/ClueModel/page/plan/PlanPage.dart
+11
-6
PlanProgressBar.dart
lib/ClueModel/page/plan/PlanProgressBar.dart
+16
-2
ProjectView.dart
lib/ClueModel/page/plan/ProjectView.dart
+31
-5
PlanCompareDetail.dart
lib/ClueModel/server/entity/PlanCompareDetail.dart
+6
-6
PlanOverviewBean.dart
lib/ClueModel/server/entity/PlanOverviewBean.dart
+2
-2
NumPlanUtil.dart
lib/ClueModel/util/NumPlanUtil.dart
+27
-0
pubspec.lock
pubspec.lock
+21
-0
pubspec.yaml
pubspec.yaml
+1
-0
No files found.
lib/ClueModel/page/PlanCompareDetail/PlanCompareDetailModel.dart
View file @
b1742a37
...
...
@@ -15,7 +15,7 @@ import 'package:gm_flutter/commonModel/bean/Pair.dart';
class
PlanCompareDetailModel
extends
BaseModel
{
LiveData
<
Pair
<
int
,
List
<
Groups
>>>
detailLive
=
LiveData
();
LiveData
<
Pair
<
int
,
List
<
PlansInfo
>
>>
headerLive
=
LiveData
();
LiveData
<
List
<
PlansInfoDetail
>>
headerLive
=
LiveData
();
LiveData
<
int
>
stateLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
...
...
@@ -26,24 +26,24 @@ class PlanCompareDetailModel extends BaseModel {
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
stateLive
.
notifyView
(
ENDLOADING
);
if
(
event
.
data
.
plansInfo
==
null
||
event
.
data
.
groups
.
isEmpty
)
{
headerLive
.
notifyView
(
Pair
(
ENDLOADING
,
[]));
detailLive
.
notifyView
(
Pair
(
ENDLOADING
,
[]));
if
(
event
.
data
.
groups
==
null
||
event
.
data
.
groups
.
isEmpty
)
{
detailLive
.
notifyView
(
Pair
(
EMPTY
,
null
));
}
else
{
detailLive
.
notifyView
(
Pair
(
ENDLOADING
,
event
.
data
.
groups
));
headerLive
.
notifyView
(
Pair
(
ENDLOADING
,
event
.
data
.
plansInfo
));
}
if
(
event
.
data
.
plansInfo
!=
null
&&
event
.
data
.
plansInfo
.
length
>
1
)
{
headerLive
.
notifyView
(
event
.
data
.
plansInfo
);
}
}
else
{
stateLive
.
notifyView
(
FAIL
);
NativeToast
.
showNativeToast
(
event
.
message
);
headerLive
.
notifyView
(
Pair
(
FAIL
,
null
));
detailLive
.
notifyView
(
Pair
(
FAIL
,
null
));
}
})
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
stateLive
.
notifyView
(
FAIL
);
headerLive
.
notifyView
(
Pair
(
FAIL
,
null
));
detailLive
.
notifyView
(
Pair
(
FAIL
,
null
));
NativeToast
.
showNativeToast
(
err
.
message
);
});
...
...
lib/ClueModel/page/PlanCompareDetail/PlanCompareDetailPage.dart
View file @
b1742a37
...
...
@@ -16,6 +16,7 @@ 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/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/net/DioUtil.dart'
;
import
'dart:convert'
;
import
'package:gm_flutter/main.mark.dart'
;
...
...
@@ -35,8 +36,10 @@ class PlanCompareDetailPage extends StatefulWidget {
class
PlanCompareDetailPageState
extends
BaseState
<
PlanCompareDetailPage
>
{
PlanCompareDetailModel
_model
=
new
PlanCompareDetailModel
();
double
screenWidth
;
@override
void
initState
()
{
// DioUtil.getInstance().setProxy("172.30.9.128");
super
.
initState
();
_model
.
init
(
widget
.
_planIds
);
}
...
...
@@ -55,9 +58,9 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
title:
"对比详情"
,
centerTitle:
true
,
backClick:
()
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
FlutterBoost
.
singleton
.
closeCurrent
();
}
else
{
}
else
{
Navigator
.
of
(
context
).
pop
();
}
}),
...
...
@@ -74,6 +77,7 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
if
(
data
.
data
==
FAIL
)
{
return
errorItem
(
MediaQuery
.
of
(
context
).
size
.
width
,
MediaQuery
.
of
(
context
).
size
.
height
,
()
{
_model
.
stateLive
.
notifyView
(
LOADING
);
_model
.
init
(
widget
.
_planIds
);
});
}
...
...
@@ -98,9 +102,14 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
if
(
data
.
data
.
first
==
FAIL
)
{
return
errorItem
(
MediaQuery
.
of
(
context
).
size
.
width
,
MediaQuery
.
of
(
context
).
size
.
height
,
()
{
_model
.
stateLive
.
notifyView
(
LOADING
);
_model
.
init
(
widget
.
_planIds
);
});
}
if
(
data
.
data
.
first
==
EMPTY
)
{
return
emptyItem
(
MediaQuery
.
of
(
context
).
size
.
width
,
MediaQuery
.
of
(
context
).
size
.
height
);
}
return
ListView
.
builder
(
itemBuilder:
(
BuildContext
context
,
int
index
)
{
if
(
index
==
data
.
data
.
second
.
length
*
2
-
1
)
{
...
...
@@ -163,14 +172,13 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
}
Widget
headItem
(
int
index
)
{
return
StreamBuilder
(
return
StreamBuilder
<
List
<
PlansInfoDetail
>>
(
stream:
_model
.
headerLive
.
stream
,
initialData:
_model
.
headerLive
.
data
??
null
,
builder:
(
c
,
data
)
{
if
(
data
.
data
==
null
)
{
if
(
data
.
data
==
null
||
data
.
data
.
length
!=
2
)
{
return
Container
();
}
PlansInfo
planinfo
=
data
.
data
.
second
[
index
];
return
Container
(
child:
Stack
(
children:
<
Widget
>[
Positioned
(
...
...
@@ -188,14 +196,19 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
Positioned
(
left:
12
,
top:
24
,
child:
b
aseText
(
planinfo
.
planName
,
15
,
Color
(
0xff333333
),
b
old:
true
),
child:
baseText
(
data
.
data
[
index
].
planName
,
15
,
Color
(
0xff333333
),
bold:
true
),
),
Positioned
(
left:
12
,
top:
48
,
child:
baseText
(
'¥'
+
planinfo
.
minPrice
+
'-'
+
planinfo
.
maxPrice
,
14
,
Colors
.
red
,
child:
baseText
(
'¥'
+
data
.
data
[
index
].
minPrice
+
'-'
+
data
.
data
[
index
].
maxPrice
,
14
,
Colors
.
red
,
bold:
true
),
),
]));
...
...
@@ -234,22 +247,21 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
}
Widget
planPopularityView
(
Groups
groups
)
{
return
Container
(
child:
Column
(
return
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
titleView
(
groups
.
groupName
),
Container
(
child:
planPopularityBodyView
(
groups
)
),
planPopularityBodyView
(
groups
),
Container
()
]),
);
]);
}
Widget
planPopularityBodyView
(
Groups
groups
)
{
return
Container
(
height:
170
,
child:
Row
(
children:
<
Widget
>[
child:
Row
(
children:
<
Widget
>[
Expanded
(
flex:
1
,
child:
planPopularityLeftItem
(
groups
.
plans
[
0
],
groups
)),
Expanded
(
...
...
lib/ClueModel/page/PlansCompareFeed/PlansCompareFeedItemView.dart
View file @
b1742a37
...
...
@@ -3,6 +3,7 @@ import 'package:flutter/cupertino.dart';
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/toast/NativeToast.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlansCompareFeed.dart'
;
import
'package:gm_flutter/ClueModel/util/NumPlanUtil.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'
;
...
...
@@ -113,7 +114,7 @@ class _PlansCompareFeedItemViewState
baseText
(
'¥
${widget.plan.minPrice}
-
${widget.plan.maxPrice}
'
,
13
,
Color
(
0xFFFF5963
)),
baseText
(
"销量
${
widget.plan.salesCount
}
"
,
11
,
Color
(
0xFF282828
))
"销量
${
NumPlanUtil.getSale(widget.plan.salesCount)
}
"
,
11
,
Color
(
0xFF282828
))
],
)
],
...
...
lib/ClueModel/page/levelOne/LevelOneList.dart
View file @
b1742a37
...
...
@@ -66,6 +66,7 @@ class LevelOneListState extends State<LevelOneList>
super
.
build
(
context
);
return
baseStateView
(
MediaQuery
.
of
(
context
).
size
.
width
,
MediaQuery
.
of
(
context
).
size
.
height
,
_model
.
stateLive
,
pages
(),
()
{
_model
.
stateLive
.
notifyView
(
LOADING
);
_model
.
refreshView
(
true
);
},
paddingTop:
widget
.
topHeight
);
}
...
...
@@ -183,7 +184,7 @@ class LevelOneListState extends State<LevelOneList>
],
),
onLoading:
()
{
_model
.
loadMore
();
},
pullDown:
false
,
pullUp:
true
,
loadMoreColor:
Color
(
0xffF7F6FA
));
},
pullDown:
false
,
pullUp:
true
,
loadMoreColor:
Color
(
0xffF7F6FA
));
}
@override
...
...
lib/ClueModel/page/levelOne/LevelOnePage.dart
View file @
b1742a37
...
...
@@ -18,6 +18,7 @@ import 'package:gm_flutter/ClueModel/page/common/StickyTabBarDelegate.dart';
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneList.dart'
;
import
'package:gm_flutter/ClueModel/page/levelOne/LevelOneModel.dart'
;
import
'package:gm_flutter/ClueModel/page/mechanismBox/MechanismBoxPage.dart'
;
import
'package:gm_flutter/ClueModel/util/NumPlanUtil.dart'
;
import
'package:gm_flutter/commonModel/App.dart'
;
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
...
...
@@ -117,6 +118,9 @@ class LevelOneState extends BaseState<LevelOnePage>
MediaQuery
.
of
(
context
).
size
.
height
,
_model
.
stateLive
,
Container
(
child:
Column
(
children:
<
Widget
>[
Expanded
(
child:
BaseNestedScrollViewRefreshIndicator
(
onRefresh:
()
async
{
Completer
completer
=
new
Completer
();
...
...
@@ -128,10 +132,7 @@ class LevelOneState extends BaseState<LevelOnePage>
});
return
completer
.
future
;
},
child:
Column
(
children:
<
Widget
>[
Expanded
(
child:
newHomeWarp
(),
child:
newHomeWarp
()),
),
Container
(
height:
0.5
,
...
...
@@ -140,7 +141,7 @@ class LevelOneState extends BaseState<LevelOnePage>
),
bottomWidget
(),
],
)
)),
()
{
)),
()
{
_model
.
stateLive
.
notifyView
(
LOADING
);
_model
.
init
(()
{
_initTabBar
();
...
...
@@ -251,7 +252,6 @@ class LevelOneState extends BaseState<LevelOnePage>
}
Widget
head
()
{
print
(
"SCRRNWIDTH
${MediaQuery.of(context).size.width}
"
);
return
Container
(
key:
keyTop
,
width:
double
.
maxFinite
,
...
...
@@ -329,7 +329,7 @@ class LevelOneState extends BaseState<LevelOnePage>
right:
15
,
bottom:
8
,
child:
baseText
(
"销量
${
_model.planoverItem.salesCount
}
"
,
11
,
Color
(
0xff666666
)),
"销量
${
NumPlanUtil.getSale(_model.planoverItem.salesCount)
}
"
,
11
,
Color
(
0xff666666
)),
)
],
),
...
...
@@ -448,7 +448,7 @@ class LevelOneState extends BaseState<LevelOnePage>
// ),
child:
Text
(
element
.
attrName
.
length
==
2
?
"
${element.attrName.substring(0,
1)}
${element.attrName.substring(1,
2)}
"
?
"
${element.attrName.substring(0,
1)}
${element.attrName.substring(1,
2)}
"
:
element
.
attrName
,
textScaleFactor:
1.0
,
softWrap:
true
,
...
...
@@ -537,9 +537,7 @@ class LevelOneState extends BaseState<LevelOnePage>
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
{
if
(
CacheManager
.
getInstance
()
.
get
(
MEMORY_CACHE
)
.
get
(
USER_ID
)
==
if
(
CacheManager
.
getInstance
().
get
(
MEMORY_CACHE
).
get
(
USER_ID
)
==
null
&&
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
RouterCenterImpl
()
...
...
@@ -563,9 +561,7 @@ class LevelOneState extends BaseState<LevelOnePage>
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
onTap:
()
{
if
(
CacheManager
.
getInstance
()
.
get
(
MEMORY_CACHE
)
.
get
(
USER_ID
)
==
if
(
CacheManager
.
getInstance
().
get
(
MEMORY_CACHE
).
get
(
USER_ID
)
==
null
&&
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
RouterCenterImpl
()
...
...
@@ -585,7 +581,7 @@ class LevelOneState extends BaseState<LevelOnePage>
context
,
widget
.
PAGE_NAME
,
"
${widget.planId}
"
,
""
,
""
);
},
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
),
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
),
width:
ScreenUtil
().
setWidth
(
137
),
height:
40
,
decoration:
BoxDecoration
(
...
...
@@ -594,7 +590,6 @@ class LevelOneState extends BaseState<LevelOnePage>
alignment:
Alignment
.
center
,
child:
baseText
(
"获取底价"
,
14
,
Colors
.
white
,
bold:
true
),
)),
],
),
);
...
...
lib/ClueModel/page/levelTwo/LevelTwoPage.dart
View file @
b1742a37
...
...
@@ -110,6 +110,9 @@ class LevelTwoState extends BaseState<LevelTwoPage>
MediaQuery
.
of
(
context
).
size
.
height
,
_model
.
stateLive
,
Container
(
child:
Column
(
children:
<
Widget
>[
Expanded
(
child:
BaseNestedScrollViewRefreshIndicator
(
onRefresh:
()
async
{
Completer
completer
=
new
Completer
();
...
...
@@ -121,10 +124,7 @@ class LevelTwoState extends BaseState<LevelTwoPage>
});
return
completer
.
future
;
},
child:
Column
(
children:
<
Widget
>[
Expanded
(
child:
newHomeWarp
(),
child:
newHomeWarp
()),
),
Container
(
height:
0.5
,
...
...
@@ -133,8 +133,7 @@ class LevelTwoState extends BaseState<LevelTwoPage>
),
bottomWidget
(),
],
)),
),
()
{
)),
()
{
_model
.
stateLive
.
notifyView
(
LOADING
);
_model
.
init
(()
{
_initTabBar
();
...
...
lib/ClueModel/page/plan/FilterView.dart
View file @
b1742a37
...
...
@@ -4,16 +4,50 @@
**/
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:gm_flutter/ClueModel/page/plan/PlanProgressBar.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/eventbus/SimpleEventBus.dart'
;
import
'package:gm_flutter/commonModel/util/DartUtil.dart'
;
class
FilterView
extends
State
less
Widget
{
class
FilterView
extends
State
ful
Widget
{
final
Function
(
int
high
,
int
low
)
call
;
FilterView
(
this
.
call
);
int
high
;
int
low
;
FilterView
(
this
.
call
,
{
this
.
high
,
this
.
low
});
@override
State
<
StatefulWidget
>
createState
()
=>
FilterViewState
();
}
class
FilterViewState
extends
State
<
FilterView
>
{
LiveData
<
String
>
lowLive
=
new
LiveData
();
LiveData
<
String
>
highLive
=
new
LiveData
();
Function
(
String
str
)
func
;
@override
void
initState
()
{
func
=
(
str
)
{
if
(
str
==
"reset"
)
{
highLive
.
notifyView
(
"无限"
);
lowLive
.
notifyView
(
"¥0"
);
SimpleEventBus
.
instance
().
notifyListener
(
"PlanProgressBarState"
,
""
);
}
};
SimpleEventBus
.
instance
().
resignEvent
(
"FilterViewState"
,
func
);
super
.
initState
();
}
@override
void
dispose
()
{
SimpleEventBus
.
instance
().
unResignEvent
(
"FilterViewState"
,
func
);
lowLive
.
dispost
();
highLive
.
dispost
();
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
...
...
@@ -28,11 +62,13 @@ class FilterView extends StatelessWidget {
child:
Container
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
child:
PlanProgressBar
(
0
,
19600
,
widget
.
low
,
widget
.
high
,
0
,
20010
,
call
,
widget
.
call
,
lowLive
,
highLive
,
padding:
15
,
),
),
...
...
@@ -40,12 +76,25 @@ class FilterView extends StatelessWidget {
Positioned
(
top:
54.5
,
right:
15
,
child:
baseText
(
"无限"
,
12
,
Color
(
0xff3FB5AF
)),
child:
StreamBuilder
(
stream:
highLive
.
stream
,
initialData:
highLive
.
data
??
(
widget
.
high
>=
19600
?
"无限"
:
"
${widget.high}
"
),
builder:
(
c
,
data
)
{
return
baseText
(
"
${data.data}
"
,
12
,
Color
(
0xff3FB5AF
));
},
),
),
Positioned
(
top:
54.5
,
left:
15
,
child:
baseText
(
"¥0"
,
12
,
Color
(
0xff3FB5AF
)),
child:
StreamBuilder
(
stream:
lowLive
.
stream
,
initialData:
lowLive
.
data
??
"¥
${widget.low}
"
,
builder:
(
c
,
data
)
{
return
baseText
(
"
${data.data}
"
,
12
,
Color
(
0xff3FB5AF
));
},
),
),
Positioned
(
top:
25
,
...
...
@@ -64,8 +113,7 @@ class FilterView extends StatelessWidget {
child:
baseText
(
"重置"
,
16
,
Color
(
0xff3FB5AF
)),
alignment:
Alignment
.
center
,
).
gestureDetector
(()
{
SimpleEventBus
.
instance
()
.
notifyListener
(
"PlanProgressBarState"
,
""
);
SimpleEventBus
.
instance
().
notifyListener
(
"FilterViewState"
,
"reset"
);
}),
),
Expanded
(
...
...
@@ -74,7 +122,8 @@ class FilterView extends StatelessWidget {
alignment:
Alignment
.
center
,
child:
baseText
(
"确定"
,
16
,
Colors
.
white
),
).
gestureDetector
(()
{
SimpleEventBus
.
instance
().
notifyListener
(
"PlanProgressBarState"
,
"sure"
);
SimpleEventBus
.
instance
()
.
notifyListener
(
"PlanProgressBarState"
,
"sure"
);
}),
)
],
...
...
lib/ClueModel/page/plan/PlanItem.dart
View file @
b1742a37
...
...
@@ -6,6 +6,7 @@ import 'package:cached_network_image/cached_network_image.dart';
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart'
;
import
'package:gm_flutter/ClueModel/util/NumPlanUtil.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/util/DartUtil.dart'
;
import
'package:gm_flutter/main.mark.dart'
;
...
...
@@ -97,7 +98,7 @@ class PlanItem extends StatelessWidget {
Positioned
(
bottom:
14
,
right:
10
,
child:
baseText
(
"销量
${
plans.salesCount
}
"
,
11
,
Color
(
0xff282828
)),
child:
baseText
(
"销量
${
NumPlanUtil.getSale(plans.salesCount)
}
"
,
11
,
Color
(
0xff282828
)),
),
Positioned
(
left:
91
,
...
...
lib/ClueModel/page/plan/PlanModel.dart
View file @
b1742a37
...
...
@@ -22,46 +22,58 @@ import 'package:gm_flutter/commonModel/util/PrintUtil.dart';
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
class
PlanModel
extends
BaseModel
{
final
String
PLAN_MODEL_BUFFER
=
"PLAN_MODEL_BUFFER"
;
final
String
PLAN_MODEL_LIST_BUFFER
=
"PLAN_MODEL_LIST_BUFFER"
;
LiveData
<
List
>
managerLive
=
new
LiveData
();
LiveData
<
List
<
double
>>
posLive
=
new
LiveData
();
LiveData
<
List
<
double
>>
backLive
=
new
LiveData
();
LiveData
<
List
<
Ranks
>>
picLive
=
LiveData
();
LiveData
<
bool
>
showTab
=
LiveData
();
LiveData
<
int
>
stateLive
=
LiveData
();
LiveData
<
Pair
<
int
,
List
<
Plans
>>>
feedsLive
=
LiveData
();
RxDispose
rxDispose
=
RxDispose
();
double
menuBottom
;
int
menuIndex
=
-
1
;
bool
needChangBack
=
true
;
LiveData
<
Pair
<
int
,
List
<
Plans
>>>
feedsLive
=
LiveData
()
;
List
<
Plans
>
feedDatas
=
[]
;
String
current_city_id
=
""
;
String
rank_type
=
""
;
List
<
Plans
>
feedDatas
=
[];
List
<
Tags
>
projectData
=
[];
List
<
Orders
>
sortList
=
[];
RxDispose
rxDispose
=
RxDispose
()
;
List
<
String
>
normalData
=
[
"全部项目"
,
"智能筛选"
,
"筛选"
]
;
String
tag_id
=
"0"
;
String
order_by
=
""
;
String
current_city_id
=
""
;
String
min_price
=
"0"
;
String
max_price
=
"100000000"
;
String
rank_type
=
""
;
List
<
String
>
normalData
=
[
"全部项目"
,
"智能筛选"
,
"筛选"
];
int
low
=
0
;
int
high
=
20100
;
int
projectSelectIndex
=
0
;
PlanBean
planBean
;
int
page
=
1
;
int
sortPos
=
0
;
void
init
({
VoidCallback
call
,
bool
needCache
=
false
})
{
if
(
PlanModelInstance
.
getInstance
().
planBean
!=
null
&&
needCache
)
{
var
event
=
PlanModelInstance
.
getInstance
().
planBean
;
projectData
=
event
.
data
.
tags
;
sortList
=
event
.
data
.
orders
;
picLive
.
notifyView
(
event
.
data
.
ranks
);
planBean
=
PlanModelInstance
.
getInstance
().
planBean
;
projectData
=
planBean
.
data
.
tags
;
sortList
=
planBean
.
data
.
orders
;
picLive
.
notifyView
(
planBean
.
data
.
ranks
);
low
=
PlanModelInstance
.
getInstance
().
low
;
high
=
PlanModelInstance
.
getInstance
().
high
;
print
(
"QWEEW
${low}
${high}
"
);
projectSelectIndex
=
PlanModelInstance
.
getInstance
().
projectSelectIndex
;
stateLive
.
notifyView
(
ENDLOADING
);
normalData
[
1
]
=
event
.
data
.
orders
[
0
].
name
;
normalData
.
clear
();
normalData
.
addAll
(
PlanModelInstance
.
getInstance
().
normalData
);
managerLive
.
notifyView
(
normalData
);
tag_id
=
PlanModelInstance
.
getInstance
().
tag_id
;
order_by
=
PlanModelInstance
.
getInstance
().
order_by
;
min_price
=
PlanModelInstance
.
getInstance
().
min_price
;
max_price
=
PlanModelInstance
.
getInstance
().
max_price
;
sortPos
=
PlanModelInstance
.
getInstance
().
sortPos
;
if
(
call
!=
null
)
{
call
();
}
...
...
@@ -73,12 +85,28 @@ class PlanModel extends BaseModel {
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
projectData
=
event
.
data
.
tags
;
if
(
event
.
data
.
tags
!=
null
&&
event
.
data
.
tags
.
length
>
0
&&
event
.
data
.
tags
[
0
].
subtags
!=
null
&&
event
.
data
.
tags
[
0
].
subtags
.
length
>
0
)
{
tag_id
=
"
${event.data.tags[0].subtags[0].tagId}
"
;
normalData
[
0
]
=
"
${event.data.tags[0].subtags[0].name}
"
;
}
sortList
=
event
.
data
.
orders
;
order_by
=
"
${sortList[0].id}
"
;
min_price
=
"0"
;
max_price
=
"100000000"
;
low
=
0
;
projectSelectIndex
=
0
;
high
=
20100
;
sortPos
=
0
;
picLive
.
notifyView
(
event
.
data
.
ranks
);
stateLive
.
notifyView
(
ENDLOADING
);
normalData
[
1
]
=
event
.
data
.
orders
[
0
].
name
;
managerLive
.
notifyView
(
normalData
);
if
(
call
!=
null
)
{
SimpleEventBus
.
instance
().
notifyListener
(
"FilterViewState"
,
"reset"
);
SimpleEventBus
.
instance
().
notifyListener
(
"ProjectViewState"
,
"reset"
);
call
();
}
refreshFeed
(
true
,
needCache:
needCache
);
...
...
@@ -96,10 +124,11 @@ class PlanModel extends BaseModel {
});
}
void
projectClick
(
String
id
,
String
name
)
{
void
projectClick
(
String
id
,
String
name
,
int
index
)
{
if
(
tag_id
==
id
)
{
return
;
}
projectSelectIndex
=
index
;
normalData
[
0
]
=
name
;
managerLive
.
notifyView
(
normalData
);
tag_id
=
id
;
...
...
@@ -109,22 +138,25 @@ class PlanModel extends BaseModel {
void
refreshFeed
(
bool
clear
,
{
RefreshController
controller
,
bool
needCache
=
false
})
{
if
(
clear
)
{
page
=
1
;
feedDatas
.
clear
();
}
if
(
needCache
&&
PlanModelInstance
.
getInstance
().
feedDatas
!=
null
&&
PlanModelInstance
.
getInstance
().
feedDatas
.
isNotEmpty
)
{
if
(
needCache
&&
PlanModelInstance
.
getInstance
().
feedDatas
!=
null
)
{
page
=
PlanModelInstance
.
getInstance
().
page
;
feedDatas
.
clear
();
feedDatas
.
addAll
(
PlanModelInstance
.
getInstance
().
feedDatas
);
if
(
feedDatas
.
isEmpty
)
{
feedsLive
.
notifyView
(
Pair
(
EMPTY
,
null
));
}
else
{
feedsLive
.
notifyView
(
Pair
(
ENDLOADING
,
feedDatas
));
WidgetsBinding
.
instance
.
addPostFrameCallback
((
_
)
{
SimpleEventBus
.
instance
()
.
notifyListener
(
"BaseNestedScrollViewRefreshIndicator"
,
"refresh"
);
});
}
// WidgetsBinding.instance.addPostFrameCallback((_) {
// SimpleEventBus.instance()
// .notifyListener("BaseNestedScrollViewRefreshIndicator", "refresh");
// });
return
;
}
if
(
clear
)
{
page
=
1
;
feedDatas
.
clear
();
}
ClueApiImpl
.
getInstance
()
.
getPlanFeed
(
DioUtil
.
getInstance
().
getDio
(),
tag_id
,
order_by
,
current_city_id
,
min_price
,
max_price
,
rank_type
,
page
)
...
...
@@ -138,11 +170,14 @@ class PlanModel extends BaseModel {
}
}
else
{
feedDatas
.
addAll
(
event
.
data
.
plans
);
PlanModelInstance
.
getInstance
().
feedDatas
.
clear
();
PlanModelInstance
.
getInstance
().
feedDatas
.
addAll
(
feedDatas
);
feedsLive
.
notifyView
(
Pair
(
ENDLOADING
,
feedDatas
));
}
controller
?.
refreshCompleted
();
if
(
PlanModelInstance
.
getInstance
().
feedDatas
==
null
)
{
PlanModelInstance
.
getInstance
().
feedDatas
=
[];
}
PlanModelInstance
.
getInstance
().
feedDatas
.
clear
();
PlanModelInstance
.
getInstance
().
feedDatas
.
addAll
(
feedDatas
);
}
else
{
NativeToast
.
showNativeToast
(
event
.
message
);
feedsLive
.
notifyView
(
Pair
(
FAIL
,
null
));
...
...
@@ -160,6 +195,16 @@ class PlanModel extends BaseModel {
@override
void
dispose
()
{
PlanModelInstance
.
getInstance
().
normalData
.
clear
();
PlanModelInstance
.
getInstance
().
normalData
.
addAll
(
normalData
);
PlanModelInstance
.
getInstance
().
tag_id
=
tag_id
;
PlanModelInstance
.
getInstance
().
projectSelectIndex
=
projectSelectIndex
;
PlanModelInstance
.
getInstance
().
order_by
=
order_by
;
PlanModelInstance
.
getInstance
().
min_price
=
min_price
;
PlanModelInstance
.
getInstance
().
max_price
=
max_price
;
PlanModelInstance
.
getInstance
().
sortPos
=
sortPos
;
PlanModelInstance
.
getInstance
().
low
=
low
;
PlanModelInstance
.
getInstance
().
high
=
high
;
stateLive
.
dispost
();
picLive
.
dispost
();
rxDispose
.
dispose
();
...
...
@@ -197,6 +242,8 @@ class PlanModel extends BaseModel {
if
(
max_price
==
"
${max}
"
&&
min_price
==
"
${min}
"
)
{
return
;
}
low
=
min
;
high
=
max
>
20000
?
20000
:
max
;
if
(
max
>
20000
)
{
max
=
20000000
;
}
...
...
lib/ClueModel/page/plan/PlanModelInstance.dart
View file @
b1742a37
...
...
@@ -17,9 +17,24 @@ class PlanModelInstance {
return
_instance
;
}
List
<
Plans
>
feedDatas
;
List
<
Tags
>
projectData
=
[];
List
<
Orders
>
sortList
=
[];
List
<
String
>
normalData
=
[
"全部项目"
,
"智能筛选"
,
"筛选"
];
PlanBean
planBean
;
List
<
Plans
>
feedDatas
=
[];
List
<
Ranks
>
ranks
=
[];
String
tag_id
=
"0"
;
String
order_by
=
""
;
String
current_city_id
=
""
;
String
min_price
=
"0"
;
String
max_price
=
"100000000"
;
String
rank_type
=
""
;
int
low
=
0
;
int
high
=
19600
;
int
projectSelectIndex
=
0
;
int
page
=
1
;
int
sortPos
=
0
;
PlanBean
planBean
;
}
lib/ClueModel/page/plan/PlanPage.dart
View file @
b1742a37
...
...
@@ -19,6 +19,7 @@ import 'package:gm_flutter/ClueModel/page/plan/PlanItem.dart';
import
'package:gm_flutter/ClueModel/page/plan/SortView.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart'
;
import
'package:gm_flutter/ClueModel/util/NumPlanUtil.dart'
;
import
'package:gm_flutter/ClueModel/util/PosUtil.dart'
;
import
'package:gm_flutter/commonModel/App.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
...
...
@@ -62,7 +63,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
@override
void
initState
()
{
print
(
"LSY PLAN INIT"
);
print
(
"LSY PLAN INIT
"
);
// DioUtil.getInstance().setProxy("172.30.9.128");
_model
.
init
(
needCache:
true
);
super
.
initState
();
...
...
@@ -182,9 +183,9 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
width:
MediaQuery
.
of
(
context
).
size
.
width
,
maxHeight:
450
,
listener:
projectMenuListener
,
child:
ProjectView
(
_model
.
project
Data
,
(
id
,
name
)
{
child:
ProjectView
(
_model
.
project
SelectIndex
,
_model
.
projectData
,
(
id
,
name
,
index
)
{
clickIndexOther
(
0
);
_model
.
projectClick
(
id
,
name
);
_model
.
projectClick
(
id
,
name
,
index
);
}),
proListener:
(
pro
)
{
_model
.
backProgress
(
pro
,
0
);
...
...
@@ -221,10 +222,14 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
width:
MediaQuery
.
of
(
context
).
size
.
width
,
maxHeight:
186
,
listener:
filterMenuListener
,
child:
FilterView
((
max
,
min
)
{
child:
FilterView
(
(
max
,
min
)
{
clickIndexOther
(
2
);
_model
.
filterClick
(
max
,
min
);
}),
},
low:
_model
.
low
,
high:
_model
.
high
,
),
proListener:
(
pro
)
{
_model
.
backProgress
(
pro
,
2
);
},
...
...
@@ -243,7 +248,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
);
},
),
// baseSliverBack((){
// baseSliverBack(()
{
// Navigator.pop(context);
// })
],
...
...
lib/ClueModel/page/plan/PlanProgressBar.dart
View file @
b1742a37
...
...
@@ -4,6 +4,7 @@
**/
import
'package:flutter/cupertino.dart'
;
import
'package:flutter/material.dart'
;
import
'package:flutter_common/commonModel/live/LiveData.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/eventbus/SimpleEventBus.dart'
;
...
...
@@ -13,9 +14,14 @@ class PlanProgressBar extends StatefulWidget {
int
maxlow
;
int
maxHigh
;
int
padding
;
LiveData
<
String
>
lowLive
;
LiveData
<
String
>
highLive
;
final
Function
(
int
high
,
int
low
)
call
;
PlanProgressBar
(
this
.
low
,
this
.
high
,
this
.
maxlow
,
this
.
maxHigh
,
this
.
call
,
this
.
lowLive
,
this
.
highLive
,
{
this
.
padding
});
@override
...
...
@@ -52,6 +58,8 @@ class PlanProgressBarState extends State<PlanProgressBar> {
if
(
str
==
"sure"
)
{
widget
.
call
(
high
,
low
);
}
else
{
widget
.
low
=
0
;
widget
.
high
=
20100
;
init
();
setState
(()
{});
}
...
...
@@ -63,7 +71,8 @@ class PlanProgressBarState extends State<PlanProgressBar> {
leftStarPosPercent
=
(
widget
.
low
/
distance
);
leftPosTempPercent
=
leftStarPosPercent
;
rightStarPosPercent
=
(
widget
.
high
/
distance
);
rightStarPosPercent
=
(
widget
.
high
/
distance
)
>
0.03
?
(
widget
.
high
/
distance
)
-
0.03
:
0.0
;
rightPosTempPercent
=
rightStarPosPercent
;
}
...
...
@@ -76,7 +85,7 @@ class PlanProgressBarState extends State<PlanProgressBar> {
@override
Widget
build
(
BuildContext
context
)
{
double
totle
=
MediaQuery
.
of
(
context
).
size
.
width
-
widget
.
padding
*
2
;
scrollDistance
=
0.0
5
;
scrollDistance
=
0.0
3
;
int
textInt
=
(
widget
.
maxlow
+
(
isLeftMove
?
leftPosTempPercent
:
rightPosTempPercent
+
0.03
)
*
distance
)
...
...
@@ -91,6 +100,11 @@ class PlanProgressBarState extends State<PlanProgressBar> {
if
(
textInt
>
20000
)
{
textStr
=
"无限"
;
}
if
(
isLeftMove
)
{
widget
.
lowLive
.
notifyView
(
textStr
);
}
else
{
widget
.
highLive
.
notifyView
(
textStr
);
}
double
textWidth
=
textStr
.
length
*
12.0
;
if
(
textStr
==
"无限"
)
{
...
...
lib/ClueModel/page/plan/ProjectView.dart
View file @
b1742a37
...
...
@@ -7,21 +7,45 @@ import 'package:flutter/material.dart';
import
'package:gm_flutter/ClueModel/server/entity/PlanBean.dart'
;
import
'package:gm_flutter/commonModel/base/BaseComponent.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/eventbus/SimpleEventBus.dart'
;
import
'package:gm_flutter/commonModel/util/DartUtil.dart'
;
class
ProjectView
extends
StatefulWidget
{
final
List
<
Tags
>
datas
;
final
Function
(
String
id
,
String
name
)
clickCall
;
final
Function
(
String
id
,
String
name
,
int
first
)
clickCall
;
int
selectIndex
=
0
;
ProjectView
(
this
.
datas
,
this
.
clickCall
);
ProjectView
(
this
.
selectIndex
,
this
.
datas
,
this
.
clickCall
);
@override
State
<
StatefulWidget
>
createState
()
=>
ProjectViewState
();
State
<
StatefulWidget
>
createState
()
=>
ProjectViewState
(
selectIndex
);
}
class
ProjectViewState
extends
State
<
ProjectView
>
{
int
selectIndex
=
0
;
ProjectViewState
(
this
.
selectIndex
);
Function
(
String
str
)
func
;
@override
void
initState
()
{
func
=
(
str
)
{
if
(
str
==
"reset"
)
{
selectIndex
=
0
;
setState
(()
{});
}
};
SimpleEventBus
.
instance
().
resignEvent
(
"ProjectViewState"
,
func
);
super
.
initState
();
}
@override
void
dispose
()
{
SimpleEventBus
.
instance
().
unResignEvent
(
"ProjectViewState"
,
func
);
super
.
dispose
();
}
@override
Widget
build
(
BuildContext
context
)
{
if
(
widget
.
datas
==
null
||
widget
.
datas
.
isEmpty
)
{
...
...
@@ -82,8 +106,10 @@ class ProjectViewState extends State<ProjectView> {
child:
baseText
(
widget
.
datas
[
selectIndex
].
subtags
[
index
].
name
,
14
,
Color
(
0xff464646
)),
).
gestureDetector
(()
{
widget
.
clickCall
(
"
${widget.datas[selectIndex].subtags[index].tagId}
"
,
"
${widget.datas[selectIndex].subtags[index].name}
"
);
widget
.
clickCall
(
"
${widget.datas[selectIndex].subtags[index].tagId}
"
,
"
${widget.datas[selectIndex].subtags[index].name}
"
,
selectIndex
);
});
},
itemCount:
widget
.
datas
[
selectIndex
].
subtags
.
length
,
...
...
lib/ClueModel/server/entity/PlanCompareDetail.dart
View file @
b1742a37
...
...
@@ -54,15 +54,15 @@ class UserType {
}
class
Data
{
List
<
PlansInfo
>
plansInfo
;
List
<
PlansInfo
Detail
>
plansInfo
;
List
<
Groups
>
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
));
});
plansInfo
=
new
List
<
PlansInfo
Detail
>();
json
[
'plans_info'
].
forEach
((
v
)
{
plansInfo
.
add
(
new
PlansInfo
Detail
.
fromJson
(
v
));
});
}
if
(
json
[
'groups'
]
!=
null
)
{
groups
=
new
List
<
Groups
>();
...
...
@@ -82,15 +82,15 @@ class Data {
}
}
class
PlansInfo
{
class
PlansInfo
Detail
{
int
planId
;
String
planName
;
String
minPrice
;
String
maxPrice
;
PlansInfo
({
this
.
planId
,
this
.
planName
,
this
.
minPrice
,
this
.
maxPrice
});
PlansInfo
Detail
({
this
.
planId
,
this
.
planName
,
this
.
minPrice
,
this
.
maxPrice
});
PlansInfo
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
PlansInfo
Detail
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
planId
=
json
[
'plan_id'
];
planName
=
json
[
'plan_name'
];
minPrice
=
json
[
'min_price'
];
...
...
lib/ClueModel/server/entity/PlanOverviewBean.dart
View file @
b1742a37
...
...
@@ -5,8 +5,8 @@
class
PlanOverViewBean
{
int
error
;
String
message
;
Null
extra
;
Null
errorExtra
;
Map
extra
;
Map
errorExtra
;
UserType
userType
;
PlanOverData
data
;
...
...
lib/ClueModel/util/NumPlanUtil.dart
0 → 100644
View file @
b1742a37
/*
* @author lsy
* @date 2020/7/10
**/
import
'package:common_utils/common_utils.dart'
;
class
NumPlanUtil
{
static
String
getSale
(
String
sale
)
{
int
count
=
0
;
try
{
count
=
int
.
parse
(
sale
);
}
catch
(
e
)
{
print
(
e
.
toString
());
}
if
(
count
<
1000
)
{
return
"
${count}
"
;
}
else
if
(
count
<
10000
)
{
return
"
${formatNum(count / 1000.0, 1)}
k"
;
}
else
{
return
"
${formatNum(count / 10000.0, 1)}
w"
;
}
}
static
formatNum
(
double
num
,
int
postion
)
{
return
(
NumUtil
.
getNumByValueDouble
(
num
,
postion
)).
toStringAsFixed
(
postion
);
}
}
pubspec.lock
View file @
b1742a37
...
...
@@ -155,6 +155,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.14.12"
common_utils:
dependency: "direct main"
description:
name: common_utils
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.2.1"
convert:
dependency: transitive
description:
...
...
@@ -190,6 +197,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.3.6"
decimal:
dependency: transitive
description:
name: decimal
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.5"
dio:
dependency: "direct main"
description:
...
...
@@ -573,6 +587,13 @@ packages:
url: "https://pub.flutter-io.cn"
source: hosted
version: "2.1.3"
rational:
dependency: transitive
description:
name: rational
url: "https://pub.flutter-io.cn"
source: hosted
version: "0.3.8"
rxdart:
dependency: "direct main"
description:
...
...
pubspec.yaml
View file @
b1742a37
...
...
@@ -36,6 +36,7 @@ dependencies:
extended_nested_scroll_view
:
^1.0.0
#适配库
flutter_screenutil
:
^1.1.0
common_utils
:
^1.2.1
dev_dependencies
:
...
...
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