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
5e14cb97
Commit
5e14cb97
authored
Jul 14, 2020
by
杜欣
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'test' into featrue/duxin
parents
8f69ec76
27565f23
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
230 additions
and
128 deletions
+230
-128
DiscussLowPriceModel.dart
lib/ClueModel/page/DiscussLowPrice/DiscussLowPriceModel.dart
+1
-1
DiscussLowPricePopView.dart
...lueModel/page/DiscussLowPrice/DiscussLowPricePopView.dart
+5
-4
PlanCompareDetailPage.dart
...ueModel/page/PlanCompareDetail/PlanCompareDetailPage.dart
+36
-25
LevelOneItem.dart
lib/ClueModel/page/levelOne/LevelOneItem.dart
+8
-5
LevelOnePage.dart
lib/ClueModel/page/levelOne/LevelOnePage.dart
+2
-2
PlanModel.dart
lib/ClueModel/page/plan/PlanModel.dart
+1
-1
PlanPage.dart
lib/ClueModel/page/plan/PlanPage.dart
+8
-6
TopList.dart
lib/ClueModel/page/top/TopList.dart
+3
-1
ClueApi.serv.dart
lib/ClueModel/server/api/ClueApi.serv.dart
+7
-7
ClueTApi.serv.dart
lib/ClueModel/server/api/ClueTApi.serv.dart
+8
-13
MainManager.dart
lib/MainRouter/manager/MainManager.dart
+12
-11
NetProxyPage.dart
lib/MainRouter/page/proxy/NetProxyPage.dart
+6
-5
MainApi.dart
lib/MainRouter/service/remote/api/MainApi.dart
+5
-0
MainApi.serv.dart
lib/MainRouter/service/remote/api/MainApi.serv.dart
+18
-0
CityBean.dart
lib/MainRouter/service/remote/entity/CityBean.dart
+66
-0
App.dart
lib/commonModel/App.dart
+24
-23
BaseComponent.dart
lib/commonModel/base/BaseComponent.dart
+5
-5
BaseUtil.dart
lib/commonModel/base/BaseUtil.dart
+0
-6
ShareCache.dart
lib/commonModel/cache/ShareCache.dart
+7
-6
Api.dart
lib/commonModel/net/Api.dart
+3
-1
DioUtil.dart
lib/commonModel/net/DioUtil.dart
+0
-4
main.dart
lib/main.dart
+5
-2
No files found.
lib/ClueModel/page/DiscussLowPrice/DiscussLowPriceModel.dart
View file @
5e14cb97
...
...
@@ -51,7 +51,7 @@ class DiscussLowPriceModel extends BaseModel {
.
givePhoneAuth
(
DioUtil
.
getInstance
().
getDio
(),
leadPhoneRequestId
)
.
listen
((
event
)
{
if
(
event
.
error
==
0
)
{
NativeToast
.
showNativeToast
(
"
提交成功,请留意机构来电~
"
);
NativeToast
.
showNativeToast
(
"
私信成功,机构将尽快回复
"
);
}
else
{
NativeToast
.
showNativeToast
(
event
.
message
);
}
...
...
lib/ClueModel/page/DiscussLowPrice/DiscussLowPricePopView.dart
View file @
5e14cb97
...
...
@@ -53,7 +53,7 @@ class _PopView implements ICenterPicker {
width:
contentWidth
,
height:
_model
.
popViewLive
.
data
.
second
.
title
.
length
>
13
?
377.5
:
3
25
.5
,
:
3
30
.5
,
child:
Stack
(
alignment:
AlignmentDirectional
.
topCenter
,
children:
<
Widget
>[
...
...
@@ -146,7 +146,7 @@ class _PopView implements ICenterPicker {
Container
(
width:
contentWidth
,
alignment:
Alignment
.
center
,
margin:
EdgeInsets
.
only
(
bottom:
25
),
margin:
EdgeInsets
.
only
(
bottom:
25
,
left:
30
,
right:
30
),
child:
baseText
(
"
${_model.popViewLive.data.second.title}
"
,
18
,
Color
(
0xff464646
),
bold:
true
,
textAlign:
TextAlign
.
center
,
maxLines:
2
)),
...
...
@@ -169,7 +169,7 @@ class _PopView implements ICenterPicker {
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
7
),
color:
Color
(
0xff20BDBB
)),
child:
Text
(
"一键授权"
,
child:
Text
(
"一键授权
(加密)
"
,
textAlign:
TextAlign
.
start
,
textScaleFactor:
1.0
,
style:
TextStyle
(
...
...
@@ -191,7 +191,8 @@ class _PopView implements ICenterPicker {
}),
Container
(
margin:
EdgeInsets
.
only
(
bottom:
23.5
),
child:
baseText
(
'授权后,您的手机将以“虚拟号”方式提供给机构'
,
11
,
Color
(
0xff999999
))),
child:
baseText
(
'更美为您提供号码保护,对方看不到您的真实手机号'
,
11
,
Color
(
0xff999999
))),
]);
}
...
...
lib/ClueModel/page/PlanCompareDetail/PlanCompareDetailPage.dart
View file @
5e14cb97
...
...
@@ -52,19 +52,18 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
Widget
buildItem
(
BuildContext
context
)
{
screenWidth
=
MediaQuery
.
of
(
context
).
size
.
width
;
return
Scaffold
(
appBar:
baseAppBar
(
titleWidget:
baseText
(
"对比详情"
,
18
,
Color
(
0xff333333
),
bold:
true
),
centerTitle:
true
,
backClick:
()
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
FlutterBoost
.
singleton
.
closeCurrent
();
}
else
{
Navigator
.
of
(
context
).
pop
();
}
}),
body:
Container
(
child:
reloadPage
(),
));
appBar:
baseAppBar
(
titleWidget:
baseText
(
"对比详情"
,
18
,
Color
(
0xff333333
),
bold:
true
),
centerTitle:
true
,
backClick:
()
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
FlutterBoost
.
singleton
.
closeCurrent
();
}
else
{
Navigator
.
of
(
context
).
pop
();
}
}),
body:
reloadPage
(),
);
}
Widget
reloadPage
()
{
...
...
@@ -82,17 +81,26 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
if
(
data
.
data
==
LOADING
)
{
return
loadingItem
();
}
return
setupHome
();
return
Stack
(
children:
<
Widget
>[
setupHome
(),
head
(),
],
);
},
);
}
Widget
setupHome
()
{
return
Column
(
return
Container
(
child:
Column
(
children:
<
Widget
>[
head
(),
Container
(
height:
93
,
),
Expanded
(
child:
Container
(
color:
Color
(
0xffF7F6FA
),
child:
StreamBuilder
<
Pair
<
int
,
List
<
Groups
>>>(
stream:
_model
.
detailLive
.
stream
,
initialData:
_model
.
detailLive
.
data
??
Pair
(
LOADING
,
null
),
...
...
@@ -128,8 +136,11 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
widget
=
planNormalEffectiveAttrsView
(
group
);
}
return
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
),
child:
widget
,
color:
Colors
.
white
,
child:
Container
(
margin:
EdgeInsets
.
only
(
left:
15
,
right:
15
),
child:
widget
,
),
);
},
itemCount:
data
.
data
.
second
.
length
*
2
,
...
...
@@ -137,7 +148,7 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
}),
))
],
);
)
)
;
}
Widget
head
()
{
...
...
@@ -253,14 +264,14 @@ class PlanCompareDetailPageState extends BaseState<PlanCompareDetailPage> {
}
Widget
planPopularityView
(
Groups
groups
)
{
return
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
return
Container
(
child:
Column
(
mainAxisSize:
MainAxisSize
.
min
,
mainAxisAlignment:
MainAxisAlignment
.
center
,
children:
<
Widget
>[
titleView
(
groups
.
groupName
),
planPopularityBodyView
(
groups
),
Container
()
]);
]));
}
Widget
planPopularityBodyView
(
Groups
groups
)
{
...
...
lib/ClueModel/page/levelOne/LevelOneItem.dart
View file @
5e14cb97
...
...
@@ -14,6 +14,8 @@ import 'package:gm_flutter/commonModel/util/DartUtil.dart';
import
'package:gm_flutter/commonModel/util/NumberUtil.dart'
;
import
'package:gm_flutter/main.mark.dart'
;
import
'../../../main.dart'
;
class
LevelOneItem
extends
StatelessWidget
{
final
Cards
cards
;
VoidCallback
lowPrice
;
...
...
@@ -66,7 +68,7 @@ class LevelOneItem extends StatelessWidget {
}
Widget
DoctorItem
(
BuildContext
context
)
{
if
(
cards
.
doctor
==
null
&&
isDebug
)
{
if
(
cards
.
doctor
==
null
&&
!
inProduction
)
{
throw
new
Exception
();
}
var
price
=
...
...
@@ -194,7 +196,7 @@ class LevelOneItem extends StatelessWidget {
}
Widget
HospitalItem
(
BuildContext
context
)
{
if
(
cards
.
hospital
==
null
&&
isDebug
)
{
if
(
cards
.
hospital
==
null
&&
!
inProduction
)
{
throw
new
Exception
();
}
var
price
=
...
...
@@ -330,7 +332,7 @@ class LevelOneItem extends StatelessWidget {
}
Widget
PlanItem
(
BuildContext
context
)
{
if
(
cards
.
plan
==
null
&&
isDebug
)
{
if
(
cards
.
plan
==
null
&&
!
inProduction
)
{
throw
new
Exception
();
}
String
price
=
...
...
@@ -477,7 +479,7 @@ class LevelOneItem extends StatelessWidget {
}
Widget
DiaryItem
(
BuildContext
context
)
{
if
(
cards
.
diary
==
null
&&
isDebug
)
{
if
(
cards
.
diary
==
null
&&
!
inProduction
)
{
throw
new
Exception
();
}
return
Container
(
...
...
@@ -565,6 +567,7 @@ class LevelOneItem extends StatelessWidget {
Expanded
(
child:
Container
(
decoration:
BoxDecoration
(
borderRadius:
BorderRadius
.
circular
(
4
),
image:
DecorationImage
(
fit:
BoxFit
.
cover
,
image:
NetworkImage
(
...
...
@@ -594,7 +597,7 @@ class LevelOneItem extends StatelessWidget {
cards
.
diary
.
content
,
textScaleFactor:
1.0
,
maxLines:
5
,
strutStyle:
StrutStyle
(
forceStrutHeight:
true
,
height:
2
),
strutStyle:
StrutStyle
(
forceStrutHeight:
true
,
height:
1.6
),
overflow:
TextOverflow
.
ellipsis
,
style:
TextStyle
(
decoration:
TextDecoration
.
none
,
...
...
lib/ClueModel/page/levelOne/LevelOnePage.dart
View file @
5e14cb97
...
...
@@ -221,7 +221,7 @@ class LevelOneState extends BaseState<LevelOnePage>
handle:
extend
.
NestedScrollView
.
sliverOverlapAbsorberHandleFor
(
context
),
sliver:
baseSliverAppBar
(
_model
.
imageUrl
,
height:
ScreenUtil
().
setHeight
(
200
)
)),
height:
200
)),
SliverList
(
delegate:
SliverChildBuilderDelegate
((
BuildContext
c
,
int
i
)
{
if
(
i
==
0
)
{
...
...
@@ -283,7 +283,7 @@ class LevelOneState extends BaseState<LevelOnePage>
return
Container
(
width:
MediaQuery
.
of
(
context
).
size
.
width
,
height:
54
,
margin:
EdgeInsets
.
only
(
top:
1
9
,
bottom:
12
),
margin:
EdgeInsets
.
only
(
top:
1
0
,
bottom:
12
),
child:
Stack
(
children:
<
Widget
>[
Positioned
(
...
...
lib/ClueModel/page/plan/PlanModel.dart
View file @
5e14cb97
...
...
@@ -12,6 +12,7 @@ import 'package:gm_flutter/ClueModel/page/plan/PlanModelInstance.dart';
import
'package:gm_flutter/ClueModel/server/api/ClueApi.serv.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanBean.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart'
;
import
'package:gm_flutter/commonModel/App.dart'
;
import
'package:gm_flutter/commonModel/GMBase.dart'
;
import
'package:gm_flutter/commonModel/bean/Pair.dart'
;
import
'package:gm_flutter/commonModel/cache/CacheManager.dart'
;
...
...
@@ -130,7 +131,6 @@ class PlanModel extends BaseModel {
})
.
addToDispose
(
rxDispose
)
.
onError
((
err
)
{
print
(
"ERROR12WCCCCCC
${err.toString()}
"
);
PrintUtil
.
printBug
(
err
);
stateLive
.
notifyView
(
FAIL
);
});
...
...
lib/ClueModel/page/plan/PlanPage.dart
View file @
5e14cb97
...
...
@@ -36,6 +36,7 @@ import 'package:gm_flutter/commonModel/view/baseRefreshIndicator.dart';
import
'package:gm_flutter/main.mark.dart'
;
import
'package:pull_to_refresh/pull_to_refresh.dart'
;
import
'../../../main.dart'
;
import
'PlanModel.dart'
;
import
'ProjectView.dart'
;
...
...
@@ -64,7 +65,9 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
@override
void
initState
()
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
()
&&
super
.
initState
();
if
(
inProduction
&&
Platform
.
isIOS
&&
CacheManager
.
getInstance
().
get
(
MEMORY_CACHE
).
get
(
BASE_URL
)
==
null
)
{
func
=
(
str
)
{
if
(
str
==
"init"
)
{
...
...
@@ -72,10 +75,8 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
}
};
SimpleEventBus
.
instance
().
resignEvent
(
"clueModel|Plan|PlanPage"
,
func
);
}
else
{
_model
.
init
(
needCache:
true
);
}
super
.
initState
(
);
_model
.
init
(
needCache:
true
);
planBarView
=
PlanBarView
(
_model
.
managerLive
,
clickIndex
,
hideAllMenuListener
);
}
...
...
@@ -347,8 +348,9 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
handle:
NestedScrollView
.
sliverOverlapAbsorberHandleFor
(
context
),
sliver:
baseSliverAppBar
(
null
,
height:
kToolbarHeight
+
stateBarHeight
-
39
,
needpic:
false
)),
height:
0
,
needpic:
false
,
paddingTop:
-(
kToolbarHeight
-
stateBarHeight
))),
SliverList
(
delegate:
SliverChildBuilderDelegate
((
BuildContext
c
,
int
i
)
{
if
(
i
==
0
)
{
...
...
lib/ClueModel/page/top/TopList.dart
View file @
5e14cb97
...
...
@@ -2,6 +2,8 @@
* @author lsy
* @date 2020/7/2
**/
import
'dart:io'
;
import
'package:flutter/material.dart'
;
import
'package:gm_flutter/ClueModel/page/plan/PlanItem.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanFeedBean.dart'
;
...
...
@@ -68,7 +70,7 @@ class TopListState extends State<TopList> with AutomaticKeepAliveClientMixin {
slivers:
<
Widget
>[
SliverToBoxAdapter
(
child:
Container
(
height:
widget
.
topHeight
,
height:
widget
.
topHeight
-
12
,
),
),
// extend.SliverOverlapInjector(
...
...
lib/ClueModel/server/api/ClueApi.serv.dart
View file @
5e14cb97
...
...
@@ -326,13 +326,13 @@ class ClueApiImpl {
}
void
_printHttpLog
(
Response
response
)
{
if
(!
inProduction
)
{
try
{
printRespond
(
response
);
}
catch
(
ex
)
{
print
(
"Http Log"
+
" error......"
);
}
}
//
if (!inProduction) {
//
try {
//
printRespond(response);
//
} catch (ex) {
//
print("Http Log" + " error......");
//
}
//
}
}
static
void
printRespond
(
Response
response
)
{
...
...
lib/ClueModel/server/api/ClueTApi.serv.dart
View file @
5e14cb97
...
...
@@ -6,15 +6,10 @@
import
'dart:convert'
;
import
'dart:io'
;
import
'package:rxdart/rxdart.dart'
;
import
'package:dio/dio.dart'
;
import
'package:flutter/foundation.dart'
;
import
'package:gm_flutter/ClueModel/server/entity/PlanOverViewBean.dart'
;
import
'package:rxdart/rxdart.dart'
;
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
...
...
@@ -130,13 +125,13 @@ class ClueTApiImpl {
}
void
_printHttpLog
(
Response
response
)
{
if
(!
inProduction
)
{
try
{
printRespond
(
response
);
}
catch
(
ex
)
{
print
(
"Http Log"
+
" error......"
);
}
}
//
if (!inProduction) {
//
try {
//
printRespond(response);
//
} catch (ex) {
//
print("Http Log" + " error......");
//
}
//
}
}
static
void
printRespond
(
Response
response
)
{
...
...
lib/MainRouter/manager/MainManager.dart
View file @
5e14cb97
...
...
@@ -16,6 +16,7 @@ import 'package:gm_flutter/commonModel/eventbus/SimpleEventBus.dart';
import
'package:gm_flutter/commonModel/util/DartUtil.dart'
;
import
'../../commonModel/App.dart'
;
import
'../../main.dart'
;
class
MainManager
{
MethodChannel
flutterChannel
;
...
...
@@ -74,20 +75,20 @@ class MainManager {
innerSetData
(
map
,
USER_AGENT
);
innerSetData
(
map
,
BASE_URL
);
if
(
map
[
BASE_URL
]
!=
null
)
{
DioUtil
.
getInstance
();
DioUtil
.
setDefOptions
(
baseUrl:
"
${map[BASE_URL]}
/"
,
agent:
map
[
USER_AGENT
]);
DioUtil
.
getInstance
().
changeOpt
();
DioUtil
.
getInstance
();
if
(
inProduction
)
{
if
(
map
[
BASE_URL
]
!=
null
&&
map
[
BASE_URL
]
!=
Api
.
getInstance
().
getBaseUrl
())
{
CacheManager
.
getInstance
().
get
(
MEMORY_CACHE
).
save
(
URL_ISCHANE
,
"yes"
);
DioUtil
.
setDefOptions
(
baseUrl:
"
${map[BASE_URL]}
/"
,
agent:
map
[
USER_AGENT
]);
DioUtil
.
getInstance
().
changeOpt
();
SimpleEventBus
.
instance
()
.
notifyListener
(
"clueModel|Plan|PlanPage"
,
"init"
);
}
}
SimpleEventBus
.
instance
().
notifyListener
(
"clueModel|Plan|PlanPage"
,
"init"
);
// if (map[COOKIE] == null) {
// CacheManager.getInstance().get(MEMORY_CACHE).save(COOKIE,
// "_gm_token=1da6071594101423; csrftoken=rUrkkYYMOVZfIIQnU2IH09QIGmsfe8tE; sessionid=uz7f70uap76r6og48znci5l2hbr9vm5c; _gtid=5af9a5deba8511ea8d4082a085c393c93393");
// } else {
innerSetData
(
map
,
COOKIE
);
// }
if
(
map
[
USER_ID
]
==
null
||
"
${map[USER_ID]}
"
.
isEmpty
)
{
CacheManager
.
getInstance
().
get
(
MEMORY_CACHE
).
save
(
USER_ID
,
null
);
}
...
...
lib/MainRouter/page/proxy/NetProxyPage.dart
View file @
5e14cb97
...
...
@@ -27,9 +27,9 @@ class NetProxyState extends BaseState<NetProxyPage> {
appBar:
baseAppBar
(
centerTitle:
true
,
backClick:
()
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
if
(
RouterCenterImpl
().
findMainRouter
().
isWithNative
())
{
FlutterBoost
.
singleton
.
closeCurrent
();
}
else
{
}
else
{
Navigator
.
of
(
context
).
pop
();
}
},
...
...
@@ -50,9 +50,10 @@ class NetProxyState extends BaseState<NetProxyPage> {
InkWell
(
onTap:
()
{
MainApiImpl
.
getInstance
()
.
isOk
(
DioUtil
.
getInstance
().
getDio
())
.
listen
((
event
)
{}).
onError
((
error
){
print
(
"LSYQQ
${error.toString()}
"
);
.
getCity
(
DioUtil
.
getInstance
().
getDio
())
.
listen
((
event
)
{})
.
onError
((
error
)
{
print
(
"LSYQQ
${error.toString()}
"
);
});
},
child:
Container
(
...
...
lib/MainRouter/service/remote/api/MainApi.dart
View file @
5e14cb97
...
...
@@ -4,10 +4,14 @@
**/
import
'package:flutter_common/Annotations/anno/Get.dart'
;
import
'package:flutter_common/Annotations/anno/ServiceCenter.dart'
;
import
'package:gm_flutter/MainRouter/service/remote/entity/CityBean.dart'
;
import
'package:gm_flutter/MainRouter/service/remote/entity/TestBean.dart'
;
@ServiceCenter
()
abstract
class
MainApi
{
@Get
(
"api/demo/test"
)
TestBean
isOk
();
@Get
(
"api/city/located"
)
CityBean
getCity
();
}
\ No newline at end of file
lib/MainRouter/service/remote/api/MainApi.serv.dart
View file @
5e14cb97
...
...
@@ -15,6 +15,7 @@ import 'package:dio/dio.dart';
import
'package:flutter/foundation.dart'
;
import
'package:gm_flutter/MainRouter/service/remote/entity/TestBean.dart'
;
import
'package:gm_flutter/MainRouter/service/remote/entity/CityBean.dart'
;
const
bool
inProduction
=
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
...
...
@@ -45,6 +46,19 @@ class MainApiImpl {
});
}
Stream
<
CityBean
>
getCity
(
Dio
_dio
,
)
{
return
Stream
.
fromFuture
(
get
(
_dio
,
'api/city/located'
)).
flatMap
((
value
)
{
if
(
value
!=
null
&&
(
value
.
statusCode
>=
200
&&
value
.
statusCode
<
300
))
{
return
Stream
.
fromFuture
(
compute
(
parseCityBean
,
value
.
toString
()));
}
else
{
throw
Exception
(
"--未知网络错误--"
);
}
});
}
///==================base method==================
Future
<
Response
>
get
(
Dio
_dio
,
url
,
{
data
,
options
,
cancelToken
})
async
{
...
...
@@ -185,3 +199,7 @@ class MainApiImpl {
TestBean
parseTestBean
(
String
value
)
{
return
TestBean
.
fromJson
(
json
.
decode
(
value
));
}
CityBean
parseCityBean
(
String
value
)
{
return
CityBean
.
fromJson
(
json
.
decode
(
value
));
}
lib/MainRouter/service/remote/entity/CityBean.dart
0 → 100644
View file @
5e14cb97
/*
* @author lsy
* @date 2020/7/14
**/
class
CityBean
{
String
message
;
Extra
extra
;
Data
data
;
int
error
;
CityBean
({
this
.
message
,
this
.
extra
,
this
.
data
,
this
.
error
});
CityBean
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
message
=
json
[
'message'
];
extra
=
json
[
'extra'
]
!=
null
?
new
Extra
.
fromJson
(
json
[
'extra'
])
:
null
;
data
=
json
[
'data'
]
!=
null
?
new
Data
.
fromJson
(
json
[
'data'
])
:
null
;
error
=
json
[
'error'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'message'
]
=
this
.
message
;
if
(
this
.
extra
!=
null
)
{
data
[
'extra'
]
=
this
.
extra
.
toJson
();
}
if
(
this
.
data
!=
null
)
{
data
[
'data'
]
=
this
.
data
.
toJson
();
}
data
[
'error'
]
=
this
.
error
;
return
data
;
}
}
class
Extra
{
Extra
();
Extra
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
return
data
;
}
}
class
Data
{
String
cityId
;
String
cityName
;
Data
({
this
.
cityId
,
this
.
cityName
});
Data
.
fromJson
(
Map
<
String
,
dynamic
>
json
)
{
cityId
=
json
[
'city_id'
];
cityName
=
json
[
'city_name'
];
}
Map
<
String
,
dynamic
>
toJson
()
{
final
Map
<
String
,
dynamic
>
data
=
new
Map
<
String
,
dynamic
>();
data
[
'city_id'
]
=
this
.
cityId
;
data
[
'city_name'
]
=
this
.
cityName
;
return
data
;
}
}
lib/commonModel/App.dart
View file @
5e14cb97
...
...
@@ -2,30 +2,31 @@
* @author lsy
* @date 2020/7/6
**/
const
String
APP_NAME
=
"app_name"
;
const
String
VERSION
=
"version"
;
const
String
PLATFORM
=
"platform"
;
const
String
DEVICE_ID
=
"device_id"
;
const
String
OS_VERSION
=
"os_version"
;
const
String
MODEL
=
"model"
;
const
String
SCREEN
=
"screen"
;
const
String
LAT
=
"lat"
;
const
String
LNG
=
"lng"
;
const
String
CHANNEL
=
"channel"
;
const
String
MANUFACTURER
=
"manufacturer"
;
const
String
UUID
=
"uuid"
;
const
String
ANDROID_DEVICE_ID
=
"android_device_id"
;
const
String
CURRENT_CITY_ID
=
"current_city_id"
;
const
String
RELEASE
=
"release"
;
const
String
IDFA
=
"idfa"
;
const
String
IDFV
=
"idfv"
;
const
String
IS_WIFI
=
"is_WiFi"
;
const
String
HARDWARE_MODEL
=
"hardware_model"
;
const
String
APP_NAME
=
"app_name"
;
const
String
VERSION
=
"version"
;
const
String
PLATFORM
=
"platform"
;
const
String
DEVICE_ID
=
"device_id"
;
const
String
OS_VERSION
=
"os_version"
;
const
String
MODEL
=
"model"
;
const
String
SCREEN
=
"screen"
;
const
String
LAT
=
"lat"
;
const
String
LNG
=
"lng"
;
const
String
CHANNEL
=
"channel"
;
const
String
MANUFACTURER
=
"manufacturer"
;
const
String
UUID
=
"uuid"
;
const
String
ANDROID_DEVICE_ID
=
"android_device_id"
;
const
String
CURRENT_CITY_ID
=
"current_city_id"
;
const
String
RELEASE
=
"release"
;
const
String
IDFA
=
"idfa"
;
const
String
IDFV
=
"idfv"
;
const
String
IS_WIFI
=
"is_WiFi"
;
const
String
HARDWARE_MODEL
=
"hardware_model"
;
//head
const
String
USER_AGENT
=
"User-Agent"
;
const
String
COOKIE
=
"cookie"
;
const
String
USER_AGENT
=
"User-Agent"
;
const
String
COOKIE
=
"cookie"
;
//user
const
String
USER_ID
=
"user_id"
;
const
String
BASE_URL
=
"base_url"
;
const
String
USER_ID
=
"user_id"
;
const
String
BASE_URL
=
"base_url"
;
const
String
URL_ISCHANE
=
"URL_ISCHANE"
;
lib/commonModel/base/BaseComponent.dart
View file @
5e14cb97
...
...
@@ -98,7 +98,7 @@ Text baseText(String text, double fontSize, Color color,
fontSize:
fontSize
,
color:
color
,
fontStyle:
FontStyle
.
normal
,
fontWeight:
bold
?
FontWeight
.
w
7
00
:
FontWeight
.
w400
),
fontWeight:
bold
?
FontWeight
.
w
6
00
:
FontWeight
.
w400
),
maxLines:
maxLines
,
overflow:
overflow
==
null
?
TextOverflow
.
ellipsis
:
overflow
,
);
...
...
@@ -497,7 +497,7 @@ Widget baseTabBarItem(String text,
}
Widget
baseSliverAppBar
(
String
url
,
{
double
height
,
double
elevation
,
bool
needpic
=
true
})
{
{
double
height
,
double
elevation
,
bool
needpic
=
true
,
double
paddingTop
})
{
return
SliverAppBar
(
pinned:
true
,
centerTitle:
true
,
...
...
@@ -505,7 +505,7 @@ Widget baseSliverAppBar(String url,
expandedHeight:
height
??
200
,
automaticallyImplyLeading:
false
,
bottom:
PreferredSize
(
preferredSize:
Size
.
fromHeight
(
Platform
.
isIOS
?
-
12
:
-
6
),
preferredSize:
Size
.
fromHeight
(
paddingTop
??
-
12
),
child:
SizedBox
(
height:
0
,
),
...
...
@@ -524,7 +524,7 @@ Widget baseSliverAppBar(String url,
Widget
baseSliverBack
(
VoidCallback
tap
,
context
)
{
final
double
topPadding
=
MediaQuery
.
of
(
context
).
padding
.
top
;
return
Positioned
(
top:
topPadding
+
12
,
top:
topPadding
+
6.5
,
left:
7
,
child:
GestureDetector
(
behavior:
HitTestBehavior
.
opaque
,
...
...
@@ -548,7 +548,7 @@ Widget baseSliverBack(VoidCallback tap, context) {
Widget
baseSliverTitle
(
String
text
,
double
width
,
LiveData
liveData
,
context
)
{
final
double
topPadding
=
MediaQuery
.
of
(
context
).
padding
.
top
;
return
Positioned
(
top:
topPadding
+
13
,
top:
topPadding
+
9.5
,
child:
StreamBuilder
(
stream:
liveData
.
stream
,
initialData:
liveData
.
data
??
0.0
,
...
...
lib/commonModel/base/BaseUtil.dart
View file @
5e14cb97
...
...
@@ -3,9 +3,3 @@
* @date 2019-10-14
**/
import
'dart:ui'
;
import
'package:flutter/material.dart'
;
import
'package:flutter/services.dart'
;
const
bool
isDebug
=
!
const
bool
.
fromEnvironment
(
"dart.vm.product"
);
lib/commonModel/cache/ShareCache.dart
View file @
5e14cb97
...
...
@@ -7,6 +7,7 @@
import
'package:gm_flutter/commonModel/base/BaseUtil.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'../../main.dart'
;
import
'CacheManager.dart'
;
class
ShareCache
implements
ICache
{
...
...
@@ -19,36 +20,36 @@ class ShareCache implements ICache {
void
save
(
String
key
,
value
)
{
if
(
value
is
String
)
{
sharedPreferences
.
setString
(
key
,
value
).
whenComplete
(()
{
if
(
isDebug
)
{
if
(
!
inProduction
)
{
print
(
"save String
${value}
success"
);
}
});
}
else
if
(
value
is
bool
)
{
sharedPreferences
.
setBool
(
key
,
value
).
whenComplete
(()
{
if
(
isDebug
)
{
if
(
!
inProduction
)
{
print
(
"save bool
${value}
success"
);
}
});
}
else
if
(
value
is
double
)
{
sharedPreferences
.
setDouble
(
key
,
value
).
whenComplete
(()
{
if
(
isDebug
)
{
if
(
!
inProduction
)
{
print
(
"save double
${value}
success"
);
}
});
}
else
if
(
value
is
int
)
{
sharedPreferences
.
setInt
(
key
,
value
).
whenComplete
(()
{
if
(
isDebug
)
{
if
(
!
inProduction
)
{
print
(
"save int
${value}
success"
);
}
});
}
else
if
(
value
is
List
<
String
>)
{
sharedPreferences
.
setStringList
(
key
,
value
).
whenComplete
(()
{
if
(
isDebug
)
{
if
(
!
inProduction
)
{
print
(
"save StringList
${value}
success"
);
}
});
}
else
{
if
(
isDebug
)
{
if
(
!
inProduction
)
{
throw
Exception
(
"save error type"
);
}
}
...
...
lib/commonModel/net/Api.dart
View file @
5e14cb97
...
...
@@ -8,6 +8,7 @@ import 'dart:math';
import
'package:dio/dio.dart'
;
import
'package:gm_flutter/commonModel/base/BaseUtil.dart'
;
import
'../../main.dart'
;
import
'DioUtil.dart'
;
/**
...
...
@@ -21,6 +22,7 @@ const String APP_HOST_RELEASE = "https://backend.igengmei.com";
//const String APP_HOST_DEBUG = "http://doctor.paas-merchant.env";
// const String APP_HOST_DEBUG = "https://x6cgr5y5-gengmei.mock.coding.io";
const
String
APP_HOST_DEBUG
=
"http://backend.paas-merchant.env"
;
//const String APP_HOST_DEBUG = "https://backend.igengmei.com";
//const String APP_HOST_DEBUG = "http://janus.paas-merchant.env";
/**
...
...
@@ -41,7 +43,7 @@ class Api {
}
String
getBaseUrl
()
{
if
(
!
isDebug
)
{
if
(
inProduction
)
{
return
APP_HOST_RELEASE
;
}
else
{
return
APP_HOST_DEBUG
;
...
...
lib/commonModel/net/DioUtil.dart
View file @
5e14cb97
...
...
@@ -17,9 +17,6 @@ class DioUtil {
static
Map
<
String
,
dynamic
>
addHeadMap
;
/// 是否是debug模式.
static
bool
_isDebug
=
isDebug
;
static
DioUtil
getInstance
()
{
return
_instance
;
}
...
...
@@ -72,7 +69,6 @@ class DioUtil {
headers
[
'User-Agent'
]
=
agent
;
}
_options
.
headers
=
headers
;
print
(
"ISEMPTY ??
${baseUrl}
"
);
_options
.
baseUrl
=
baseUrl
??
"
${Api.getInstance().getBaseUrl()}
/"
;
}
}
lib/main.dart
View file @
5e14cb97
...
...
@@ -7,6 +7,7 @@ import 'package:flutter_common/commonModel/util/WindowUtil.dart';
import
'package:flutter_screenutil/screenutil.dart'
;
import
'package:gm_flutter/main.mark.dart'
;
import
'package:shared_preferences/shared_preferences.dart'
;
import
'commonModel/base/BaseComponent.dart'
;
import
'commonModel/base/BaseUtil.dart'
;
import
'commonModel/cache/CacheManager.dart'
;
...
...
@@ -14,12 +15,14 @@ import 'commonModel/nav/NavigationService.dart';
import
'main.mark.dart'
;
NavigationService
navigationService
;
bool
inProduction
=
true
;
void
main
(
)
{
inProduction
=
bool
.
fromEnvironment
(
"dart.vm.product"
);
navigationService
=
NavigationService
();
WidgetsFlutterBinding
.
ensureInitialized
();
FlutterError
.
onError
=
(
FlutterErrorDetails
details
)
async
{
if
(
isDebug
)
{
if
(
!
inProduction
)
{
FlutterError
.
dumpErrorToConsole
(
details
);
}
else
{
Zone
.
current
.
handleUncaughtError
(
details
.
exception
,
details
.
stack
);
...
...
@@ -121,7 +124,7 @@ class HomeState extends State<Home> {
@override
Widget
build
(
BuildContext
context
)
{
ScreenUtil
.
init
(
context
,
width:
375
,
height:
667
);
return
isDebug
return
!
inProduction
?
RouterCenterImpl
().
findMainRouter
().
getTestPage
()
:
Container
(
color:
Colors
.
white
,
...
...
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