Commit 299c4797 authored by 林生雨's avatar 林生雨

w

parent c99cab77
...@@ -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(
......
...@@ -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(
......
...@@ -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';
...@@ -65,7 +66,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin { ...@@ -65,7 +66,7 @@ class PlanState extends BaseState<PlanPage> with TickerProviderStateMixin {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
if (bool.fromEnvironment("dart.vm.product") && if (inProduction&&
Platform.isIOS && Platform.isIOS &&
CacheManager.getInstance().get(MEMORY_CACHE).get(BASE_URL) == null) { CacheManager.getInstance().get(MEMORY_CACHE).get(BASE_URL) == null) {
func = (str) { func = (str) {
......
...@@ -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;
...@@ -75,7 +76,7 @@ class MainManager { ...@@ -75,7 +76,7 @@ class MainManager {
innerSetData(map, BASE_URL); innerSetData(map, BASE_URL);
DioUtil.getInstance(); DioUtil.getInstance();
if (bool.fromEnvironment("dart.vm.product")) { if (inProduction) {
if (map[BASE_URL] != null && if (map[BASE_URL] != null &&
map[BASE_URL] != Api.getInstance().getBaseUrl()) { map[BASE_URL] != Api.getInstance().getBaseUrl()) {
CacheManager.getInstance().get(MEMORY_CACHE).save(URL_ISCHANE, "yes"); CacheManager.getInstance().get(MEMORY_CACHE).save(URL_ISCHANE, "yes");
......
...@@ -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';
/** /**
...@@ -42,7 +43,7 @@ class Api { ...@@ -42,7 +43,7 @@ class Api {
} }
String getBaseUrl() { String getBaseUrl() {
if (bool.fromEnvironment("dart.vm.product")) { if (inProduction) {
return APP_HOST_RELEASE; return APP_HOST_RELEASE;
} else { } else {
return APP_HOST_DEBUG; return APP_HOST_DEBUG;
......
...@@ -69,7 +69,6 @@ class DioUtil { ...@@ -69,7 +69,6 @@ class DioUtil {
headers['User-Agent'] = agent; headers['User-Agent'] = agent;
} }
_options.headers = headers; _options.headers = headers;
print("ISEMPTY ?? ${baseUrl} ${Api.getInstance().getBaseUrl()}");
_options.baseUrl = baseUrl ?? "${Api.getInstance().getBaseUrl()}/"; _options.baseUrl = baseUrl ?? "${Api.getInstance().getBaseUrl()}/";
} }
} }
...@@ -15,13 +15,14 @@ import 'commonModel/nav/NavigationService.dart'; ...@@ -15,13 +15,14 @@ import 'commonModel/nav/NavigationService.dart';
import 'main.mark.dart'; import 'main.mark.dart';
NavigationService navigationService; NavigationService navigationService;
const bool inProduction = true; 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);
...@@ -123,7 +124,7 @@ class HomeState extends State<Home> { ...@@ -123,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