Files
openchamber-android-native/lib/main.dart
T
blumia 60d02083d3 feat: a transport seam, image previews, native forms, a phone drawer
- lib/api/transport.dart: TransportRequest/TransportResponse/Transport, with
  DirectTransport holding the old behaviour (HTTP CONNECT, SOCKS5/socks5h,
  self-signed and pinned certificates). Client goes through it, so a relay
  tunnel only adds an implementation.
- User rows decode the server's inline attachment data and open the shared
  image preview on tap; the local path stays the fallback.
- The agent's native forms: models from @opencode/client, the form list,
  replies and cancels, form.* events, and a dock above the composer with
  when-rules and required-field validation (a switch must be on).
- HomeScreen: the session list is the phone's left drawer and a persistent
  column from 840 px, the chat beside it; the newest session opens on start.
- 0.3.10 (310).
2026-11-21 01:16:10 +08:00

71 lines
1.8 KiB
Dart

import 'package:flutter/material.dart';
import 'screens/home_screen.dart';
import 'screens/servers_screen.dart';
import 'state.dart';
void main() {
runApp(const OpenChamberApp());
}
class OpenChamberApp extends StatefulWidget {
const OpenChamberApp({super.key});
@override
State<OpenChamberApp> createState() => _OpenChamberAppState();
}
class _OpenChamberAppState extends State<OpenChamberApp>
with WidgetsBindingObserver {
final AppState app = AppState();
@override
void initState() {
super.initState();
WidgetsBinding.instance.addObserver(this);
app.init();
}
@override
void dispose() {
WidgetsBinding.instance.removeObserver(this);
super.dispose();
}
@override
void didChangeAppLifecycleState(AppLifecycleState state) {
// The socket often dies while the app sits in the background; nothing
// reports it, so reopen the stream and refresh the open chat on return.
if (state == AppLifecycleState.resumed) app.onResumed();
}
@override
Widget build(BuildContext context) {
return ListenableBuilder(
listenable: app,
builder: (context, _) {
final home = app.client == null
? ServersScreen(app: app)
: HomeScreen(app: app);
return MaterialApp(
title: 'OpenChamber',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF6C5CE7),
brightness: Brightness.light,
),
useMaterial3: true,
),
darkTheme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: const Color(0xFF6C5CE7),
brightness: Brightness.dark,
),
useMaterial3: true,
),
home: home,
);
},
);
}
}