refactoring to a widget dir
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
# tensordex_mobile
|
||||
|
||||
Pokedex made using Tensorflow 2.0
|
||||
Pokedex made using Tensorflow 2.9 and flutter 3.0.
|
||||
|
||||
## Getting Started
|
||||
|
||||
This project is a starting point for a Flutter application.
|
||||
|
||||
A few resources to get you started if this is your first Flutter project:
|
||||
|
||||
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
|
||||
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
|
||||
|
||||
For help getting started with Flutter development, view the
|
||||
[online documentation](https://docs.flutter.dev/), which offers tutorials,
|
||||
samples, guidance on mobile development, and a full API reference.
|
||||
Build instructions:
|
||||
* coming when I have time
|
||||
* for now just install_tflite.script and then flutter build this thing
|
||||
*
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tensordex_mobile/ui/tensordex_home.dart';
|
||||
import 'package:tensordex_mobile/widgets/tensordex_home.dart';
|
||||
import 'package:tensordex_mobile/utils/logger.dart';
|
||||
|
||||
Future<void> main() async {
|
||||
|
||||
@@ -10,8 +10,8 @@ import '../utils/logger.dart';
|
||||
import '../tflite/data/recognition.dart';
|
||||
import '../tflite/data/stats.dart';
|
||||
|
||||
/// [PokedexView] sends each frame for inference
|
||||
class PokedexView extends StatefulWidget {
|
||||
/// [PokeFinder] sends each frame for inference
|
||||
class PokeFinder extends StatefulWidget {
|
||||
/// Callback to pass results after inference to [HomeView]
|
||||
final Function(List<Recognition> recognitions) resultsCallback;
|
||||
|
||||
@@ -19,15 +19,15 @@ class PokedexView extends StatefulWidget {
|
||||
final Function(Stats stats) statsCallback;
|
||||
|
||||
/// Constructor
|
||||
const PokedexView(
|
||||
const PokeFinder(
|
||||
{Key? key, required this.resultsCallback, required this.statsCallback})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
State<PokedexView> createState() => _PokedexViewState();
|
||||
State<PokeFinder> createState() => _PokeFinderState();
|
||||
}
|
||||
|
||||
class _PokedexViewState extends State<PokedexView> with WidgetsBindingObserver {
|
||||
class _PokeFinderState extends State<PokeFinder> with WidgetsBindingObserver {
|
||||
late List<CameraDescription> cameras;
|
||||
late CameraController cameraController;
|
||||
late MLIsolate _mlIsolate;
|
||||
@@ -1,21 +1,21 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tensordex_mobile/ui/poke_view.dart';
|
||||
import 'package:tensordex_mobile/widgets/poke_finder.dart';
|
||||
import 'package:tensordex_mobile/tflite/data/recognition.dart';
|
||||
import 'package:tensordex_mobile/tflite/data/stats.dart';
|
||||
|
||||
|
||||
/// [PokedexView] sends each frame for inference
|
||||
class ResultsView extends StatefulWidget {
|
||||
/// [PokeFinder] sends each frame for inference
|
||||
class Results extends StatefulWidget {
|
||||
final List<Recognition> recognitions;
|
||||
final Stats stats;
|
||||
/// Constructor
|
||||
const ResultsView(this.recognitions, this.stats, {Key? key}) : super(key: key);
|
||||
const Results(this.recognitions, this.stats, {Key? key}) : super(key: key);
|
||||
|
||||
@override
|
||||
State<ResultsView> createState() => _ResultsViewState();
|
||||
State<Results> createState() => _ResultsState();
|
||||
}
|
||||
|
||||
class _ResultsViewState extends State<ResultsView> {
|
||||
class _ResultsState extends State<Results> {
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:tensordex_mobile/ui/poke_view.dart';
|
||||
import 'package:tensordex_mobile/ui/results_view.dart';
|
||||
import 'package:tensordex_mobile/widgets/poke_finder.dart';
|
||||
import 'package:tensordex_mobile/widgets/results.dart';
|
||||
|
||||
import '../utils/logger.dart';
|
||||
import '../tflite/data/recognition.dart';
|
||||
@@ -44,14 +44,14 @@ class _TensordexHomeState extends State<TensordexHome> {
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
/// Callback to get inference results from [PokedexView]
|
||||
/// Callback to get inference results from [PokeFinder]
|
||||
void resultsCallback(List<Recognition> results) {
|
||||
setState(() {
|
||||
this.results = results;
|
||||
});
|
||||
}
|
||||
|
||||
/// Callback to get inference stats from [PokedexView]
|
||||
/// Callback to get inference stats from [PokeFinder]
|
||||
void statsCallback(Stats stats) {
|
||||
setState(() {
|
||||
this.stats = stats;
|
||||
@@ -68,10 +68,10 @@ class _TensordexHomeState extends State<TensordexHome> {
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
PokedexView(
|
||||
PokeFinder(
|
||||
resultsCallback: resultsCallback,
|
||||
statsCallback: statsCallback),
|
||||
ResultsView(results, stats),
|
||||
Results(results, stats),
|
||||
],
|
||||
),
|
||||
),
|
||||
Reference in New Issue
Block a user