main.dart 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. import 'package:ecg_list_view/rpc/rpc_bridge.dart';
  2. import 'package:flutter/material.dart';
  3. import 'package:get/get.dart';
  4. import 'package:fis_common/logger/logger.dart';
  5. import 'package:fis_jsonrpc/rpc.dart';
  6. import 'ecg_list/controller.dart';
  7. import 'ecg_list/view.dart';
  8. void main() async {
  9. WidgetsFlutterBinding.ensureInitialized();
  10. await Global.init();
  11. runApp(const MyApp());
  12. }
  13. class Global {
  14. static init() async {
  15. await logger.init();
  16. var rpc = JsonRpcProxy(host: "platform.xinglinghui.com:9308");
  17. rpc.setServerHost("platform.xinglinghui.com:9308", true);
  18. Get.put(RPCBridge(rpc, "2507110B51FA453BA0472EDD76DDFB78"));
  19. }
  20. }
  21. class MyApp extends StatelessWidget {
  22. const MyApp({super.key});
  23. // This widget is the root of your application.
  24. @override
  25. Widget build(BuildContext context) {
  26. return GetMaterialApp(
  27. title: "心电列表模块",
  28. routes: {
  29. "/mainPage": (context) => EcgListPage(
  30. onEditReport: _test,
  31. onExam: (p, q) {},
  32. ),
  33. "/home": (context) => const MyHomePage()
  34. },
  35. initialRoute: '/home',
  36. theme: ThemeData(
  37. primarySwatch: Colors.blue,
  38. ),
  39. home: const MyHomePage(),
  40. );
  41. }
  42. void _test(String p1, ElectrocardiogramRecord p2) {}
  43. }
  44. class MyHomePage extends StatefulWidget {
  45. const MyHomePage({super.key});
  46. @override
  47. State<MyHomePage> createState() => _MyHomePageState();
  48. }
  49. class _MyHomePageState extends State<MyHomePage> {
  50. @override
  51. void initState() {
  52. super.initState();
  53. }
  54. @override
  55. Widget build(BuildContext context) {
  56. return Container(
  57. color: Colors.white,
  58. child: Center(
  59. child: ElevatedButton(
  60. onPressed: () {
  61. Get.toNamed("/mainPage");
  62. },
  63. child: const Text("test"),
  64. ),
  65. ),
  66. );
  67. }
  68. }