添加一些工具类

main
zhuce 2024-03-09 17:13:48 +08:00
parent 988052630a
commit 60b6f780d2
9 changed files with 88 additions and 5 deletions

View File

@ -10,12 +10,19 @@ PODS:
- AMapFoundation (1.8.2) - AMapFoundation (1.8.2)
- AMapLocation (2.10.0): - AMapLocation (2.10.0):
- AMapFoundation (>= 1.8.0) - AMapFoundation (>= 1.8.0)
- device_info_plus (0.0.1):
- Flutter
- Flutter (1.0.0) - Flutter (1.0.0)
- shared_preferences_foundation (0.0.1):
- Flutter
- FlutterMacOS
DEPENDENCIES: DEPENDENCIES:
- amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`) - amap_flutter_location (from `.symlinks/plugins/amap_flutter_location/ios`)
- amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`) - amap_flutter_map (from `.symlinks/plugins/amap_flutter_map/ios`)
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`) - Flutter (from `Flutter`)
- shared_preferences_foundation (from `.symlinks/plugins/shared_preferences_foundation/darwin`)
SPEC REPOS: SPEC REPOS:
trunk: trunk:
@ -28,8 +35,12 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/amap_flutter_location/ios" :path: ".symlinks/plugins/amap_flutter_location/ios"
amap_flutter_map: amap_flutter_map:
:path: ".symlinks/plugins/amap_flutter_map/ios" :path: ".symlinks/plugins/amap_flutter_map/ios"
device_info_plus:
:path: ".symlinks/plugins/device_info_plus/ios"
Flutter: Flutter:
:path: Flutter :path: Flutter
shared_preferences_foundation:
:path: ".symlinks/plugins/shared_preferences_foundation/darwin"
SPEC CHECKSUMS: SPEC CHECKSUMS:
AMap3DMap: dce25dd3e51e6b92109caa7d0c97fc6055830fb3 AMap3DMap: dce25dd3e51e6b92109caa7d0c97fc6055830fb3
@ -37,7 +48,9 @@ SPEC CHECKSUMS:
amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a amap_flutter_map: 979e54d227cedac6c7504a2151bfbf3bcf96760a
AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec AMapFoundation: 9885c48fc3a78fdfb84a0299a2293e56ea3c9fec
AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033 AMapLocation: 5248aec2455ebb5d104b367813c946430a2ee033
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7 Flutter: e0871f40cf51350855a761d2e70bf5af5b9b5de7
shared_preferences_foundation: b4c3b4cddf1c21f02770737f147a3f5da9d39695
PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796 PODFILE CHECKSUM: 819463e6a0290f5a72f145ba7cde16e8b6ef0796

View File

@ -199,6 +199,7 @@
9705A1C41CF9048500538489 /* Embed Frameworks */, 9705A1C41CF9048500538489 /* Embed Frameworks */,
3B06AD1E1E4923F5004D2608 /* Thin Binary */, 3B06AD1E1E4923F5004D2608 /* Thin Binary */,
89E1D2AC08093F01356506F3 /* [CP] Copy Pods Resources */, 89E1D2AC08093F01356506F3 /* [CP] Copy Pods Resources */,
AED7BE96CE0DD7BE394CFAEB /* [CP] Embed Pods Frameworks */,
); );
buildRules = ( buildRules = (
); );
@ -340,6 +341,23 @@
shellPath = /bin/sh; shellPath = /bin/sh;
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build"; shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" build";
}; };
AED7BE96CE0DD7BE394CFAEB /* [CP] Embed Pods Frameworks */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-input-files.xcfilelist",
);
name = "[CP] Embed Pods Frameworks";
outputFileListPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks-${CONFIGURATION}-output-files.xcfilelist",
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh\"\n";
showEnvVarsInLog = 0;
};
AFD723CBD5C5EAB85535EEC4 /* [CP] Check Pods Manifest.lock */ = { AFD723CBD5C5EAB85535EEC4 /* [CP] Check Pods Manifest.lock */ = {
isa = PBXShellScriptBuildPhase; isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647; buildActionMask = 2147483647;

View File

@ -14,6 +14,7 @@ class LoginApi {
"wx_openid": openid, "wx_openid": openid,
"wx_unionid": unionid "wx_unionid": unionid
}; };
var headers = {'Content-Type': 'x-www-form-urlencoded'};
var post = await xHttp.post("/v2/auth/get-access-token", data); var post = await xHttp.post("/v2/auth/get-access-token", data);
// print(post); // print(post);
} }

View File

@ -1,10 +1,10 @@
class Constant{ class Constant{
// //
static const String testHost = "http://api.test.jjsos.cn/"; static const String testHost = "http://api.test.jjsos.cn";
//线 //线
static const String host = "http://api.jjsos.cn/"; static const String host = "http://api.jjsos.cn";
//host //host
static const String pictureHost = "http://pic.jjsos.cn/"; static const String pictureHost = "http://pic.jjsos.cn";
// //
static const String testWorkOrderUrl = "http://backend.test.jjsos.cn/old/elc-work-new-app?order_id="; static const String testWorkOrderUrl = "http://backend.test.jjsos.cn/old/elc-work-new-app?order_id=";
static const String workOrderUrl = "http://backend.jjsos.cn/old/elc-work-new-app?order_id="; static const String workOrderUrl = "http://backend.jjsos.cn/old/elc-work-new-app?order_id=";

View File

@ -1,9 +1,12 @@
import 'package:autosos_flutter/config/theme_colors.dart';
import 'package:autosos_flutter/pages/home/home_page.dart'; import 'package:autosos_flutter/pages/home/home_page.dart';
import 'package:autosos_flutter/pages/login/login_page.dart'; import 'package:autosos_flutter/pages/login/login_page.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart'; import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:shared_preferences/shared_preferences.dart';
void main() { void main() {
SharedPreferences.setMockInitialValues({});
runApp(const MyApp()); runApp(const MyApp());
} }
@ -16,7 +19,7 @@ class MyApp extends StatelessWidget {
return MaterialApp( return MaterialApp(
title: 'Flutter Demo', title: 'Flutter Demo',
theme: ThemeData( theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple), colorScheme: ColorScheme.fromSeed(seedColor: ThemeColors.primary),
useMaterial3: true, useMaterial3: true,
), ),
home: const LoginPage(), home: const LoginPage(),

View File

@ -0,0 +1,21 @@
import 'dart:io';
class PlatformUtils{
static String getOSName(){
if(Platform.isAndroid){
return 'android';
}else if(Platform.isFuchsia){
return 'fuchsia';
}else if(Platform.isIOS){
return 'ios';
}else if(Platform.isLinux){
return 'linux';
}else if(Platform.isMacOS){
return 'macos';
}else if(Platform.isWindows){
return 'windows';
}else{
return 'unknown';
}
}
}

View File

@ -49,7 +49,9 @@ class XHttp {
baseUrl: _getBaseUrl(), baseUrl: _getBaseUrl(),
// contentType: , // contentType: ,
// responseType: , // responseType: ,
headers: {'Content-Type': 'application/json'}, headers: {
'Content-Type': 'application/json',
},
connectTimeout: const Duration(milliseconds: CONNECT_TIMEOUT), connectTimeout: const Duration(milliseconds: CONNECT_TIMEOUT),
receiveTimeout: const Duration(milliseconds: RECEIVE_TIMEOUT), receiveTimeout: const Duration(milliseconds: RECEIVE_TIMEOUT),
sendTimeout: const Duration(milliseconds: SEND_TIMEOUT), sendTimeout: const Duration(milliseconds: SEND_TIMEOUT),

View File

@ -97,6 +97,22 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "1.0.6" version: "1.0.6"
device_info_plus:
dependency: "direct main"
description:
name: device_info_plus
sha256: "77f757b789ff68e4eaf9c56d1752309bd9f7ad557cb105b938a7f8eb89e59110"
url: "https://pub.flutter-io.cn"
source: hosted
version: "9.1.2"
device_info_plus_platform_interface:
dependency: transitive
description:
name: device_info_plus_platform_interface
sha256: d3b01d5868b50ae571cd1dc6e502fc94d956b665756180f7b16ead09e836fd64
url: "https://pub.flutter-io.cn"
source: hosted
version: "7.0.0"
dio: dio:
dependency: "direct main" dependency: "direct main"
description: description:
@ -477,6 +493,14 @@ packages:
url: "https://pub.flutter-io.cn" url: "https://pub.flutter-io.cn"
source: hosted source: hosted
version: "5.2.0" version: "5.2.0"
win32_registry:
dependency: transitive
description:
name: win32_registry
sha256: "41fd8a189940d8696b1b810efb9abcf60827b6cbfab90b0c43e8439e3a39d85a"
url: "https://pub.flutter-io.cn"
source: hosted
version: "1.1.2"
xdg_directories: xdg_directories:
dependency: transitive dependency: transitive
description: description:

View File

@ -38,6 +38,7 @@ dependencies:
shared_preferences: ^2.2.2 shared_preferences: ^2.2.2
basic_utils: ^5.7.0 basic_utils: ^5.7.0
uuid: ^4.3.3 uuid: ^4.3.3
device_info_plus: ^9.1.2
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.