More color consistency
This commit is contained in:
parent
af13df1c7b
commit
a1c3ea5fce
6
lib/colors.dart
Normal file
6
lib/colors.dart
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
class Palette {
|
||||||
|
static const defaultBg = Colors.black;
|
||||||
|
static const defaultFg = Colors.white;
|
||||||
|
}
|
@ -1,3 +1,4 @@
|
|||||||
|
import 'package:dartterm/colors.dart';
|
||||||
import 'package:dartterm/terminal.dart';
|
import 'package:dartterm/terminal.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
@ -14,9 +15,7 @@ class App extends StatelessWidget {
|
|||||||
return MaterialApp(
|
return MaterialApp(
|
||||||
title: 'DARTTERM',
|
title: 'DARTTERM',
|
||||||
theme: ThemeData(
|
theme: ThemeData(
|
||||||
colorScheme: ColorScheme.fromSeed(seedColor: Colors.red),
|
useMaterial3: true, scaffoldBackgroundColor: Palette.defaultBg),
|
||||||
useMaterial3: true,
|
|
||||||
),
|
|
||||||
builder: (BuildContext context, Widget? child) {
|
builder: (BuildContext context, Widget? child) {
|
||||||
return MediaQuery(
|
return MediaQuery(
|
||||||
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
|
data: MediaQuery.of(context).copyWith(textScaleFactor: 1.0),
|
||||||
@ -46,10 +45,11 @@ class _ViewerState extends State<Viewer> {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Center(
|
return Scaffold(
|
||||||
child:
|
body: Center(
|
||||||
AspectRatio(aspectRatio: 16 / 9.0, child: terminal.toWidget(context)),
|
child: AspectRatio(
|
||||||
);
|
aspectRatio: width / height, child: terminal.toWidget(context)),
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
void tick(Duration elapsed) {
|
void tick(Duration elapsed) {
|
||||||
|
@ -1,11 +1,12 @@
|
|||||||
|
import 'package:dartterm/colors.dart';
|
||||||
import 'package:dartterm/cp437.dart';
|
import 'package:dartterm/cp437.dart';
|
||||||
import 'package:dartterm/fonts.dart';
|
import 'package:dartterm/fonts.dart';
|
||||||
import 'package:dartterm/terminal_painter.dart';
|
import 'package:dartterm/terminal_painter.dart';
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
class Terminal {
|
class Terminal {
|
||||||
static const int width = 96;
|
static const int width = 60;
|
||||||
static const int height = 54;
|
static const int height = 32;
|
||||||
static const int cellW = 64;
|
static const int cellW = 64;
|
||||||
static const int cellH = 64;
|
static const int cellH = 64;
|
||||||
static const int nTiles = width * height;
|
static const int nTiles = width * height;
|
||||||
@ -74,7 +75,7 @@ class Tile {
|
|||||||
|
|
||||||
Tile(this.content, this.bg, this.fg);
|
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 {
|
class Content {
|
||||||
|
@ -139,6 +139,9 @@ class ImageTodos {
|
|||||||
void add(Rect src, Rect dst, Color color) {
|
void add(Rect src, Rect dst, Color color) {
|
||||||
// NOTE: Because main.dart uses aspectRatio, scaleX and scaleY should be close to the same
|
// NOTE: Because main.dart uses aspectRatio, scaleX and scaleY should be close to the same
|
||||||
var scaleX = dst.width / src.width;
|
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(
|
transforms.add(RSTransform.fromComponents(
|
||||||
rotation: 0.0,
|
rotation: 0.0,
|
||||||
|
Loading…
Reference in New Issue
Block a user