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/pages/components/vid_image.dart'; import 'package:fis_lib_report/report_edit.dart'; import 'package:fis_lib_report/report_info/report_info.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; @override initState() { onSelect = FEventHandler<String>(); rootBundle.loadString('assets/default.json').then((jsonStr) { setState(() { _jsonStr = jsonStr; }); }); super.initState(); Future.delayed( const Duration(milliseconds: 8000), () => rootBundle.loadString('assets/single_image.json').then((jsonStr) { ReportInfo.instance.reload('', DateTime.now(), jsonStr, onSelect); })); } @override Widget build(BuildContext context) { final demoImags = [ 'http://192.168.6.117:9001/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E8%83%8E%E5%84%BF2.VID', 'http://192.168.6.117:9001/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E8%83%8E%E5%84%BF1.VID', 'http://192.168.6.117:9001/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:9001/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E4%B9%B3%E8%85%BAVideo.VID', 'http://192.168.6.117:9001/Flyinsono-BJ-1300984704.VCS.AP-BeiJing/compress%E9%A2%88%E5%8A%A8%E8%84%89%E6%A8%AA%E5%88%87.VID' ]; return Scaffold( body: Row( children: [ ReportEditPage( reporter: 'Loki', reportDate: DateTime.now(), jsonStr: _jsonStr, onSelect: onSelect, ), 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.network(element), ), ), ); }) ], )), ], ), ); } BoxDecoration _buildDecoration() { return BoxDecoration( border: Border.all( width: 0.5, color: const Color.fromARGB(255, 83, 83, 83), ), color: Colors.white); } }