nandi/frqpublic Fork 0
claude/ci-image-modal-deploy-f0f1d9
Commits
Clone
git clone https://git.rickub.com/nandi/frq.git
git clone ssh://git@rickub.com/nandi/frq.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

host_io.dart · 43 lines · 1.6 KBDart Blame HistoryRaw
A web version, from the same core 23846db nandi 7h ago1/// The two things the renderer and the entry point want from the platform,
2/// on a platform that has them.
3///
4/// Both are small and neither is worth a package. What they have in common is
5/// that a browser has neither: there is no environment to read and no file to
6/// open, and `dart:io` cannot even be imported there — so the import lives
7/// here, behind the conditional in `host.dart`.
8library;
9
10import 'dart:io';
11
12import 'package:flutter/widgets.dart';
13
14/// An environment variable, or [fallback].
15String envOr(String name, String fallback) =>
16 Platform.environment[name] ?? fallback;
17
18/// A picture from the filesystem — an attachment the reader picked, before it
19/// has been uploaded anywhere.
20ImageProvider? localImage(String path) => FileImage(File(path));
21
22/// A picture from the network.
23///
24/// The plain widget here. The web needs a different one, and the difference
25/// is not cosmetic — see `host_web.dart`.
26Widget networkImage(String url,
27 {BoxFit fit = BoxFit.contain,
28 Widget Function()? onError}) =>
29 Image.network(url,
30 fit: fit,
31 errorBuilder: (_, _, _) =>
32 onError == null ? const SizedBox.shrink() : onError());
33
34/// The families to ask for when a widget is nothing but an emoji.
35///
36/// Naming one matters here: a glyph like ✏️ is U+270F plus a variation
37/// selector, and DejaVu Sans claims U+270F — so ordinary fallback draws the
38/// monochrome pencil and never reaches the colour font.
39const List<String> emojiFonts = <String>[
40 'Noto Color Emoji', // Linux, Android
41 'Apple Color Emoji', // macOS, iOS
42 'Segoe UI Emoji', // Windows
43];