diff --git a/lib/environment.dart b/lib/environment.dart index 14b6ad8..6b65396 100644 --- a/lib/environment.dart +++ b/lib/environment.dart @@ -12,10 +12,10 @@ class Environment { const Environment.dev() : sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter', issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues', - contactEmail = ''; + contactEmail = 'contact.vodemn@gmail.com'; const Environment.prod() : sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter', issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues', - contactEmail = ''; + contactEmail = 'contact.vodemn@gmail.com'; } diff --git a/lib/l10n/intl_en.arb b/lib/l10n/intl_en.arb index 7cb99f0..3dc9941 100644 --- a/lib/l10n/intl_en.arb +++ b/lib/l10n/intl_en.arb @@ -28,9 +28,11 @@ "themeSystemDefault": "System default", "about": "About", "sourceCode": "Source code", - "reportIssue": "Report issue", - "version": "Version: {version} ({buildNumber})", - "@version": { + "reportIssue": "Report an issue", + "writeEmail": "Write an email", + "version": "Version", + "versionNumber": "{version} ({buildNumber})", + "@versionNumber": { "placeholders": { "version": { "type": "String" diff --git a/lib/screens/settings/components/version/widget_list_tile_version.dart b/lib/screens/settings/components/version/widget_list_tile_version.dart index 5ab1249..a2622a6 100644 --- a/lib/screens/settings/components/version/widget_list_tile_version.dart +++ b/lib/screens/settings/components/version/widget_list_tile_version.dart @@ -1,6 +1,6 @@ import 'package:flutter/material.dart'; import 'package:lightmeter/generated/l10n.dart'; - +import 'package:package_info_plus/package_info_plus.dart'; class VersionListTile extends StatelessWidget { const VersionListTile({super.key}); @@ -9,7 +9,16 @@ class VersionListTile extends StatelessWidget { Widget build(BuildContext context) { return ListTile( leading: const Icon(Icons.info_outline), - title: Text(S.of(context).version('', '')), + title: Text(S.of(context).version), + trailing: FutureBuilder( + future: PackageInfo.fromPlatform(), + builder: (context, snapshot) { + if (snapshot.data != null) { + return Text(S.of(context).versionNumber(snapshot.data!.version, snapshot.data!.buildNumber)); + } + return const SizedBox.shrink(); + }, + ), ); } -} \ No newline at end of file +} diff --git a/lib/screens/settings/components/widget_label_version.dart b/lib/screens/settings/components/widget_label_version.dart deleted file mode 100644 index 4491cee..0000000 --- a/lib/screens/settings/components/widget_label_version.dart +++ /dev/null @@ -1,27 +0,0 @@ -import 'package:flutter/material.dart'; -import 'package:lightmeter/generated/l10n.dart'; -import 'package:package_info_plus/package_info_plus.dart'; - -class VersionLabel extends StatelessWidget { - const VersionLabel({super.key}); - - @override - Widget build(BuildContext context) { - return FutureBuilder( - future: PackageInfo.fromPlatform(), - builder: (context, snapshot) { - if (snapshot.data != null) { - final version = snapshot.data!.version; - final buildNumber = snapshot.data!.buildNumber; - return Center( - child: Text( - S.of(context).version(version, buildNumber), - style: Theme.of(context).textTheme.bodySmall, - ), - ); - } - return const SizedBox.shrink(); - }, - ); - } -} diff --git a/lib/screens/settings/components/write_email/widget_list_tile_write_email.dart b/lib/screens/settings/components/write_email/widget_list_tile_write_email.dart new file mode 100644 index 0000000..11ff713 --- /dev/null +++ b/lib/screens/settings/components/write_email/widget_list_tile_write_email.dart @@ -0,0 +1,20 @@ +import 'package:flutter/material.dart'; +import 'package:lightmeter/environment.dart'; +import 'package:lightmeter/generated/l10n.dart'; +import 'package:provider/provider.dart'; +import 'package:url_launcher/url_launcher.dart'; + +class WriteEmailListTile extends StatelessWidget { + const WriteEmailListTile({super.key}); + + @override + Widget build(BuildContext context) { + return ListTile( + leading: const Icon(Icons.email), + title: Text(S.of(context).writeEmail), + onTap: () { + launchUrl(Uri.parse('mailto:${context.read().issuesReportUrl}?subject=M3 Lightmeter')); + }, + ); + } +} diff --git a/lib/screens/settings/screen_settings.dart b/lib/screens/settings/screen_settings.dart index 9a1a9c9..b32144d 100644 --- a/lib/screens/settings/screen_settings.dart +++ b/lib/screens/settings/screen_settings.dart @@ -10,6 +10,7 @@ import 'components/dynamic_colors/widget_list_tile_dynamic_colors.dart'; import 'components/theme_type/widget_list_tile_theme_type.dart'; import 'components/version/widget_list_tile_version.dart'; import 'components/widget_list_tile_fractional_stops.dart'; +import 'components/write_email/widget_list_tile_write_email.dart'; class SettingsScreen extends StatelessWidget { const SettingsScreen({super.key}); @@ -67,6 +68,7 @@ class SettingsScreen extends StatelessWidget { children: const [ SourceCodeListTile(), ReportIssueListTile(), + WriteEmailListTile(), VersionListTile(), ], ),