added contact email

This commit is contained in:
Vadim 2023-01-23 21:35:47 +03:00
parent 6adaeee02d
commit 7587a7a575
6 changed files with 41 additions and 35 deletions

View file

@ -12,10 +12,10 @@ class Environment {
const Environment.dev() const Environment.dev()
: sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter', : sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter',
issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues', issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues',
contactEmail = ''; contactEmail = 'contact.vodemn@gmail.com';
const Environment.prod() const Environment.prod()
: sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter', : sourceCodeUrl = 'https://github.com/vodemn/m3_lightmeter',
issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues', issuesReportUrl = 'https://github.com/vodemn/m3_lightmeter/issues',
contactEmail = ''; contactEmail = 'contact.vodemn@gmail.com';
} }

View file

@ -28,9 +28,11 @@
"themeSystemDefault": "System default", "themeSystemDefault": "System default",
"about": "About", "about": "About",
"sourceCode": "Source code", "sourceCode": "Source code",
"reportIssue": "Report issue", "reportIssue": "Report an issue",
"version": "Version: {version} ({buildNumber})", "writeEmail": "Write an email",
"@version": { "version": "Version",
"versionNumber": "{version} ({buildNumber})",
"@versionNumber": {
"placeholders": { "placeholders": {
"version": { "version": {
"type": "String" "type": "String"

View file

@ -1,6 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:lightmeter/generated/l10n.dart'; import 'package:lightmeter/generated/l10n.dart';
import 'package:package_info_plus/package_info_plus.dart';
class VersionListTile extends StatelessWidget { class VersionListTile extends StatelessWidget {
const VersionListTile({super.key}); const VersionListTile({super.key});
@ -9,7 +9,16 @@ class VersionListTile extends StatelessWidget {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return ListTile( return ListTile(
leading: const Icon(Icons.info_outline), leading: const Icon(Icons.info_outline),
title: Text(S.of(context).version('', '')), title: Text(S.of(context).version),
trailing: FutureBuilder<PackageInfo>(
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();
},
),
); );
} }
} }

View file

@ -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<PackageInfo>(
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();
},
);
}
}

View file

@ -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<Environment>().issuesReportUrl}?subject=M3 Lightmeter'));
},
);
}
}

View file

@ -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/theme_type/widget_list_tile_theme_type.dart';
import 'components/version/widget_list_tile_version.dart'; import 'components/version/widget_list_tile_version.dart';
import 'components/widget_list_tile_fractional_stops.dart'; import 'components/widget_list_tile_fractional_stops.dart';
import 'components/write_email/widget_list_tile_write_email.dart';
class SettingsScreen extends StatelessWidget { class SettingsScreen extends StatelessWidget {
const SettingsScreen({super.key}); const SettingsScreen({super.key});
@ -67,6 +68,7 @@ class SettingsScreen extends StatelessWidget {
children: const [ children: const [
SourceCodeListTile(), SourceCodeListTile(),
ReportIssueListTile(), ReportIssueListTile(),
WriteEmailListTile(),
VersionListTile(), VersionListTile(),
], ],
), ),