12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- // import 'package:flutter/material.dart';
- import 'package:flutter/material.dart';
- class CanvasStyle {
- static double fontSizeFallback = 18;
- static double qrSizeFallback = 82;
- static Map<int, double> fontSizeMap = {
- 1: 18,
- 2: 25,
- 3: 31.5,
- 4: 37,
- 5: 43,
- 6: 50,
- 7: 57,
- 8: 63.5,
- 9: 70
- };
- static Map<int, double> qrSizeMap = {
- 1: 82,
- 2: 124,
- 3: 164,
- 4: 204,
- 5: 248,
- 6: 286,
- 7: 330,
- 8: 370,
- 9: 412
- };
- static double getFontSize(int elmFontSize) {
- return fontSizeMap[elmFontSize] ?? fontSizeFallback;
- }
- static TextStyle getTextStyle(int elmFontSize) {
- return TextStyle(
- fontFamily: 'RobotoCondensed',
- fontSize: CanvasStyle.getFontSize(elmFontSize),
- letterSpacing: 0
- );
- }
- static double getQrSize(int elmQrScale) {
- return qrSizeMap[elmQrScale] ?? qrSizeFallback;
- }
- }
- // void main() {
- // int elmFontSize = 2;
- // print(CanvasStyle.fontSizeMap[elmFontSize]);
- // elmFontSize -= 1;
- // print(CanvasStyle.fontSizeMap[elmFontSize]);
- // if (CanvasStyle.fontSizeMap.containsKey(elmFontSize)) {
- // print('resize');
- // } else {
- // print('cant resize');
- // }
- // }
|