// Yukart display: the tablet app. Starts the link to the Orin and hands the screen to // the shell (lib/shell.dart). Code layout: lib/README.md. import 'dart:async'; import 'package:flutter/material.dart'; import 'link/boundary.dart'; import 'link/net.dart'; import 'pages/link_test.dart'; import 'shell.dart'; import 'shell_scope.dart'; import 'theme/light.dart'; import 'theme/palette.dart'; import 'theme/sun.dart'; /// Override for development, e.g. `--dart-define=YUKART_GW=ws://halogen.local:7700/`. const defaultUrl = String.fromEnvironment( 'YUKART_GW', defaultValue: 'ws://192.168.55.1:7700/', ); Future main() async { WidgetsFlutterBinding.ensureInitialized(); final themes = await Themes.load() ..followLight(lightLevels()); final usb = UsbLink(); await usb.bindFor(Uri.parse(defaultUrl)); final boundary = Boundary(defaultUrl)..start(); // The sun, for auto dark/bright: the tablet's own location, every minute until there // is one (the first ask brings up the permission), then every ten. Future locate() async { final p = await androidLocation(); if (p != null) themes.setPosition(p.$1, p.$2); Timer(Duration(minutes: p == null ? 1 : 10), locate); } locate(); final linkTest = LinkTest(usb); // Development hook: `am start ... --es linktest [dl:|bi:]