update flutter_sms to the latest version

This commit is contained in:
2026-01-14 00:23:07 -08:00
parent 33258c580c
commit 6250a11afd
38 changed files with 1192 additions and 480 deletions
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.SEND_SMS"/>
<application
android:label="flutter_sms_example"
android:name="${applicationName}"
@@ -42,5 +42,9 @@
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
<intent>
<action android:name="android.intent.action.SENDTO" />
<data android:scheme="smsto" />
</intent>
</queries>
</manifest>
+5 -18
View File
@@ -65,7 +65,8 @@ class SmsViewModel extends ChangeNotifier {
_setLoading(true);
try {
_canSendSms = await canSendSMS();
} catch (e) {
} catch (e, t) {
debugPrint('Error checking capability: $e\n$t');
_status = 'Error checking capability: $e';
} finally {
_setLoading(false);
@@ -90,7 +91,7 @@ class SmsViewModel extends ChangeNotifier {
notifyListeners();
}
Future<void> send({bool sendDirect = false}) async {
Future<void> send() async {
if (_recipients.isEmpty || _message.isEmpty) {
_status = 'Please add at least one recipient and a message.';
notifyListeners();
@@ -105,10 +106,10 @@ class SmsViewModel extends ChangeNotifier {
final result = await sendSMS(
message: _message,
recipients: _recipients,
sendDirect: sendDirect,
);
_status = result;
} catch (e) {
} catch (e, t) {
debugPrint('Error sending SMS: $e\n$t');
_status = e.toString();
} finally {
_setLoading(false);
@@ -270,20 +271,6 @@ class _SmsHomePageState extends State<SmsHomePage> {
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
if (Theme.of(context).platform ==
TargetPlatform.android) ...[
const SizedBox(height: 12),
OutlinedButton.icon(
onPressed: _viewModel.isLoading
? null
: () => _viewModel.send(sendDirect: true),
icon: const Icon(Icons.flash_on),
label: const Text('Send Direct (Android)'),
style: OutlinedButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
],
],
),
),