mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-21 23:10:40 +00:00
added error toast
This commit is contained in:
parent
0d3641f618
commit
394d761f40
6 changed files with 48 additions and 4 deletions
|
@ -35,6 +35,14 @@
|
|||
android:value="2" />
|
||||
</application>
|
||||
|
||||
<queries>
|
||||
<intent>
|
||||
<action android:name="android.intent.action.SEND" />
|
||||
<data android:scheme="mailto" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
</intent>
|
||||
</queries>
|
||||
|
||||
<uses-permission android:name="android.permission.CAMERA" />
|
||||
<uses-feature android:name="android.hardware.camera" android:required="true" />
|
||||
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
"sourceCode": "Source code",
|
||||
"reportIssue": "Report an issue",
|
||||
"writeEmail": "Write an email",
|
||||
"youDontHaveMailApp": "You don't have any mail app installed.",
|
||||
"copyEmail": "Copy email",
|
||||
"version": "Version",
|
||||
"versionNumber": "{version} ({buildNumber})",
|
||||
"@versionNumber": {
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
"sourceCode": "Code source",
|
||||
"reportIssue": "Rapporter un problème",
|
||||
"writeEmail": "Écrire un email",
|
||||
"youDontHaveMailApp": "Vous n'avez installé aucune application de messagerie.",
|
||||
"copyEmail": "Copier un e-mail",
|
||||
"version": "Version",
|
||||
"versionNumber": "{version} ({buildNumber})",
|
||||
"@versionNumber": {
|
||||
|
|
|
@ -70,6 +70,8 @@
|
|||
"sourceCode": "Исходный код",
|
||||
"reportIssue": "Сообщить о проблеме",
|
||||
"writeEmail": "Написать на почту",
|
||||
"youDontHaveMailApp": "У вас не установлено почтовое приложение.",
|
||||
"copyEmail": "Скопировать адрес",
|
||||
"version": "Версия",
|
||||
"versionNumber": "{version} ({buildNumber})",
|
||||
"@versionNumber": {
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
import 'package:clipboard/clipboard.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:lightmeter/environment.dart';
|
||||
import 'package:lightmeter/generated/l10n.dart';
|
||||
import 'package:lightmeter/res/dimens.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
|
@ -13,11 +15,38 @@ class WriteEmailListTile extends StatelessWidget {
|
|||
leading: const Icon(Icons.email),
|
||||
title: Text(S.of(context).writeEmail),
|
||||
onTap: () {
|
||||
launchUrl(
|
||||
Uri.parse('mailto:${context.read<Environment>().contactEmail}?subject=M3 Lightmeter'),
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
final email = context.read<Environment>().contactEmail;
|
||||
final mailToUrl = Uri.parse('mailto:$email?subject=M3 Lightmeter');
|
||||
canLaunchUrl(mailToUrl).then((canLaunch) {
|
||||
if (canLaunch) {
|
||||
launchUrl(
|
||||
mailToUrl,
|
||||
mode: LaunchMode.externalApplication,
|
||||
);
|
||||
} else {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(
|
||||
content: Text(S.of(context).youDontHaveMailApp),
|
||||
behavior: SnackBarBehavior.floating,
|
||||
action: SnackBarAction(
|
||||
label: S.of(context).copyEmail,
|
||||
onPressed: () {
|
||||
FlutterClipboard.copy(email).then((_) {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
});
|
||||
},
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
});
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
void _copyEmail(BuildContext context) {
|
||||
FlutterClipboard.copy(context.read<Environment>().contactEmail).then((_) {
|
||||
ScaffoldMessenger.of(context).clearSnackBars();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ environment:
|
|||
dependencies:
|
||||
app_settings: 4.2.0
|
||||
camera: 0.10.0+4
|
||||
clipboard: 0.1.3
|
||||
exif: 3.1.2
|
||||
dynamic_color: 1.5.4
|
||||
firebase_core: 2.11.0
|
||||
|
|
Loading…
Reference in a new issue