o2.dart 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. import 'package:flutter/material.dart';
  2. import 'package:flutter/services.dart';
  3. ///
  4. /// 主题色
  5. ///
  6. const String blueThemeKey = 'blue';
  7. const String redThemeKey = 'red';
  8. const Color o2Red = Color.fromARGB(255, 251, 71, 71);
  9. const Color o2Blue = Color.fromARGB(255, 0, 139, 230);
  10. const Color o2Dark = Color.fromARGB(255, 58, 60, 65);
  11. final MaterialColor o2RedSwatch = MaterialColor(o2Red.value,
  12. const <int, Color>{
  13. 50: o2Red,
  14. 100: o2Red,
  15. 200: o2Red,
  16. 300: o2Red,
  17. 400: o2Red,
  18. 500: o2Red,
  19. 600: o2Red,
  20. 700: o2Red,
  21. 800: o2Red,
  22. 900: o2Red,
  23. },
  24. );
  25. final MaterialColor o2BlueSwatch = MaterialColor(o2Blue.value,
  26. const <int, Color>{
  27. 50: o2Blue,
  28. 100: o2Blue,
  29. 200: o2Blue,
  30. 300: o2Blue,
  31. 400: o2Blue,
  32. 500: o2Blue,
  33. 600: o2Blue,
  34. 700: o2Blue,
  35. 800: o2Blue,
  36. 900: o2Blue,
  37. },
  38. );
  39. ///
  40. /// web服务器上下文
  41. ///
  42. const String o2_desktop_context = 'x_desktop';
  43. ///
  44. /// o2服务器返回成功标记
  45. ///
  46. const String o2_http_success = 'success';
  47. ///
  48. /// 每页数量
  49. ///
  50. const int default_page_size = 30;
  51. ///
  52. /// 分页查询第一页 标记
  53. ///
  54. const String firstPageId = '(0)';
  55. ///
  56. /// native通道
  57. ///
  58. const String native_channel_name = 'net.o2oa.flutter/native_get';
  59. ///
  60. /// native传输的方法名称
  61. ///
  62. // 获取配置信息 包括user、unit、webServer、assembleServer
  63. const String method_name_o2_config = 'o2Config';
  64. ///
  65. /// native传输的方法名称
  66. /// 这个方法调用原生代码 打开图片选择器
  67. const String method_name_o2_pick_image = 'o2PickImage';
  68. ///
  69. /// native传输的字段key
  70. ///
  71. // 主题色 blue red
  72. const String param_name_o2_theme = 'o2Theme';
  73. // user json字段
  74. const String param_name_o2_user = 'o2UserInfo';
  75. // unit json字段
  76. const String param_name_o2_unit = 'o2UnitInfo';
  77. // web server json字段
  78. const String param_name_o2_center_server = 'o2CenterServerInfo';
  79. const String param_name_o2_picker_image_file = 'file';
  80. class O2MethodChannelManager {
  81. static final O2MethodChannelManager _instance = O2MethodChannelManager._internal();
  82. // 私有化
  83. O2MethodChannelManager._internal();
  84. static O2MethodChannelManager get instance => _instance;
  85. late MethodChannel methodChannel;
  86. void initMethodChannel() {
  87. //创建一个通道,通道的name字符串要和Native端的一样
  88. methodChannel = const MethodChannel(native_channel_name);
  89. }
  90. }