diff --git a/lib/colors.dart b/lib/colors.dart new file mode 100644 index 0000000..b78fab6 --- /dev/null +++ b/lib/colors.dart @@ -0,0 +1,6 @@ +import 'package:flutter/material.dart'; + +class Palette { + static const defaultBg = Colors.black; + static const defaultFg = Colors.white; +} diff --git a/lib/main.dart b/lib/main.dart index 1348cc4..2b908d1 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,3 +1,4 @@ +import 'package:dartterm/colors.dart'; import 'package:dartterm/terminal.dart'; import 'package:flutter/material.dart'; import 'package:flutter/scheduler.dart'; @@ -14,9 +15,7 @@ class App extends StatelessWidget { return MaterialApp( title: 'DARTTERM', theme: ThemeData( - colorScheme: ColorScheme.fromSeed(seedColor: Colors.red), - useMaterial3: true, - ), + useMaterial3: true, scaffoldBackgroundColor: Palette.defaultBg), builder: (BuildContext context, Widget? child) { return MediaQuery( data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0), @@ -46,10 +45,11 @@ class _ViewerState extends State { @override Widget build(BuildContext context) { - return Center( - child: - AspectRatio(aspectRatio: 16 / 9.0, child: terminal.toWidget(context)), - ); + return Scaffold( + body: Center( + child: AspectRatio( + aspectRatio: width / height, child: terminal.toWidget(context)), + )); } void tick(Duration elapsed) { diff --git a/lib/terminal.dart b/lib/terminal.dart index 818305b..c04425e 100644 --- a/lib/terminal.dart +++ b/lib/terminal.dart @@ -1,11 +1,12 @@ +import 'package:dartterm/colors.dart'; import 'package:dartterm/cp437.dart'; import 'package:dartterm/fonts.dart'; import 'package:dartterm/terminal_painter.dart'; import 'package:flutter/material.dart'; class Terminal { - static const int width = 96; - static const int height = 54; + static const int width = 60; + static const int height = 32; static const int cellW = 64; static const int cellH = 64; static const int nTiles = width * height; @@ -74,7 +75,7 @@ class Tile { Tile(this.content, this.bg, this.fg); - static Tile empty() => Tile(null, Colors.black, Colors.white); + static Tile empty() => Tile(null, Palette.defaultBg, Palette.defaultFg); } class Content { diff --git a/lib/terminal_painter.dart b/lib/terminal_painter.dart index 5fc7681..ca7f532 100644 --- a/lib/terminal_painter.dart +++ b/lib/terminal_painter.dart @@ -139,6 +139,9 @@ class ImageTodos { void add(Rect src, Rect dst, Color color) { // NOTE: Because main.dart uses aspectRatio, scaleX and scaleY should be close to the same var scaleX = dst.width / src.width; + // dst.width / src.width; + // log("scaleX: $scaleX ($dstWidth, $srcWidth)"); + // var scaleY = dst.height / src.height; transforms.add(RSTransform.fromComponents( rotation: 0.0,