站点登录
This commit is contained in:
@@ -1,23 +1,26 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
import 'package:getx_scaffold/common/common.dart';
|
||||
import 'package:getx_scaffold/getx_scaffold.dart';
|
||||
import 'package:ln_jq_app/pages/b_page/base_widgets/view.dart';
|
||||
import 'package:ln_jq_app/pages/c_page/base_widgets/view.dart';
|
||||
import 'package:ln_jq_app/pages/home/view.dart';
|
||||
import 'package:ln_jq_app/common/model/base_model.dart';
|
||||
import 'package:ln_jq_app/storage_service.dart';
|
||||
|
||||
import 'common/styles/theme.dart';
|
||||
import 'pages/login/view.dart';
|
||||
import 'pages/home/view.dart';
|
||||
|
||||
/// Main
|
||||
void main() async {
|
||||
WidgetsBinding widgetsBinding = await init(isDebug: kDebugMode, logTag: '小羚羚');
|
||||
WidgetsBinding widgetsBinding = await init(isDebug: true, logTag: '小羚羚');
|
||||
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
|
||||
|
||||
await Get.putAsync(() => StorageService().init());
|
||||
initHttpSet();
|
||||
|
||||
runApp(
|
||||
GetxApp(
|
||||
// 设计稿尺寸 单位:dp
|
||||
designSize: const Size(390, 844),
|
||||
// Getx Log
|
||||
enableLog: kDebugMode,
|
||||
enableLog: true,
|
||||
// 默认的跳转动画
|
||||
defaultTransition: Transition.rightToLeft,
|
||||
// 主题模式
|
||||
@@ -30,6 +33,10 @@ void main() async {
|
||||
title: '小羚羚',
|
||||
// 首页入口
|
||||
home: HomePage(),
|
||||
// 推荐使用命名路由,如果配置好了可以取消下面两行的注释
|
||||
// initialRoute: AppPages.INITIAL,
|
||||
// getPages: AppPages.routes,
|
||||
|
||||
// Builder
|
||||
builder: (context, widget) {
|
||||
// do something....
|
||||
@@ -39,4 +46,23 @@ void main() async {
|
||||
);
|
||||
}
|
||||
|
||||
void initHttpSet() {
|
||||
// 设置基础 URL
|
||||
HttpService.to.setBaseUrl(AppTheme.test_service_url);
|
||||
|
||||
// 设置全局响应处理器
|
||||
HttpService.to.setOnResponseHandler((response) async {
|
||||
try {
|
||||
final baseModel = BaseModel<dynamic>.fromJson(response.data);
|
||||
if (baseModel.code == 0) {
|
||||
return null;
|
||||
} else {
|
||||
return baseModel.message;
|
||||
}
|
||||
} on Exception catch (e) {
|
||||
e.printInfo();
|
||||
return '服务器异常';
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user