main.dart 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  1. import 'dart:convert';
  2. import 'dart:ui';
  3. import 'package:fis_common/helpers/http.dart';
  4. import 'package:fis_common/index.dart';
  5. import 'package:fis_common/logger/logger.dart';
  6. import 'package:fis_jsonrpc/rpc.dart';
  7. import 'package:fis_measure/measure_page_test.dart';
  8. import 'package:fis_measure/process/layout/configuration.dart';
  9. import 'package:fis_measure/view/measure/measure_view.dart';
  10. import 'package:fis_vid/index.dart';
  11. import 'package:flutter/material.dart';
  12. import 'package:flutter/services.dart';
  13. import 'package:get/get.dart';
  14. import 'package:fis_i18n/i18n.dart';
  15. import 'item_create_test.dart';
  16. void main() async {
  17. WidgetsFlutterBinding.ensureInitialized();
  18. logger.setMinimumLevel(LogLevel.UserOperate);
  19. await logger.init();
  20. await _initI18n();
  21. await LayoutConfiguration.ins.loadData();
  22. // LayoutConfiguration.ins.getRect("")
  23. runApp(const MyApp());
  24. }
  25. class MyApp extends StatelessWidget {
  26. const MyApp({Key? key}) : super(key: key);
  27. @override
  28. Widget build(BuildContext context) {
  29. return MaterialApp(
  30. debugShowCheckedModeBanner: false,
  31. title: 'Flutter Demo',
  32. theme: ThemeData(
  33. primarySwatch: Colors.blue,
  34. ),
  35. home: const MyHomePage(title: 'Flutter Demo Home Page'),
  36. // home: ImageDemoPage(),
  37. );
  38. }
  39. }
  40. class MyHomePage extends StatefulWidget {
  41. const MyHomePage({Key? key, required this.title}) : super(key: key);
  42. final String title;
  43. @override
  44. State<MyHomePage> createState() => _MyHomePageState();
  45. }
  46. class _MyHomePageState extends State<MyHomePage> {
  47. void _incrementCounter() {}
  48. String _playerBtnText = "Player";
  49. @override
  50. Widget build(BuildContext context) {
  51. return Scaffold(
  52. appBar: AppBar(
  53. title: Text(widget.title),
  54. ),
  55. body: Center(
  56. child: Column(
  57. mainAxisAlignment: MainAxisAlignment.center,
  58. children: <Widget>[
  59. ElevatedButton(
  60. onPressed: () {
  61. // ThirdPartVidTest().run();
  62. // ItemCreateTest().run();
  63. },
  64. child: const Text("Function Test"),
  65. ),
  66. const SizedBox(height: 10),
  67. ElevatedButton(
  68. onPressed: () async {
  69. setState(() {
  70. _playerBtnText = "Player loading...";
  71. });
  72. if (MeasureTestPage.MetaDTOList.isEmpty) {
  73. final txt = await FHttpHelper.downloadString(
  74. ItemCreateTest.C_JSON_PATH);
  75. MeasureTestPage.MetaDTOList =
  76. jsonDecode(txt ?? '[]') as List<dynamic>;
  77. }
  78. setState(() {
  79. _playerBtnText = "Player";
  80. });
  81. Navigator.of(context).push(
  82. MaterialPageRoute(
  83. builder: (context) => const MeasureTestPage(),
  84. ),
  85. );
  86. // MeasureController("").load();
  87. // const url =
  88. // "http://192.168.6.117:9001/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/default.VID";
  89. // // final isMobile = Platform.isAndroid || Platform.isIOS;
  90. // Navigator.of(context).push(
  91. // MaterialPageRoute(
  92. // builder: (_) => VidPlayerPage(url),
  93. // // !kIsWeb ? VidPlayerMobilePage(url) : VidPlayerPage(url),
  94. // ),
  95. // );
  96. },
  97. child: Text(_playerBtnText),
  98. ),
  99. const SizedBox(
  100. height: 15,
  101. ),
  102. ElevatedButton(
  103. onPressed: () {
  104. Navigator.of(context).push(
  105. MaterialPageRoute(
  106. builder: (context) => const MeasureMainPage(
  107. '50BB5ED499304A8C8BD77B39CBCF596E',
  108. 'RecordInfoDO_20220811025200rOow04',
  109. 'PatientInfoDO_202208110311443tup96',
  110. 'RemedicalDO_20220811025202y3u0Rc'),
  111. ),
  112. );
  113. },
  114. child: const Text("Measure image"),
  115. ),
  116. ],
  117. ),
  118. ),
  119. floatingActionButton: FloatingActionButton(
  120. onPressed: _incrementCounter,
  121. tooltip: 'Increment',
  122. child: const Icon(Icons.add),
  123. ), // This trailing comma makes auto-formatting nicer for build methods.
  124. );
  125. }
  126. }
  127. Future<void> _initI18n() async {
  128. final curLocale = window.locale;
  129. var bookOptions = [
  130. FTrKeybookOption.ChineseOption,
  131. FTrKeybookOption.EnglishOption,
  132. ];
  133. await FI18n.init((locale) => Get.updateLocale(locale), bookOptions);
  134. await FI18n.load(curLocale);
  135. Get.put(FI18n.ins);
  136. }