From 0b4478cf6c0eb509c95a9bec2cc7bda37b259e10 Mon Sep 17 00:00:00 2001
From: 905086 <k2049@qq.com>
Date: Sat, 07 Nov 2026 19:06:06 +0800
Subject: [PATCH] feat: 新增工具管理功能及工具下载安装流程

---
 fluttergamebox/lib/widgets/info_dialogs.dart |  100 ++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 93 insertions(+), 7 deletions(-)

diff --git a/fluttergamebox/lib/widgets/info_dialogs.dart b/fluttergamebox/lib/widgets/info_dialogs.dart
index 58950ab..e0ca214 100644
--- a/fluttergamebox/lib/widgets/info_dialogs.dart
+++ b/fluttergamebox/lib/widgets/info_dialogs.dart
@@ -3,6 +3,7 @@
 import 'package:file_picker/file_picker.dart';
 import 'package:flutter/material.dart';
 import 'package:fluttergamebox/common/theme.dart';
+import 'package:fluttergamebox/utils/network_info.dart';
 import 'package:fluttergamebox/utils/util.dart';
 
 String _wmic(String cmd, String arg) {
@@ -45,14 +46,99 @@
   return '00326-60000-00000-AA068';
 }
 
-/// 电脑网络信息弹窗
+/// 电脑网络信息弹窗(获取真实网络信息)
 void showNetworkInfoDialog(BuildContext context) {
-  final lines = [
-    '公网IP: 获取中...',
-    '地区: 中国',
-    '运营商: 联通',
-  ];
-  _greenInfoDialog(context, '电脑网络信息', Icons.wifi, lines);
+  showDialog(
+    context: context,
+    builder: (context) => const _NetworkInfoDialog(),
+  );
+}
+
+class _NetworkInfoDialog extends StatefulWidget {
+  const _NetworkInfoDialog();
+  @override
+  State<_NetworkInfoDialog> createState() => _NetworkInfoDialogState();
+}
+
+class _NetworkInfoDialogState extends State<_NetworkInfoDialog> {
+  List<String> _lines = ['正在获取网络信息...'];
+
+  @override
+  void initState() {
+    super.initState();
+    _load();
+  }
+
+  Future<void> _load() async {
+    final n = await getNetworkInfo();
+    final lines = [
+      '连接方式: ${n.connType}',
+      '内网IP: ${n.localIp}',
+      '网关: ${n.gateway}',
+      'DNS: ${n.dns}',
+      '公网IP: ${n.publicIp}',
+      '地区: ${n.location}',
+      '运营商: ${n.isp}',
+    ];
+    if (mounted) setState(() => _lines = lines);
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Dialog(
+      backgroundColor: const Color(0xFF14161F),
+      shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(6)),
+      child: Container(
+        width: 420,
+        padding: EdgeInsets.zero,
+        child: Column(
+          mainAxisSize: MainAxisSize.min,
+          children: [
+            // 标题栏
+            Container(
+              height: 40,
+              padding: const EdgeInsets.symmetric(horizontal: 12),
+              decoration: BoxDecoration(
+                color: const Color(0xFF191C2B),
+                borderRadius:
+                    const BorderRadius.vertical(top: Radius.circular(6)),
+              ),
+              child: Row(
+                children: [
+                  const Icon(Icons.wifi, size: 16, color: AppColors.textGray),
+                  const SizedBox(width: 8),
+                  const Text('电脑网络信息',
+                      style: TextStyle(color: Colors.white, fontSize: 13)),
+                  const Spacer(),
+                  GestureDetector(
+                    onTap: () => Navigator.pop(context),
+                    child: const Icon(Icons.close,
+                        size: 16, color: AppColors.textGray),
+                  ),
+                ],
+              ),
+            ),
+            Padding(
+              padding: const EdgeInsets.all(20),
+              child: Column(
+                crossAxisAlignment: CrossAxisAlignment.start,
+                children: _lines
+                    .map((l) => Padding(
+                          padding: const EdgeInsets.symmetric(vertical: 3),
+                          child: Text(l,
+                              style: const TextStyle(
+                                  color: Color(0xFF33FF66),
+                                  fontSize: 13,
+                                  fontFamily: 'Consolas')),
+                        ))
+                    .toList(),
+              ),
+            ),
+          ],
+        ),
+      ),
+    );
+  }
 }
 
 void _greenInfoDialog(

--
Gitblit v1.10.0