35 lines
940 B
Dart
35 lines
940 B
Dart
import 'package:flutter/material.dart';
|
|
import 'package:google_fonts/google_fonts.dart';
|
|
|
|
/// Cache TextStyle courier prime agar tidak dibuat ulang tiap rebuild.
|
|
/// Dipakai bersama oleh semua widget struk untuk konsistensi tema.
|
|
class CourierStyles {
|
|
static TextStyle? _base;
|
|
static TextStyle? _bold;
|
|
|
|
static TextStyle get base {
|
|
if (_base != null) return _base!;
|
|
try {
|
|
_base = GoogleFonts.courierPrime(
|
|
textStyle: const TextStyle(fontSize: 14, height: 1.2),
|
|
);
|
|
} catch (_) {
|
|
_base = const TextStyle(
|
|
fontFamily: 'CourierPrime, Courier, monospace',
|
|
fontSize: 14,
|
|
height: 1.2,
|
|
);
|
|
}
|
|
return _base!;
|
|
}
|
|
|
|
static TextStyle get bold {
|
|
if (_bold != null) return _bold!;
|
|
_bold = base.copyWith(fontWeight: FontWeight.bold);
|
|
return _bold!;
|
|
}
|
|
|
|
/// Variabel ukuran lebih besar untuk total.
|
|
static TextStyle get big => bold.copyWith(fontSize: 16);
|
|
}
|