flir_plugin 0.1.0 flir_plugin: ^0.1.0 copied to clipboard
Flutter Plugin for FLIR Camera (USB)
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flir_plugin/flir_plugin.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
String _imageFile = "";
// String _platformVersion = 'Unknown';
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
title: const Text('Flir Plugin example app'),
),
body: Center(
child: _previewImage(),
),
floatingActionButton: Column(
mainAxisAlignment: MainAxisAlignment.end,
children: [
FloatingActionButton(
onPressed: () {
launchFlirCamera();
},
child: Icon(Icons.camera_alt),
),
],
),
),
);
}
void launchFlirCamera() async {
final file = await FlirPlugin.getCameraImage();
setState(() {
_imageFile = file;
});
}
Widget _previewImage() {
if (_imageFile != null && _imageFile.isNotEmpty) {
return Semantics(
child: Image.file(
File(_imageFile),
),
label: "flir_plugin_image",
);
} else {
return Text("No image found!");
}
}
}