Integrations

This commit is contained in:
Hillel Coren 2020-03-01 15:26:54 +02:00
parent 5ab8c084d8
commit 69a10840eb
3 changed files with 1044 additions and 994 deletions

View File

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

View File

@ -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,15 +72,21 @@ class _IntegrationSettingsState extends State<IntegrationSettings> {
children: <Widget>[
FormCard(
children: <Widget>[
DecoratedFormField(
label: 'Slack',
hint: localization.slackWebhookUrl,
controller: _slackWebhookController,
LearnMore(
url: 'https://my.slack.com/services/new/incoming-webhook/',
child: DecoratedFormField(
label: 'Slack',
hint: localization.slackWebhookUrl,
controller: _slackWebhookController,
),
),
DecoratedFormField(
label: 'Google Analytics',
hint: localization.analyticsKey,
controller: _googleAnalyticsController,
LearnMore(
url: 'https://support.google.com/analytics/answer/1037249',
child: DecoratedFormField(
label: 'Google Analytics',
hint: localization.trackingId,
controller: _googleAnalyticsController,
),
),
],
)

File diff suppressed because it is too large Load Diff