diff --git a/PLAN.md b/PLAN.md index 3dc9a75..4b6d093 100644 --- a/PLAN.md +++ b/PLAN.md @@ -5,6 +5,16 @@ --- +## 0.7.0 浏览器地址栏菜单与网络说明(分支 `flutter`) + +| 项 | 结果 | +| --- | --- | +| 地址栏 | 后退 / 前进 / 在系统浏览器中打开 / 历史记录收进右上角「三个点」菜单;历史记录是二级菜单(最近 20 条,空时显示「暂无历史记录」)。地址栏只保留网址输入、停止/刷新和菜单,手机宽度下输入区明显变宽 | +| 网络 | 嵌入式 WebView 运行在**手机本机**,`localhost` 是手机而不是 OpenChamber 服务端;OpenChamber 网页端的浏览器面板同样在客户端渲染,服务端没有通用 URL 代理。空状态明确提示:要预览 OpenChamber 主机上的开发服务器,请输入主机的局域网地址(或让服务监听 0.0.0.0) | +| 版本 | **0.7.0(code 700)** | + +--- + ## 0.6.7 右侧栏浏览器与图标标签(分支 `flutter`) | 项 | 结果 | diff --git a/README.md b/README.md index d8f27a8..0e95dc7 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Android first. This branch (`flutter`) is a framework evaluation: the same feature set as the earlier Asuka/Go and MyGo attempts, reimplemented in Flutter to compare mobile UI maturity. -Status: 0.6.7 — servers (passwordless / password login, HTTP/HTTPS and +Status: 0.7.0 — servers (passwordless / password login, HTTP/HTTPS and SOCKS5/socks5h proxy, self-signed certificates and pinning, or a pairing link over the OpenChamber private relay with end-to-end encryption; the pairing link is pasted or scanned with the camera), session list with search and live diff --git a/lib/l10n/zh.dart b/lib/l10n/zh.dart index d91f6bb..36a8bdf 100644 --- a/lib/l10n/zh.dart +++ b/lib/l10n/zh.dart @@ -644,4 +644,6 @@ const Map chineseStrings = { 'History': '历史记录', 'Invalid URL': '无效的网址', 'Could not open the browser: {0}': '无法打开浏览器:{0}', + 'No history': '暂无历史记录', + 'The browser runs on this device; for a dev server on the OpenChamber host, enter the host\'s LAN address.': '浏览器在手机本机网络上运行;要预览 OpenChamber 主机上的开发服务器,请输入该主机的局域网地址。', }; diff --git a/lib/screens/browser_panel.dart b/lib/screens/browser_panel.dart index e4dd759..b142634 100644 --- a/lib/screens/browser_panel.dart +++ b/lib/screens/browser_panel.dart @@ -19,12 +19,6 @@ class BrowserPanel extends StatefulWidget { class _BrowserPanelState extends State { static const MethodChannel _channel = MethodChannel('openchamber/browser'); - static const _quickLinks = [ - 'http://localhost:3000', - 'http://localhost:5173', - 'http://localhost:8080', - ]; - final TextEditingController _url = TextEditingController(); final List _history = []; WebViewController? _web; @@ -212,16 +206,6 @@ class _BrowserPanelState extends State { padding: const EdgeInsets.fromLTRB(4, 6, 4, 6), child: Row( children: [ - IconButton( - icon: const Icon(Icons.arrow_back, size: 20), - tooltip: tr('Back'), - onPressed: _canBack ? () => web?.goBack() : null, - ), - IconButton( - icon: const Icon(Icons.arrow_forward, size: 20), - tooltip: tr('Forward'), - onPressed: _canForward ? () => web?.goForward() : null, - ), Expanded( child: TextField( controller: _url, @@ -249,29 +233,55 @@ class _BrowserPanelState extends State { ? () => web?.runJavaScript('window.stop()') : web?.reload, ), - if (Platform.isAndroid) - IconButton( - icon: const Icon(Icons.open_in_browser, size: 20), - tooltip: tr('Open in system browser'), - onPressed: _openExternal, - ), - if (_history.isNotEmpty) - PopupMenuButton( - icon: const Icon(Icons.history, size: 20), - tooltip: tr('History'), - onSelected: (url) { - _setUrl(url); - _navigate(url); - }, - itemBuilder: (_) => [ - for (final url in _history) - PopupMenuItem( - value: url, - child: Text(url, - maxLines: 1, overflow: TextOverflow.ellipsis), - ), - ], + MenuAnchor( + builder: (context, controller, child) => IconButton( + icon: const Icon(Icons.more_vert, size: 20), + tooltip: tr('More'), + onPressed: () => + controller.isOpen ? controller.close() : controller.open(), ), + menuChildren: [ + MenuItemButton( + leadingIcon: const Icon(Icons.arrow_back, size: 18), + onPressed: _canBack ? () => web?.goBack() : null, + child: const AppText('Back'), + ), + MenuItemButton( + leadingIcon: const Icon(Icons.arrow_forward, size: 18), + onPressed: _canForward ? () => web?.goForward() : null, + child: const AppText('Forward'), + ), + if (Platform.isAndroid) + MenuItemButton( + leadingIcon: const Icon(Icons.open_in_browser, size: 18), + onPressed: _openExternal, + child: const AppText('Open in system browser'), + ), + SubmenuButton( + leadingIcon: const Icon(Icons.history, size: 18), + menuChildren: _history.isEmpty + ? [ + const MenuItemButton( + onPressed: null, + child: AppText('No history'), + ), + ] + : [ + for (final url in _history) + MenuItemButton( + onPressed: () { + _setUrl(url); + _navigate(url); + }, + child: Text(url, + maxLines: 1, + overflow: TextOverflow.ellipsis), + ), + ], + child: const AppText('History'), + ), + ], + ), ], ), ); @@ -323,17 +333,10 @@ class _BrowserPanelState extends State { style: TextStyle(fontSize: 12.5), ), const SizedBox(height: 16), - Wrap( - spacing: 8, - runSpacing: 8, - alignment: WrapAlignment.center, - children: [ - for (final url in _quickLinks) - ActionChip( - label: Text(url), - onPressed: () => _navigate(url), - ), - ], + AppText( + 'The browser runs on this device; for a dev server on the OpenChamber host, enter the host\'s LAN address.', + textAlign: TextAlign.center, + style: TextStyle(fontSize: 11.5, color: theme.hintColor), ), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index a6f6fad..6505239 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -2,7 +2,7 @@ name: openchamber description: "A lightweight OpenChamber client for phones." publish_to: 'none' -version: 0.6.7+607 +version: 0.7.0+700 environment: sdk: ^3.14.0