Commit 5e14cb97 authored by 杜欣's avatar 杜欣

Merge branch 'test' into featrue/duxin

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