From 747dba216f1966c9cfb8602e54f1b432813b781b Mon Sep 17 00:00:00 2001 From: YuanXuan Date: Fri, 29 Aug 2025 13:51:06 +0800 Subject: [PATCH 1/2] feat: remove lint --- pubspec.lock | 16 ---------------- pubspec.yaml | 40 +--------------------------------------- 2 files changed, 1 insertion(+), 55 deletions(-) diff --git a/pubspec.lock b/pubspec.lock index 13785e0..c7dd4c9 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -54,14 +54,6 @@ packages: description: flutter source: sdk version: "0.0.0" - flutter_lints: - dependency: "direct dev" - description: - name: flutter_lints - sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" - url: "https://pub.flutter-io.cn" - source: hosted - version: "4.0.0" flutter_test: dependency: "direct dev" description: flutter @@ -91,14 +83,6 @@ packages: url: "https://pub.flutter-io.cn" source: hosted version: "3.0.1" - lints: - dependency: transitive - description: - name: lints - sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" - url: "https://pub.flutter-io.cn" - source: hosted - version: "4.0.0" matcher: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index c4e2fc8..ccb9858 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -10,47 +10,9 @@ environment: dependencies: flutter: sdk: flutter - # 可选依赖:如果使用Dio拦截器,请添加dio依赖 - # dio: ^5.0.0 dev_dependencies: flutter_test: sdk: flutter - flutter_lints: ^4.0.0 - -# For information on the generic Dart part of this file, see the -# following page: https://dart.dev/tools/pub/pubspec - -# The following section is specific to Flutter packages. + flutter: - - # To add assets to your package, add an assets section, like this: - # assets: - # - images/a_dot_burr.jpeg - # - images/a_dot_ham.jpeg - # - # For details regarding assets in packages, see - # https://flutter.dev/assets-and-images/#from-packages - # - # An image asset can refer to one or more resolution-specific "variants", see - # https://flutter.dev/assets-and-images/#resolution-aware - - # To add custom fonts to your package, add a fonts section here, - # in this "flutter" section. Each entry in this list should have a - # "family" key with the font family name, and a "fonts" key with a - # list giving the asset and other descriptors for the font. For - # example: - # fonts: - # - family: Schyler - # fonts: - # - asset: fonts/Schyler-Regular.ttf - # - asset: fonts/Schyler-Italic.ttf - # style: italic - # - family: Trajan Pro - # fonts: - # - asset: fonts/TrajanPro.ttf - # - asset: fonts/TrajanPro_Bold.ttf - # weight: 700 - # - # For details regarding fonts in packages, see - # https://flutter.dev/custom-fonts/#from-packages From c02486e0728c8a2fd4c6932f0ac898ea12a66833 Mon Sep 17 00:00:00 2001 From: YuanXuan Date: Fri, 12 Sep 2025 11:20:41 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20=E6=B8=85=E7=90=86=E6=97=A5?= =?UTF-8?q?=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yx_net_inspector_controller.dart | 24 ------------------- lib/src/widgets/floating_ball.dart | 20 +++++----------- lib/src/yx_net_inspector_app.dart | 4 ---- pubspec.yaml | 4 ++-- 4 files changed, 8 insertions(+), 44 deletions(-) diff --git a/lib/src/controller/yx_net_inspector_controller.dart b/lib/src/controller/yx_net_inspector_controller.dart index b16d103..3335af0 100644 --- a/lib/src/controller/yx_net_inspector_controller.dart +++ b/lib/src/controller/yx_net_inspector_controller.dart @@ -39,10 +39,6 @@ class YxNetInspectorController extends ChangeNotifier { void initialize(YxNetInspectorConfig config) { _config = config; _showFloatingBall = config.showFloatingBall; - - if (kDebugMode) { - debugPrint('🔍 YX 网络检查器已初始化'); - } } /// 记录网络请求 @@ -72,10 +68,6 @@ class YxNetInspectorController extends ChangeNotifier { _requestCount++; _trimLogs(); notifyListeners(); - - if (kDebugMode) { - debugPrint('📡 请求已记录: $method $url'); - } } /// 记录网络响应 @@ -117,12 +109,6 @@ class YxNetInspectorController extends ChangeNotifier { } notifyListeners(); - - if (kDebugMode) { - debugPrint( - '📨 响应已记录: $statusCode for ${originalLog.method} ${originalLog.url}', - ); - } } /// 记录网络错误 @@ -154,12 +140,6 @@ class YxNetInspectorController extends ChangeNotifier { } notifyListeners(); - - if (kDebugMode) { - debugPrint( - '❌ 错误已记录: $error for ${originalLog.method} ${originalLog.url}', - ); - } } /// 清空所有日志 @@ -170,10 +150,6 @@ class YxNetInspectorController extends ChangeNotifier { _errorCount = 0; _totalDuration = 0; notifyListeners(); - - if (kDebugMode) { - debugPrint('🧹 所有日志已清空'); - } } /// 显示悬浮球 diff --git a/lib/src/widgets/floating_ball.dart b/lib/src/widgets/floating_ball.dart index 5d1c9f3..adb983a 100644 --- a/lib/src/widgets/floating_ball.dart +++ b/lib/src/widgets/floating_ball.dart @@ -96,18 +96,12 @@ class _YxFloatingBallState extends State OverlayState? overlay; try { overlay = Overlay.of(context, rootOverlay: true); - print('YxNetInspector: 成功找到根 Overlay'); } catch (e) { - print('YxNetInspector: 根 Overlay 查找失败: $e'); + debugPrint('YxNetInspector: 根 Overlay 查找失败: $e'); // 如果 Overlay.of 失败,尝试手动查找 overlay = _findOverlayInContext(context); - if (overlay != null) { - print('YxNetInspector: 手动查找 Overlay 成功'); - } else { - print('YxNetInspector: 手动查找 Overlay 也失败'); - } } - + if (overlay == null) { // 如果仍然找不到 Overlay,使用备选方案 _showInspectorDialog(); @@ -144,9 +138,8 @@ class _YxFloatingBallState extends State overlay.insert(overlayEntry); _currentOverlayEntry = overlayEntry; - print('YxNetInspector: 检查器面板显示成功'); } catch (e) { - print('YxNetInspector: 插入 OverlayEntry 失败: $e'); + debugPrint('YxNetInspector: 插入 OverlayEntry 失败: $e'); // 重置状态 setState(() { _isExpanded = false; @@ -176,8 +169,7 @@ class _YxFloatingBallState extends State void _createCustomOverlay() { // 如果所有 Overlay 方法都失败,我们显示一个简单的调试信息 // 并重置状态,避免悬浮球卡在展开状态 - print('YxNetInspector: 无法找到 Overlay 上下文,请确保 YxNetInspector 在 MaterialApp 内部使用'); - + // 显示一个简单的 SnackBar 或 print 提示 WidgetsBinding.instance.addPostFrameCallback((_) { if (mounted) { @@ -190,9 +182,9 @@ class _YxFloatingBallState extends State ); } catch (e) { // 如果 ScaffoldMessenger 也不可用,只打印日志 - print('YxNetInspector: 无法显示检查器面板 - 请确保在 MaterialApp 内使用'); + debugPrint('YxNetInspector: 无法显示检查器面板 - 请确保在 MaterialApp 内使用'); } - + // 重置状态 setState(() { _isExpanded = false; diff --git a/lib/src/yx_net_inspector_app.dart b/lib/src/yx_net_inspector_app.dart index 82d3e17..f59fd20 100644 --- a/lib/src/yx_net_inspector_app.dart +++ b/lib/src/yx_net_inspector_app.dart @@ -66,10 +66,6 @@ class _YxNetInspectorState extends State { // 初始化控制器 _controller = YxNetInspectorController.instance; _controller.initialize(widget.config); - - if (kDebugMode) { - debugPrint('🔍 YX Net Inspector: App wrapper initialized'); - } } @override diff --git a/pubspec.yaml b/pubspec.yaml index ccb9858..9248775 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: yx_net_inspector description: A powerful network inspector with floating debug ball for Flutter apps. Monitor HTTP requests, responses, and debug network issues in real-time. -version: 1.0.0 +version: 1.0.2 homepage: https://github.com/your-username/yx_net_inspector environment: @@ -15,4 +15,4 @@ dev_dependencies: flutter_test: sdk: flutter -flutter: +