Add platform buttons

This commit is contained in:
Hillel Coren 2020-11-26 20:31:05 +02:00
parent e6f482ae52
commit 81b7f472d7
3 changed files with 78 additions and 21 deletions

View File

@ -28,6 +28,9 @@ const String kTermsOfServiceURL = 'https://www.invoiceninja.com/terms';
//const String kAppleStoreUrl = 'https://itunes.apple.com/us/app/invoice-ninja/id1435514417?ls=1&mt=8';
//const String kGoogleStoreUrl = 'https://play.google.com/store/apps/details?id=com.invoiceninja.flutter';
const String kSourceCodeBackend = 'https://github.com/invoiceninja/invoiceninja';
const String kSourceCodeFrontend = 'https://github.com/invoiceninja/flutter-client';
const String kAppleStoreUrl = 'https://testflight.apple.com/join/MJ6WpaXh';
const String kGoogleStoreUrl = 'https://play.google.com/apps/testing/com.invoiceninja.app';
const String kMacOSUrl = 'http://download.invoiceninja.com/macos';

View File

@ -829,6 +829,56 @@ void _showAbout(BuildContext context) async {
builder: (BuildContext context) {
return AlertDialog(
actions: [
FlatButton(
child: Text(localization.sourceCode.toUpperCase()),
onPressed: () {
showDialog<AlertDialog>(
context: context,
builder: (BuildContext context) {
return AlertDialog(
actions: [
FlatButton(
child:
Text(localization.close.toUpperCase()),
onPressed: () =>
Navigator.of(context).pop(),
),
],
content: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment:
CrossAxisAlignment.stretch,
children: [
Text('Backend'),
Padding(
padding: const EdgeInsets.only(top: 20),
child: AppButton(
label: 'Laravel/PHP',
iconData: MdiIcons.server,
onPressed: () =>
launch(kSourceCodeBackend),
),
),
Padding(
padding: const EdgeInsets.only(top: 30),
child: Text('Frontend'),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: AppButton(
label: 'Flutter/Dart',
iconData: MdiIcons.desktopClassic,
onPressed: () =>
launch(kSourceCodeFrontend),
),
),
],
),
);
},
);
},
),
FlatButton(
child: Text(localization.close.toUpperCase()),
onPressed: () => Navigator.of(context).pop(),
@ -838,27 +888,7 @@ void _showAbout(BuildContext context) async {
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text('Mobile'),
Padding(
padding: const EdgeInsets.only(top: 20),
child: AppButton(
label: 'Apple',
iconData: MdiIcons.appleIos,
onPressed: () => launch(kAppleStoreUrl),
),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: AppButton(
label: 'Android',
iconData: MdiIcons.android,
onPressed: () => launch(kGoogleStoreUrl),
),
),
Padding(
padding: const EdgeInsets.only(top: 30),
child: Text('Desktop'),
),
Text(localization.desktop),
Padding(
padding: const EdgeInsets.only(top: 20),
child: AppButton(
@ -879,6 +909,26 @@ void _showAbout(BuildContext context) async {
padding: const EdgeInsets.only(top: 20),
child: Text('Windows coming soon...'),
),
Padding(
padding: const EdgeInsets.only(top: 30),
child: Text(localization.mobile),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: AppButton(
label: 'Apple',
iconData: MdiIcons.appleIos,
onPressed: () => launch(kAppleStoreUrl),
),
),
Padding(
padding: const EdgeInsets.only(top: 20),
child: AppButton(
label: 'Android',
iconData: MdiIcons.android,
onPressed: () => launch(kGoogleStoreUrl),
),
),
],
),
);

View File

@ -15,6 +15,7 @@ mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
// STARTER: lang key - do not remove comment
'source_code': 'Source Code',
'app_platforms': 'App Platforms',
'invoice_late': 'Invoice Late',
'quote_expired': 'Quote Expired',
@ -5190,6 +5191,9 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get appPlatforms =>
_localizedValues[localeCode]['app_platforms'] ?? '';
String get sourceCode =>
_localizedValues[localeCode]['source_code'] ?? '';
String lookup(String key) {
final lookupKey = toSnakeCase(key);