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()
: 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';
}

View file

@ -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"

View file

@ -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<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/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(),
],
),