Files
ln-ios/ln_jq_app/lib/main.dart
userGyl 6a3c6db7a8 Merge branch 'dev'
司机端-加氢预约  预约时间段修改  1、开始结束时间整合成一个  2、时间只开放当日和次日
司机端-加氢预约  提交预约不可提交限制 1、非营业站点 2、预约时间不可重复
司机端-预约列表 1、新增到站时间、氢量修改 2、显示拒绝加氢原因
加氢站-加氢预约  1、新增当日预约加车牌/手机号筛选  2、新增加氢总量 未加氢量  3、 确认拒绝流程优化:完成可填写具体加氢量,新增拒绝原因
# Conflicts:
#	ln_jq_app/lib/common/styles/theme.dart
2025-12-11 15:48:10 +08:00

86 lines
2.4 KiB
Dart
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import 'package:flutter_localizations/flutter_localizations.dart';
import 'package:flutter_native_splash/flutter_native_splash.dart';
import 'package:get_storage/get_storage.dart';
import 'package:getx_scaffold/getx_scaffold.dart';
import 'package:ln_jq_app/common/model/base_model.dart';
import 'package:ln_jq_app/common/token_interceptor.dart';
import 'package:ln_jq_app/storage_service.dart';
import 'common/styles/theme.dart';
import 'pages/home/view.dart';
import 'pages/login/view.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
WidgetsBinding widgetsBinding = await init(
isDebug: false,
logTag: '小羚羚',
supportedLocales: [Locale('zh', 'CN')],
);
FlutterNativeSplash.preserve(widgetsBinding: widgetsBinding);
await GetStorage.init();
await Get.putAsync(() => StorageService().init());
initHttpSet();
runApp(
GetxApp(
// 设计稿尺寸 单位dp
designSize: const Size(390, 844),
// Getx Log
enableLog: false,
// 默认的跳转动画
defaultTransition: Transition.rightToLeft,
// 主题模式
themeMode: GlobalService.to.themeMode,
// 主题
theme: AppTheme.light,
// Dark主题
darkTheme: AppTheme.dark,
// AppTitle
title: '小羚羚',
// 首页入口
home: HomePage(),
//组件国际化
fallbackLocale: Locale('zh', 'CN'),
supportedLocales: [Locale('zh', 'CN')],
localizationsDelegates: const [
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate,
],
// Builder
builder: (context, widget) {
// do something....
return widget!;
},
),
);
}
void initHttpSet() {
// 设置基础 URL
HttpService.to.setBaseUrl(AppTheme.test_service_url);
//指定请求头
HttpService.to.dio.interceptors.add(TokenInterceptor(tokenKey: 'asoco-token'));
// 设置全局响应处理器
HttpService.to.setOnResponseHandler((response) async {
try {
final baseModel = BaseModel<dynamic>.fromJson(response.data);
if (baseModel.code == 0 || baseModel.code == 200) {
return null;
} else if (baseModel.code == 401) {
await StorageService.to.clearLoginInfo();
Get.offAll(() => LoginPage());
return baseModel.message;
}
} on Exception catch (e) {
e.printInfo();
return '服务器异常';
}
});
}