import 'dart:io';

import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:satu/widgets/bar/products_app_bar.dart';
import 'package:satu/widgets/tools/app_barcode_scanner_widget.dart';

class AddByBarcodeView extends StatefulWidget {

  const AddByBarcodeView({
    Key? key
  }) : super(key: key);

  @override
  _AddByBarcodeViewState createState() => _AddByBarcodeViewState();
}

class _AddByBarcodeViewState extends State<AddByBarcodeView> {
  String _code = '';
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: ProductsAppBar(
        title: 'Сканер',
      ),
      body: Column(
        children: [
          Expanded(
            child: AppBarcodeScannerWidget.defaultStyle(
              resultCallback: (String code) {
                Navigator.pop(context, code);
                // print(code);
                // setState(() {
                //   _code = code;
                // });
              },
            ),
          ),
        ],
      ),
    );
  }
}
