ANTIPALSU Label template editor using flutter

canvas_style.dart 1.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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) {
  32. return TextStyle(
  33. fontFamily: 'RobotoCondensed',
  34. fontSize: CanvasStyle.getFontSize(elmFontSize),
  35. letterSpacing: 0
  36. );
  37. }
  38. static double getQrSize(int elmQrScale) {
  39. return qrSizeMap[elmQrScale] ?? qrSizeFallback;
  40. }
  41. }
  42. // void main() {
  43. // int elmFontSize = 2;
  44. // print(CanvasStyle.fontSizeMap[elmFontSize]);
  45. // elmFontSize -= 1;
  46. // print(CanvasStyle.fontSizeMap[elmFontSize]);
  47. // if (CanvasStyle.fontSizeMap.containsKey(elmFontSize)) {
  48. // print('resize');
  49. // } else {
  50. // print('cant resize');
  51. // }
  52. // }