Skip to content

Instantly share code, notes, and snippets.

import 'package:flutter/material.dart';
import 'dart:math' as math;
class BndBox extends StatelessWidget {
final List<dynamic> results;
final int previewH;
final int previewW;
final double screenH;
final double screenW;
final String model;
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:tflite/tflite.dart';
import 'dart:math' as math;
typedef void Callback(List<dynamic> list, int h, int w);
class Camera extends StatefulWidget {
final List<CameraDescription> cameras;
final Callback setRecognitions;
import 'package:flutter/material.dart';
import 'package:camera/camera.dart';
import 'package:tflite/tflite.dart';
import 'dart:math' as math;
import 'camera.dart';
import 'bndbox.dart';
import 'models.dart';
class HomePage extends StatefulWidget {
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:tflite/tflite.dart';
void main() => runApp(MaterialApp(
home: MyApp(),
));
class MyApp extends StatefulWidget {
class PredictionWidget extends StatelessWidget {
final List<Prediction> predictions;
const PredictionWidget({Key key, this.predictions}) : super(key: key);
Widget _numberWidget(int num, Prediction prediction) {
return Column(
children: <Widget>[
Text(
'$num',
class Prediction {
final double confidence;
final int index;
final String label;
Prediction({this.confidence, this.index, this.label});
factory Prediction.fromJson(Map<dynamic, dynamic> json) {
return Prediction(
confidence: json['confidence'],
final _canvasCullRect = Rect.fromPoints(
Offset(0, 0),
Offset(Constants.imageSize, Constants.imageSize),
);
final _whitePaint = Paint()
..strokeCap = StrokeCap.round
..color = Colors.white
..strokeWidth = Constants.strokeWidth;
class DrawingPainter extends CustomPainter {
final List<Offset> points;
DrawingPainter(this.points);
final Paint _paint = Paint()
..strokeCap = StrokeCap.round
..color = Colors.blue
..strokeWidth = Constants.strokeWidth;
class DrawScreen extends StatefulWidget {
@override
_DrawScreenState createState() => _DrawScreenState();
}
class _DrawScreenState extends State<DrawScreen> {
final _points = List<Offset>();
final _recognizer = Recognizer();
List<Prediction> _prediction;
bool initialize = false;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.