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:flutter/foundation.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/models/setting_model.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
@@ -26,21 +24,8 @@ class SsupportStateScreen extends State<SupportScreen> {
|
||||
}
|
||||
|
||||
Future<void> _sendEmail(String recipients) async {
|
||||
final Email email = Email(
|
||||
body: body,
|
||||
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 {}
|
||||
final uri = 'mailto:$recipients?subject=${Uri.encodeComponent(subject)}&body=${Uri.encodeComponent(body)}';
|
||||
if (await canLaunch(uri)) await launch(uri);
|
||||
}
|
||||
|
||||
@override
|
||||
@@ -105,13 +90,7 @@ class SsupportStateScreen extends State<SupportScreen> {
|
||||
),
|
||||
const SizedBox(width: 20),
|
||||
ElevatedButton(
|
||||
onPressed: () {
|
||||
if (kIsWeb) {
|
||||
_sendEmailWeb(settings?.email ?? '');
|
||||
} else {
|
||||
_sendEmail(settings?.email ?? '');
|
||||
}
|
||||
},
|
||||
onPressed: () => _sendEmail(settings?.email ?? ''),
|
||||
style: ElevatedButton.styleFrom(
|
||||
foregroundColor: Colors.white,
|
||||
backgroundColor: const Color(0xFF2BA4EC),
|
||||
|
||||
Reference in New Issue
Block a user