1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- // 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, [bool? isVariable]) {
- return TextStyle(
- fontFamily: 'RobotoCondensed',
- fontSize: CanvasStyle.getFontSize(elmFontSize),
- letterSpacing: 0,
- color: isVariable != null ? Color(0xFF547190) : null
- );
- }
- 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');
- // }
- // }
|