From 14e44092d8efaf962dd5c08e3604a256357ab534 Mon Sep 17 00:00:00 2001 From: wylyl22 <2373073266@qq.com> Date: Mon, 8 Aug 2022 16:17:53 +0800 Subject: [PATCH] www --- lib/environment/environment.dart | 16 ++++ lib/main.dart | 20 +++-- lib/ui/home/content_page.dart | 4 +- lib/ui/home/home_page.dart | 6 +- lib/ui/user/user_page.dart | 11 ++- pubspec.lock | 128 +++++++++++++++++++++++++++---- pubspec.yaml | 8 +- test/widget_test.dart | 5 +- 8 files changed, 161 insertions(+), 37 deletions(-) create mode 100644 lib/environment/environment.dart diff --git a/lib/environment/environment.dart b/lib/environment/environment.dart new file mode 100644 index 0000000..f4e2a01 --- /dev/null +++ b/lib/environment/environment.dart @@ -0,0 +1,16 @@ +import 'package:power_logger/power_logger.dart'; + +class DevEV { + static final DevEV _instance = DevEV._(); + + DevEV._(); + + static DevEV get instance => _instance; + + bool dev = false; + + void setEnvironment(context, {required bool environment}) { + dev = environment; + PowerLogger.start(context, debug: dev); + } +} diff --git a/lib/main.dart b/lib/main.dart index d51cf68..9136dc2 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,14 +1,15 @@ -import 'dart:async'; +// import 'dart:async'; import 'package:bot_toast/bot_toast.dart'; -import 'package:call_log/call_log.dart'; +// import 'package:call_log/call_log.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:flutter_background_service/flutter_background_service.dart'; import 'package:flutter_screenutil/flutter_screenutil.dart'; import 'package:get/get_navigation/src/root/get_material_app.dart'; -import 'package:permission_handler/permission_handler.dart'; -import 'package:project_telephony/permission.dart'; -import 'package:project_telephony/ui/login/login_page.dart'; +import 'package:power_logger/power_logger.dart'; +// import 'package:permission_handler/permission_handler.dart'; +// import 'package:project_telephony/permission.dart'; +// import 'package:project_telephony/ui/login/login_page.dart'; import 'package:project_telephony/ui/tab_navigator.dart'; // import 'package:telephony/telephony.dart'; @@ -19,11 +20,14 @@ import 'package:project_telephony/ui/tab_navigator.dart'; void main() async { WidgetsFlutterBinding.ensureInitialized(); + FlutterError.onError = (details) { + LoggerData.addData(details); + FlutterError.presentError(details); + }; // await initializeService(); + WidgetsFlutterBinding.ensureInitialized(); runApp(const MyApp()); - // SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle( - // statusBarColor: Colors.transparent, //状态栏背景色 - // statusBarIconBrightness: Brightness.dark); //状态栏字体颜色 + } // Future initializeService() async { diff --git a/lib/ui/home/content_page.dart b/lib/ui/home/content_page.dart index 40c025e..d08d20a 100644 --- a/lib/ui/home/content_page.dart +++ b/lib/ui/home/content_page.dart @@ -67,8 +67,7 @@ class _ContentPageState extends State { // print(index); }, onLongPress: () { - setState(() {}); - if (index == textList.length - 1) { + if (index != textList.length - 1) { showDialog( context: context, builder: (context) { @@ -78,6 +77,7 @@ class _ContentPageState extends State { ); }); } + setState(() {}); }, child: Container( // width: 686.w, diff --git a/lib/ui/home/home_page.dart b/lib/ui/home/home_page.dart index 6e8945d..ff8397b 100644 --- a/lib/ui/home/home_page.dart +++ b/lib/ui/home/home_page.dart @@ -11,6 +11,7 @@ class HomePage extends StatefulWidget { class _HomePageState extends State { @override + Widget build(BuildContext context) { return Scaffold( backgroundColor: Colors.white, @@ -19,12 +20,11 @@ class _HomePageState extends State { body: SafeArea( child: Column( children: [ - Container( - child: Image.asset( + Image.asset( Assets.images.homeBg.path, height: 722.w, width: 722.w, - )), + ), _getBody(), ], ), diff --git a/lib/ui/user/user_page.dart b/lib/ui/user/user_page.dart index 3343d8a..6c69ccb 100644 --- a/lib/ui/user/user_page.dart +++ b/lib/ui/user/user_page.dart @@ -1,8 +1,10 @@ import 'package:bot_toast/bot_toast.dart'; +import 'package:flutter/foundation.dart'; import 'package:flutter/material.dart'; import 'package:flutter/services.dart'; import 'package:permission_handler/permission_handler.dart'; import 'package:permission_handler_platform_interface/permission_handler_platform_interface.dart'; +import 'package:power_logger/power_logger.dart'; import 'package:project_telephony/base/base_style.dart'; import 'package:project_telephony/ui/login/login_page.dart'; import 'package:project_telephony/ui/user/members_page.dart'; @@ -26,13 +28,14 @@ class UserPage extends StatefulWidget { final Telephony telephony = Telephony.instance; -@override -void initState() {} - class _UserPageState extends State { bool vle = false; bool tooken = true; - + @override + void initState() { + super.initState(); + PowerLogger.start(context, debug: true); + } @override Widget build(BuildContext context) { diff --git a/pubspec.lock b/pubspec.lock index 93b406c..e9dca52 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -7,14 +7,14 @@ packages: name: _fe_analyzer_shared url: "https://pub.dartlang.org" source: hosted - version: "44.0.0" + version: "40.0.0" analyzer: dependency: transitive description: name: analyzer url: "https://pub.dartlang.org" source: hosted - version: "4.4.0" + version: "4.1.0" archive: dependency: transitive description: @@ -161,7 +161,7 @@ packages: name: code_builder url: "https://pub.dartlang.org" source: hosted - version: "4.2.0" + version: "4.1.0" collection: dependency: transitive description: @@ -238,7 +238,7 @@ packages: name: device_info_plus url: "https://pub.dartlang.org" source: hosted - version: "4.0.1" + version: "2.2.0" device_info_plus_linux: dependency: transitive description: @@ -273,7 +273,14 @@ packages: name: device_info_plus_windows url: "https://pub.dartlang.org" source: hosted - version: "3.0.1" + version: "2.1.1" + dio: + dependency: transitive + description: + name: dio + url: "https://pub.dartlang.org" + source: hosted + version: "4.0.6" fake_async: dependency: transitive description: @@ -287,7 +294,7 @@ packages: name: ffi url: "https://pub.dartlang.org" source: hosted - version: "2.0.1" + version: "1.2.1" file: dependency: transitive description: @@ -356,13 +363,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "4.3.0" + flutter_highlight: + dependency: transitive + description: + name: flutter_highlight + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.0" flutter_lints: dependency: "direct dev" description: name: flutter_lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.4" + version: "2.0.1" flutter_native_splash: dependency: "direct dev" description: @@ -436,6 +450,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.9.2" + highlight: + dependency: transitive + description: + name: highlight + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.0" hive: dependency: "direct main" description: @@ -450,6 +471,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.1.0" + hive_generator: + dependency: "direct dev" + description: + name: hive_generator + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.3" http: dependency: transitive description: @@ -513,6 +541,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.6.1" + import_sorter: + dependency: "direct dev" + description: + name: import_sorter + url: "https://pub.dartlang.org" + source: hosted + version: "4.6.0" intl: dependency: transitive description: @@ -554,7 +589,14 @@ packages: name: lints url: "https://pub.dartlang.org" source: hosted - version: "1.0.1" + version: "2.0.0" + logger: + dependency: transitive + description: + name: logger + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0" logging: dependency: transitive description: @@ -611,6 +653,48 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.2" + package_info_plus: + dependency: transitive + description: + name: package_info_plus + url: "https://pub.dartlang.org" + source: hosted + version: "1.4.2" + package_info_plus_linux: + dependency: transitive + description: + name: package_info_plus_linux + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + package_info_plus_macos: + dependency: transitive + description: + name: package_info_plus_macos + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0" + package_info_plus_platform_interface: + dependency: transitive + description: + name: package_info_plus_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.2" + package_info_plus_web: + dependency: transitive + description: + name: package_info_plus_web + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" + package_info_plus_windows: + dependency: transitive + description: + name: package_info_plus_windows + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.5" path: dependency: transitive description: @@ -666,7 +750,7 @@ packages: name: path_provider_windows url: "https://pub.dartlang.org" source: hosted - version: "2.1.1" + version: "2.0.7" permission_handler: dependency: "direct main" description: @@ -708,7 +792,7 @@ packages: name: petitparser url: "https://pub.dartlang.org" source: hosted - version: "5.0.0" + version: "4.4.0" platform: dependency: transitive description: @@ -730,6 +814,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.5.1" + power_logger: + dependency: "direct main" + description: + name: power_logger + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.2" process: dependency: transitive description: @@ -931,6 +1022,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.0.0" + tint: + dependency: transitive + description: + name: tint + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.0" tobias: dependency: "direct main" description: @@ -944,7 +1042,7 @@ packages: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.1" + version: "1.3.0" universal_io: dependency: transitive description: @@ -993,7 +1091,7 @@ packages: name: win32 url: "https://pub.dartlang.org" source: hosted - version: "2.7.0" + version: "2.5.2" xdg_directories: dependency: transitive description: @@ -1007,7 +1105,7 @@ packages: name: xml url: "https://pub.dartlang.org" source: hosted - version: "5.4.1" + version: "5.3.1" yaml: dependency: "direct dev" description: @@ -1016,5 +1114,5 @@ packages: source: hosted version: "3.1.1" sdks: - dart: ">=2.17.0 <3.0.0" - flutter: ">=3.0.0" + dart: ">=2.17.0-206.0.dev <3.0.0" + flutter: ">=2.8.1" diff --git a/pubspec.yaml b/pubspec.yaml index a7bc943..da95813 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -69,7 +69,8 @@ dependencies: # model生成 json_annotation: ^4.6.0 permission_handler_platform_interface: ^3.7.0 - + #日志输出 + power_logger: ^1.2.2 # # jdk # jverify: ^2.2.5 ## pub 集成 @@ -85,13 +86,16 @@ dev_dependencies: # package. See that file for information about deactivating specific lint # rules and activating additional ones. # test: ^1.21.4 - flutter_lints: ^1.0.0 + #导入包整理 + import_sorter: ^4.5.1 + hive_generator: ^1.1.0 #model自动生成 json_serializable: ^6.1.3 build_runner: ^2.0.2 yaml: ^3.1.0 pub_semver: ^2.1.0 flutter_gen_runner: ^4.1.3 + flutter_lints: ^2.0.0 # patgh: ^1.8.1 #脚本工具 grinder: ^0.9.1 diff --git a/test/widget_test.dart b/test/widget_test.dart index 1e94965..5e067c3 100644 --- a/test/widget_test.dart +++ b/test/widget_test.dart @@ -7,14 +7,13 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; -// import 'package:test/test.dart'; - import 'package:project_telephony/main.dart'; + void main() { testWidgets('Counter increments smoke test', (WidgetTester tester) async { // Build our app and trigger a frame. - await tester.pumpWidget(MyApp()); + await tester.pumpWidget(const MyApp()); // Verify that our counter starts at 0. expect(find.text('0'), findsOneWidget);