|
|
|
@ -1,6 +1,7 @@ |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter/material.dart'; |
|
|
|
import 'package:flutter_sms/flutter_sms.dart'; |
|
|
|
|
|
|
|
import 'package:mobile_scanner/mobile_scanner.dart'; |
|
|
|
import 'package:mobile_scanner/mobile_scanner.dart'; |
|
|
|
|
|
|
|
import 'package:url_launcher/url_launcher.dart'; |
|
|
|
|
|
|
|
import 'package:flutter_sms/flutter_sms.dart'; |
|
|
|
|
|
|
|
|
|
|
|
void main() { |
|
|
|
void main() { |
|
|
|
runApp(const AnalyzeView()); |
|
|
|
runApp(const AnalyzeView()); |
|
|
|
@ -22,12 +23,16 @@ class _AnalyzeViewState extends State<AnalyzeView> |
|
|
|
facing: CameraFacing.back, |
|
|
|
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 { |
|
|
|
void _sendSMS(String message, List<String> recipents) async { |
|
|
|
String _result = await sendSMS(message: message, recipients: recipents) |
|
|
|
String _result = await sendSMS(message: message, recipients: recipents) |
|
|
|
.catchError((onError) { |
|
|
|
.catchError((onError) { |
|
|
|
//print(onError); |
|
|
|
print('sms err: $onError'); |
|
|
|
}); |
|
|
|
}); |
|
|
|
//print(_result); |
|
|
|
print('sms res: $_result'); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@override |
|
|
|
@override |
|
|
|
@ -50,8 +55,11 @@ class _AnalyzeViewState extends State<AnalyzeView> |
|
|
|
setState(() { |
|
|
|
setState(() { |
|
|
|
this.barcode = barcode.rawValue; |
|
|
|
this.barcode = barcode.rawValue; |
|
|
|
}); |
|
|
|
}); |
|
|
|
List<String> recipents = ["0926381229"]; |
|
|
|
if (barcode.rawValue.startsWith('smsto')) { |
|
|
|
_sendSMS(barcode.rawValue, recipents); |
|
|
|
//launchURL(barcode.rawValue); |
|
|
|
|
|
|
|
List<String> recipents = ["0926381229"]; |
|
|
|
|
|
|
|
_sendSMS(barcode.rawValue, recipents); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}), |
|
|
|
}), |
|
|
|
Align( |
|
|
|
Align( |
|
|
|
|