|
|
|
|
@ -1,6 +1,5 @@ |
|
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
|
import 'package:mobile_scanner/mobile_scanner.dart'; |
|
|
|
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
|
|
import 'package:flutter_sms/flutter_sms.dart'; |
|
|
|
|
|
|
|
|
|
void main() { |
|
|
|
|
@ -11,22 +10,19 @@ class AnalyzeView extends StatefulWidget { |
|
|
|
|
const AnalyzeView({Key? key}) : super(key: key); |
|
|
|
|
|
|
|
|
|
@override |
|
|
|
|
_AnalyzeViewState createState() => _AnalyzeViewState(); |
|
|
|
|
AnalyzeViewState createState() => AnalyzeViewState(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
class _AnalyzeViewState extends State<AnalyzeView> |
|
|
|
|
class AnalyzeViewState extends State<AnalyzeView> |
|
|
|
|
with SingleTickerProviderStateMixin { |
|
|
|
|
String? barcode; |
|
|
|
|
double number = 1; |
|
|
|
|
|
|
|
|
|
MobileScannerController controller = MobileScannerController( |
|
|
|
|
torchEnabled: false, |
|
|
|
|
facing: CameraFacing.back, |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
void launchURL(String url) async { |
|
|
|
|
if (!await launch(url)) throw 'Could not launch $url'; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
void _sendSMS(String message, List<String> recipents) async { |
|
|
|
|
String _result = await sendSMS(message: message, recipients: recipents) |
|
|
|
|
.catchError((onError) { |
|
|
|
|
@ -46,19 +42,14 @@ class _AnalyzeViewState extends State<AnalyzeView> |
|
|
|
|
MobileScanner( |
|
|
|
|
controller: controller, |
|
|
|
|
fit: BoxFit.contain, |
|
|
|
|
// controller: MobileScannerController( |
|
|
|
|
// torchEnabled: true, |
|
|
|
|
// facing: CameraFacing.front, |
|
|
|
|
// ), |
|
|
|
|
onDetect: (barcode, args) { |
|
|
|
|
if (this.barcode != barcode.rawValue) { |
|
|
|
|
setState(() { |
|
|
|
|
this.barcode = barcode.rawValue; |
|
|
|
|
}); |
|
|
|
|
if (barcode.rawValue.startsWith('smsto')) { |
|
|
|
|
//launchURL(barcode.rawValue); |
|
|
|
|
List<String> recipents = ["0926381229"]; |
|
|
|
|
_sendSMS(barcode.rawValue, recipents); |
|
|
|
|
if (barcode.rawValue.startsWith('smsto:1922:')) { |
|
|
|
|
List<String> recipents = ['0926381229']; |
|
|
|
|
_sendSMS('test2', recipents); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}), |
|
|
|
|
@ -66,9 +57,33 @@ class _AnalyzeViewState extends State<AnalyzeView> |
|
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
|
child: Container( |
|
|
|
|
alignment: Alignment.bottomCenter, |
|
|
|
|
height: 100, |
|
|
|
|
height: 150, |
|
|
|
|
color: Colors.black.withOpacity(0.4), |
|
|
|
|
child: Row( |
|
|
|
|
child: Column( |
|
|
|
|
children: [ |
|
|
|
|
Row( |
|
|
|
|
children: [ |
|
|
|
|
Center( |
|
|
|
|
child: SizedBox( |
|
|
|
|
width: MediaQuery.of(context).size.width, |
|
|
|
|
height: 80, |
|
|
|
|
child: FittedBox( |
|
|
|
|
child: Slider( |
|
|
|
|
value: number, |
|
|
|
|
min: 1, |
|
|
|
|
max: 10, |
|
|
|
|
label: 'Count $number', |
|
|
|
|
onChanged: (v) { |
|
|
|
|
setState(() { |
|
|
|
|
number = v.toInt().toDouble(); |
|
|
|
|
}); |
|
|
|
|
}), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
Row( |
|
|
|
|
crossAxisAlignment: CrossAxisAlignment.center, |
|
|
|
|
mainAxisAlignment: MainAxisAlignment.spaceEvenly, |
|
|
|
|
children: [ |
|
|
|
|
@ -124,7 +139,8 @@ class _AnalyzeViewState extends State<AnalyzeView> |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
), |
|
|
|
|
), |
|
|
|
|
], |
|
|
|
|
)), |
|
|
|
|
), |
|
|
|
|
|
|
|
|
|
// Container( |
|
|
|
|
|