feat: browser navigation moves into a menu, and a note on the network

- back, forward, open in the system browser and history now live in the
  address bar's three-dot menu; history is a submenu (last 20 URLs, or a
  disabled "no history" row), leaving the URL field wide enough on a phone
- the browser runs on the phone's network: localhost is the phone, not the
  OpenChamber host; the empty state says so and points at the host's LAN
  address for server-side dev servers
- version 0.7.0+700
This commit is contained in:
blumia committed 2026-12-04 09:29:02 +08:00
1 parent ce944751b4
commit 318276d3b9
5 files changed
+66 -51

No files matched your search

+10
View File
@@ -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`)
| 项 | 结果 |
+1 -1
View File
@@ -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
+2
View File
@@ -644,4 +644,6 @@ const Map<String, String> 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 主机上的开发服务器,请输入该主机的局域网地址。',
};
+52 -49
View File
@@ -19,12 +19,6 @@ class BrowserPanel extends StatefulWidget {
class _BrowserPanelState extends State<BrowserPanel> {
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<String> _history = [];
WebViewController? _web;
@@ -212,16 +206,6 @@ class _BrowserPanelState extends State<BrowserPanel> {
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<BrowserPanel> {
? () => 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<String>(
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<BrowserPanel> {
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),
),
],
),
+1 -1
View File
@@ -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