fix: dispose of media controller
This commit is contained in:
parent
6c6f0da1ae
commit
6d77a02b72
2 changed files with 18 additions and 5 deletions
|
|
@ -23,13 +23,19 @@ class AddPage extends StatefulWidget {
|
||||||
|
|
||||||
class _AddPageState extends State<AddPage> {
|
class _AddPageState extends State<AddPage> {
|
||||||
num? price;
|
num? price;
|
||||||
|
final MobileScannerController controller = MobileScannerController(
|
||||||
|
formats: [BarcodeFormat.ean13],
|
||||||
|
detectionTimeoutMs: 1000,
|
||||||
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final MobileScannerController controller = MobileScannerController(
|
|
||||||
formats: [BarcodeFormat.ean13],
|
|
||||||
detectionTimeoutMs: 1000,
|
|
||||||
);
|
|
||||||
|
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
// return Consumer<TabScreen>(
|
// return Consumer<TabScreen>(
|
||||||
// builder: (context, screen, child) {
|
// builder: (context, screen, child) {
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,13 @@ class _ScanScreenState extends State<ScanScreen> {
|
||||||
formats: [BarcodeFormat.ean13],
|
formats: [BarcodeFormat.ean13],
|
||||||
detectionTimeoutMs: 1000,
|
detectionTimeoutMs: 1000,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
controller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Theme.of(context);
|
final theme = Theme.of(context);
|
||||||
|
|
|
||||||
Reference in a new issue