feat: color a site from its address, and offer a failed web page to the system browser

This commit is contained in:
randogoth 2026-10-11 22:32:44 +03:00
parent 56db479df0
commit 9d9f09ebc7
24 changed files with 597 additions and 25 deletions

View file

@ -114,6 +114,10 @@ class BrowserController {
final backPage = signal<MewsPage?>(null);
final forwardPage = signal<MewsPage?>(null);
/// The address the reader is standing on, which an error page speaks about.
/// Empty when there is nowhere to be yet.
String get currentAddress => _stackIndex >= 0 ? _stack[_stackIndex] : '';
bool get canGoBack => _stackIndex > 0;
bool get canGoForward => _stackIndex >= 0 && _stack.length - 1 > _stackIndex;
@ -176,10 +180,16 @@ class BrowserController {
_stack[_stackIndex] = candidate;
_updateNeighbors();
await _loadCurrent();
// The address as typed is the closer match; keep its error when the
// wap. attempt does not work either.
// The address as followed is the closer match: when the wap.
// attempt does not work either, its error is the one to show and the
// stack goes back to the address the reader followed, so the
// address bar and anything acting on the failure (like opening the
// page in a web browser) speak of the real address, not the guess.
if (error.value != null && firstError != null) {
error.value = firstError;
candidate = url;
_stack[_stackIndex] = url;
_updateNeighbors();
}
}
}

View file

@ -19,7 +19,7 @@ class ReaderSettingsController {
/// setting arrives as a link the reader can also type, so a value outside
/// these lists is refused rather than stored.
static const themeModes = ['light', 'dark', 'system'];
static const variants = ['site', 'warm', 'cool', 'green', 'mono'];
static const variants = ['site', 'host', 'warm', 'cool', 'green', 'mono'];
final font = signal(defaultFontFamily);
final fontScale = signal(1.0);