ANTIPALSU Label template editor using flutter

canvas_style.dart 1.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. // import 'package:flutter/material.dart';
  2. import 'package:flutter/material.dart';
  3. class CanvasStyle {
  4. static double fontSizeFallback = 18;
  5. static double qrSizeFallback = 82;
  6. static Map<int, double> fontSizeMap = {
  7. 1: 18,
  8. 2: 25,
  9. 3: 31.5,
  10. 4: 37,
  11. 5: 43,
  12. 6: 50,
  13. 7: 57,
  14. 8: 63.5,
  15. 9: 70
  16. };
  17. static Map<int, double> qrSizeMap = {
  18. 1: 82,
  19. 2: 124,
  20. 3: 164,
  21. 4: 204,
  22. 5: 248,
  23. 6: 286,
  24. 7: 330,
  25. 8: 370,
  26. 9: 412
  27. };
  28. static double getFontSize(int elmFontSize) {
  29. return fontSizeMap[elmFontSize] ?? fontSizeFallback;
  30. }
  31. static TextStyle getTextStyle(int elmFontSize, [bool? isVariable]) {
  32. return TextStyle(
  33. fontFamily: 'RobotoCondensed',
  34. fontSize: CanvasStyle.getFontSize(elmFontSize),
  35. letterSpacing: 0,
  36. color: isVariable != null ? Color(0xFF547190) : null
  37. );
  38. }
  39. static double getQrSize(int elmQrScale) {
  40. return qrSizeMap[elmQrScale] ?? qrSizeFallback;
  41. }
  42. }
  43. // void main() {
  44. // int elmFontSize = 2;
  45. // print(CanvasStyle.fontSizeMap[elmFontSize]);
  46. // elmFontSize -= 1;
  47. // print(CanvasStyle.fontSizeMap[elmFontSize]);
  48. // if (CanvasStyle.fontSizeMap.containsKey(elmFontSize)) {
  49. // print('resize');
  50. // } else {
  51. // print('cant resize');
  52. // }
  53. // }