Merhaba ;
https://pub.dev/packages/qrscan/score widget ini kullanıyorum. sorunsuz da çalışıyor. bunu tercih etmemin sebebi hem galeriden resim seçilebilmesi, hem de qr ve barkodu iyi bir şekilde taraması. ancak bir sorunum var. tarama yaparken bir kare alan veriyor. o alanı genişletemiyorum. bir de telefonu yatay çevirdiğimizde brkodu okumuyor. yardımcı olur musunuz ?
// ignore_for_file: unused_field, unused_local_variable, deprecated_member_use, library_private_types_in_public_api, camel_case_types, unnecessary_new, prefer_const_constructors
import 'package:flutter/services.dart';
import 'package:flutter/material.dart';
import 'package:besoted_servishane/components/yanMenu.dart';
import 'package:permission_handler/permission_handler.dart';
import 'package:qrscan/qrscan.dart' as scanner;
TextEditingController _urunbarkodcontroller = new TextEditingController();
class barkodTest extends StatefulWidget {
const barkodTest({Key key}) : super(key: key);
@override
_barkodTestState createState() => _barkodTestState();
}
class _barkodTestState extends State<barkodTest> {
final _formKeyScreen2 = GlobalKey<FormState>();
//final ImagePicker _picker = ImagePicker();
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return SafeArea(
child: Scaffold(
body: Padding(
padding: const EdgeInsets.all(2.0),
child: Row(
children: [
Expanded(
flex: 8,
child: Padding(
padding: const EdgeInsets.all(2.0),
child: TextFormField(
style: TextStyle(
fontSize: 12.0,
color: Colors.black,
),
controller: _urunbarkodcontroller,
autovalidateMode: AutovalidateMode.always,
decoration: const InputDecoration(
isDense: true, // Added this
contentPadding: EdgeInsets.all(8),
hintText: "Ürün Barkodu",
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.brown,
width: 1.0,
),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.black45,
width: 1.0,
),
),
),
),
),
),
Expanded(
flex: 2,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
minimumSize: Size(double.infinity,
30) // put the width and height you want
),
child: Icon(Icons.scanner, size: 18),
onPressed: () async {
try {
await Permission.camera.request();
String barcode = await scanner.scan();
final qrCode = barcode;
if (!mounted) return;
setState(() {
_urunbarkodcontroller.text = qrCode.toString();
});
} on PlatformException {}
},
),
),
],
),
),
),
);
}
}