Integrations
This commit is contained in:
parent
5ab8c084d8
commit
69a10840eb
|
|
@ -0,0 +1,41 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
import 'package:url_launcher/url_launcher.dart';
|
||||
|
||||
class LearnMore extends StatelessWidget {
|
||||
const LearnMore({
|
||||
@required this.child,
|
||||
@required this.url,
|
||||
});
|
||||
|
||||
final Widget child;
|
||||
final String url;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final localization = AppLocalization.of(context);
|
||||
|
||||
if (url.isEmpty) {
|
||||
return child;
|
||||
}
|
||||
|
||||
return Row(
|
||||
children: <Widget>[
|
||||
Expanded(
|
||||
child: child,
|
||||
),
|
||||
SizedBox(
|
||||
width: 10,
|
||||
),
|
||||
FlatButton(
|
||||
child: Text(localization.learnMore),
|
||||
onPressed: () async {
|
||||
if (await canLaunch(url)) {
|
||||
await launch(url, forceSafariVC: false, forceWebView: false);
|
||||
}
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ import 'package:flutter/foundation.dart';
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/form_card.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/decorated_form_field.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/forms/learn_more.dart';
|
||||
import 'package:invoiceninja_flutter/ui/settings/integrations_vm.dart';
|
||||
import 'package:invoiceninja_flutter/ui/app/edit_scaffold.dart';
|
||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||
|
|
@ -57,9 +58,7 @@ class _IntegrationSettingsState extends State<IntegrationSettings> {
|
|||
super.didChangeDependencies();
|
||||
}
|
||||
|
||||
void _onChanged() {
|
||||
|
||||
}
|
||||
void _onChanged() {}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
|
|
@ -73,16 +72,22 @@ class _IntegrationSettingsState extends State<IntegrationSettings> {
|
|||
children: <Widget>[
|
||||
FormCard(
|
||||
children: <Widget>[
|
||||
DecoratedFormField(
|
||||
LearnMore(
|
||||
url: 'https://my.slack.com/services/new/incoming-webhook/',
|
||||
child: DecoratedFormField(
|
||||
label: 'Slack',
|
||||
hint: localization.slackWebhookUrl,
|
||||
controller: _slackWebhookController,
|
||||
),
|
||||
DecoratedFormField(
|
||||
),
|
||||
LearnMore(
|
||||
url: 'https://support.google.com/analytics/answer/1037249',
|
||||
child: DecoratedFormField(
|
||||
label: 'Google Analytics',
|
||||
hint: localization.analyticsKey,
|
||||
hint: localization.trackingId,
|
||||
controller: _googleAnalyticsController,
|
||||
),
|
||||
),
|
||||
],
|
||||
)
|
||||
],
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ abstract class LocaleCodeAware {
|
|||
mixin LocalizationsProvider on LocaleCodeAware {
|
||||
static final Map<String, Map<String, String>> _localizedValues = {
|
||||
'en': {
|
||||
'learn_more': 'Learn More',
|
||||
'integrations': 'Integrations',
|
||||
'tracking_id': 'Tracking Id',
|
||||
'slack_webhook_url': 'Slack Webhook URL',
|
||||
|
|
@ -32726,12 +32727,15 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
|||
|
||||
String get creditTerms => _localizedValues[localeCode]['credit_terms'];
|
||||
|
||||
String get slackWebhookUrl => _localizedValues[localeCode]['slack_webhook_url'];
|
||||
String get slackWebhookUrl =>
|
||||
_localizedValues[localeCode]['slack_webhook_url'];
|
||||
|
||||
String get analyticsKey => _localizedValues[localeCode]['analytics_key'];
|
||||
String get trackingId => _localizedValues[localeCode]['tracking_id'];
|
||||
|
||||
String get integrations => _localizedValues[localeCode]['integrations'];
|
||||
|
||||
String get learnMore => _localizedValues[localeCode]['learn_more'];
|
||||
|
||||
String lookup(String key) {
|
||||
final lookupKey = toSnakeCase(key);
|
||||
return _localizedValues[localeCode][lookupKey] ??
|
||||
|
|
|
|||
Loading…
Reference in New Issue