123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- import 'dart:convert';
- import 'package:fis_lib_report/converts/event_type.dart';
- import 'package:fis_lib_report/converts/pt_to_px_converter.dart';
- import 'package:fis_lib_report/report_edit.dart';
- import 'package:fis_lib_report/report_info/element_tag_names.dart';
- import 'package:fis_lib_report/report_info/input_text_info.dart';
- import 'package:fis_lib_report/report_info/report_info.dart';
- import 'package:fis_ui/business/vid_img_view/index.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter/services.dart';
- void main() {
- runApp(const MyApp());
- }
- class MyApp extends StatelessWidget {
- const MyApp({Key? key}) : super(key: key);
- // This widget is the root of your application.
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Flutter Demo',
- theme: ThemeData(
- // This is the theme of your application.
- //
- // Try running your application with "flutter run". You'll see the
- // application has a blue toolbar. Then, without quitting the app, try
- // changing the primarySwatch below to Colors.green and then invoke
- // "hot reload" (press "r" in the console where you ran "flutter run",
- // or simply save your changes to "hot reload" in a Flutter IDE).
- // Notice that the counter didn't reset back to zero; the application
- // is not restarted.
- primarySwatch: Colors.blue,
- ),
- home: const MyHomePage(title: 'Flutter Demo Home Page'),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- const MyHomePage({Key? key, required this.title}) : super(key: key);
- final String title;
- @override
- State<MyHomePage> createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- String _jsonStr = '';
- final EdgeInsetsGeometry _padding =
- EdgeInsets.all(PtToPxConverter.ptToPx(56.83));
- late FEventHandler<String> onSelect;
- String _aiJson = '';
- String _petStr = '';
- String _testStr = '';
- @override
- initState() {
- onSelect = FEventHandler<String>();
- rootBundle.loadString('assets/default.json').then((jsonStr) {
- setState(() {
- _jsonStr = jsonStr;
- });
- });
- rootBundle.loadString('assets/single_image.json').then((jsonStr) {
- _aiJson = jsonStr;
- });
- rootBundle.loadString('assets/pet.json').then((jsonStr) {
- _petStr = jsonStr;
- });
- rootBundle.loadString('assets/test.json').then((jsonStr) {
- _testStr = jsonStr;
- });
- super.initState();
- }
- @override
- Widget build(BuildContext context) {
- final demoImags = [
- 'http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E8%83%8E%E5%84%BF2.VID',
- 'http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E8%83%8E%E5%84%BF1.VID',
- 'http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E4%B9%B3%E8%85%BA%E5%8D%95%E5%B8%A7%E5%9B%BE.VID',
- 'http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E4%B9%B3%E8%85%BAVideo.VID',
- 'http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E9%A2%88%E5%8A%A8%E8%84%89%E6%A8%AA%E5%88%87.VID',
- "http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/2bf772b058a045f5b7e21466ab5f5d51.VID",
- "http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/381c738696bd4a1fac8d429e4cb01606.VID",
- "http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/7d48f5c52cd4423ba679950869adfadb.VID",
- "http://192.168.6.117:9303/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/5aa0a3f3fe214a0fbdec911321208b6b.VID"
- ];
- return Scaffold(
- backgroundColor: Colors.white,
- body: Row(
- children: [
- if (_jsonStr.isNotEmpty)
- Expanded(
- child: ReportEditPage(
- reporter: 'Loki',
- reportDate: DateTime.now(),
- jsonStr: _jsonStr,
- onSelect: onSelect,
- // patinentAge: '22',
- // patinentId: '20220705',
- // patinentName: 'name',
- // patinentSex: '男',
- ),
- ),
- const SizedBox(width: 40),
- Container(
- decoration: _buildDecoration(),
- padding: _padding,
- alignment: Alignment.center,
- height: 800,
- width: 600,
- child: Wrap(
- children: [
- ...demoImags.map((element) {
- return MouseRegion(
- cursor: SystemMouseCursors.click,
- child: GestureDetector(
- onTap: () {
- onSelect.emit(this, element);
- },
- child: Container(
- margin: const EdgeInsets.all(15),
- child: VidImageView(
- url: element,
- width: 150,
- height: 100,
- ),
- ),
- ),
- );
- })
- ],
- ),
- ),
- SizedBox(
- width: 400,
- child: Wrap(
- children: [
- MaterialButton(
- child: Text('testAI'),
- onPressed: () {
- ReportInfo.instance
- .reload('test', DateTime.now(), _aiJson, onSelect);
- }),
- MaterialButton(
- child: Text('testDefault'),
- onPressed: () {
- ReportInfo.instance.reload(
- 'default', DateTime.now(), _jsonStr, onSelect);
- }),
- MaterialButton(
- child: Text('testPet'),
- onPressed: () {
- ReportInfo.instance
- .reload('pet', DateTime.now(), _petStr, onSelect);
- }),
- MaterialButton(
- child: Text('onClose'),
- onPressed: () {
- ReportInfo.instance.onClose.emit(this, null);
- }),
- MaterialButton(
- child: Text('open'),
- onPressed: () {
- setState(() {});
- }),
- MaterialButton(
- child: const Text('testInfo'),
- onPressed: () {
- final reportMap = jsonDecode(_testStr);
- ReportInfo.instance.fromJson(reportMap);
- }),
- MaterialButton(
- child: const Text('testToJson'),
- onPressed: () {
- ReportInfo.instance.toJson();
- final items = ReportInfo.instance.jsonItems;
- final json = jsonEncode(items);
- print(json);
- }),
- ],
- ),
- ),
- ],
- ),
- );
- }
- BoxDecoration _buildDecoration() {
- return BoxDecoration(
- border: Border.all(
- width: 0.5,
- color: const Color.fromARGB(255, 83, 83, 83),
- ),
- color: Colors.white);
- }
- }
|