import 'package:dartterm/colors.dart'; import 'package:dartterm/input.dart' as input; import 'package:dartterm/game/game.dart' as game; import 'package:dartterm/terminal.dart' as terminal; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); game.main(); runApp(const App()); } class App extends StatelessWidget { const App({super.key}); @override Widget build(BuildContext context) { return MaterialApp( title: 'DARTTERM', theme: ThemeData( useMaterial3: true, scaffoldBackgroundColor: Palette.defaultBg), builder: (BuildContext context, Widget? child) { return MediaQuery( data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), child: child!); }, home: const Viewer(), ); } } class Viewer extends StatefulWidget { const Viewer({super.key}); @override State createState() => _ViewerState(); } class _ViewerState extends State { Ticker? ticker; @override void initState() { super.initState(); ticker = Ticker(tick); ticker!.start(); input.startListening(); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: AspectRatio( aspectRatio: terminal.width / terminal.height, child: terminal.toWidget(context)), )); } void tick(Duration elapsed) { setState(() {/* state changed, force a redraw */}); } }