fix: resolve web build failures
- Update SDK constraint to >=3.0.0 <4.0.0 (Flutter stable uses Dart 3.x) - Remove flutter_email_sender (no web support) — replace with mailto: via url_launcher - support.dart: unified _sendEmail works on both web and mobile Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
5f9da1eefe
commit
33ee7ea2f4
@@ -1,7 +1,5 @@
|
|||||||
import 'package:community_material_icon/community_material_icon.dart';
|
import 'package:community_material_icon/community_material_icon.dart';
|
||||||
import 'package:flutter/foundation.dart';
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_email_sender/flutter_email_sender.dart';
|
|
||||||
import 'package:prosappco/src/components/pop_appbar.dart';
|
import 'package:prosappco/src/components/pop_appbar.dart';
|
||||||
import 'package:prosappco/src/models/setting_model.dart';
|
import 'package:prosappco/src/models/setting_model.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
@@ -26,21 +24,8 @@ class SsupportStateScreen extends State<SupportScreen> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Future<void> _sendEmail(String recipients) async {
|
Future<void> _sendEmail(String recipients) async {
|
||||||
final Email email = Email(
|
final uri = 'mailto:$recipients?subject=${Uri.encodeComponent(subject)}&body=${Uri.encodeComponent(body)}';
|
||||||
body: body,
|
if (await canLaunch(uri)) await launch(uri);
|
||||||
subject: subject,
|
|
||||||
recipients: [recipients],
|
|
||||||
isHTML: false,
|
|
||||||
);
|
|
||||||
|
|
||||||
await FlutterEmailSender.send(email);
|
|
||||||
}
|
|
||||||
|
|
||||||
void _sendEmailWeb(String recipients) async {
|
|
||||||
final email = 'mailto:$recipients?subject=${Uri.encodeComponent(recipients)}&body=${Uri.encodeComponent(body)}';
|
|
||||||
if (await canLaunch(email)) {
|
|
||||||
await launch(email);
|
|
||||||
} else {}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@@ -105,13 +90,7 @@ class SsupportStateScreen extends State<SupportScreen> {
|
|||||||
),
|
),
|
||||||
const SizedBox(width: 20),
|
const SizedBox(width: 20),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
onPressed: () {
|
onPressed: () => _sendEmail(settings?.email ?? ''),
|
||||||
if (kIsWeb) {
|
|
||||||
_sendEmailWeb(settings?.email ?? '');
|
|
||||||
} else {
|
|
||||||
_sendEmail(settings?.email ?? '');
|
|
||||||
}
|
|
||||||
},
|
|
||||||
style: ElevatedButton.styleFrom(
|
style: ElevatedButton.styleFrom(
|
||||||
foregroundColor: Colors.white,
|
foregroundColor: Colors.white,
|
||||||
backgroundColor: const Color(0xFF2BA4EC),
|
backgroundColor: const Color(0xFF2BA4EC),
|
||||||
|
|||||||
+1
-2
@@ -19,7 +19,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
|
|||||||
version: 1.0.11+11
|
version: 1.0.11+11
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.19.3 <3.0.0'
|
sdk: '>=3.0.0 <4.0.0'
|
||||||
|
|
||||||
# Dependencies specify other packages that your package needs in order to work.
|
# Dependencies specify other packages that your package needs in order to work.
|
||||||
# To automatically upgrade your package dependencies to the latest versions
|
# To automatically upgrade your package dependencies to the latest versions
|
||||||
@@ -55,7 +55,6 @@ dependencies:
|
|||||||
geocoding: ^2.1.0
|
geocoding: ^2.1.0
|
||||||
url_launcher: ^6.1.10
|
url_launcher: ^6.1.10
|
||||||
community_material_icon: ^5.9.55
|
community_material_icon: ^5.9.55
|
||||||
flutter_email_sender: ^5.2.0
|
|
||||||
webview_flutter: ^4.4.1
|
webview_flutter: ^4.4.1
|
||||||
responsive_builder: ^0.7.0
|
responsive_builder: ^0.7.0
|
||||||
flutter_local_notifications: ^14.1.1
|
flutter_local_notifications: ^14.1.1
|
||||||
|
|||||||
Reference in New Issue
Block a user