barras
barras copied to clipboard
Adds a callback when the code is scanned
This PR adds the feature to call a custom callback when the code is scanned.
Also, with this, we can now implement a more custom UI, for do that we won't use the default method Barras.scan
, and instead we create the widget we want and put the BarcodeReaderPage
, e.g.:
void openQRCodeReader() {
Navigator.of(context).push(
MaterialPageRoute(
builder: (context) {
return Scaffold(
body: Stack(
children: [
BarcodeReaderPage(
successBeep: false,
borderColor: Colors.transparent,
onScanned: (data) {
// HERE YOU ADD YOUR CUSTOM CALLBACK
// DON'T FORGET THAT YOU WILL HAVE TO MANAGE YOURSELF THE NAVIGATION PART
},
),
Column(
children: [
IconButton(
icon: Icon(Icons.close_rounded),
color: const Color(0xFF212121),
onPressed: () {
Navigator.of(context).pop();
},
),
Center(
child: Text(
'Escaneie o QR code',
style: TextStyle(
fontSize: 30,
color: Colors.white,
),
),
),
],
),
],
),
);
},
),
);
}
Alguma previsão de rolar esse merge? Ajudaria bastante...hehehe
@deadblit
Alguma previsão de rolar esse merge? Ajudaria bastante...hehehe
Sim, em breve. Tem como você por favor atualizar o PR? Acho que deve ter quebrado por causa da implementação de null safety.