Improve client portal buttons with empty client
This commit is contained in:
parent
aab3d2c93b
commit
41c3d54339
|
|
@ -1,15 +1,12 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter/services.dart';
|
import 'package:flutter/services.dart';
|
||||||
import 'package:flutter_redux/flutter_redux.dart';
|
|
||||||
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
import 'package:flutter_styled_toast/flutter_styled_toast.dart';
|
||||||
import 'package:invoiceninja_flutter/data/models/client_model.dart';
|
import 'package:invoiceninja_flutter/data/models/client_model.dart';
|
||||||
import 'package:invoiceninja_flutter/redux/app/app_state.dart';
|
|
||||||
import 'package:invoiceninja_flutter/ui/app/icon_text.dart';
|
import 'package:invoiceninja_flutter/ui/app/icon_text.dart';
|
||||||
import 'package:invoiceninja_flutter/utils/localization.dart';
|
import 'package:invoiceninja_flutter/utils/localization.dart';
|
||||||
import 'package:url_launcher/url_launcher.dart';
|
import 'package:url_launcher/url_launcher.dart';
|
||||||
|
|
||||||
enum PortalLinkStyle {
|
enum PortalLinkStyle {
|
||||||
icons,
|
|
||||||
buttons,
|
buttons,
|
||||||
dropdown,
|
dropdown,
|
||||||
}
|
}
|
||||||
|
|
@ -30,9 +27,6 @@ class PortalLinks extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final store = StoreProvider.of<AppState>(context);
|
|
||||||
final state = store.state;
|
|
||||||
final prefState = state.prefState;
|
|
||||||
final localization = AppLocalization.of(context);
|
final localization = AppLocalization.of(context);
|
||||||
|
|
||||||
var viewLinkWithHash = viewLink;
|
var viewLinkWithHash = viewLink;
|
||||||
|
|
@ -49,23 +43,7 @@ class PortalLinks extends StatelessWidget {
|
||||||
showToast(localization!.copiedToClipboard.replaceFirst(':value ', ''));
|
showToast(localization!.copiedToClipboard.replaceFirst(':value ', ''));
|
||||||
};
|
};
|
||||||
|
|
||||||
if (style == PortalLinkStyle.icons) {
|
if (style == PortalLinkStyle.dropdown) {
|
||||||
return Row(
|
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
|
|
||||||
children: [
|
|
||||||
IconButton(
|
|
||||||
onPressed: viewLinkPressed,
|
|
||||||
icon: Icon(Icons.open_in_new),
|
|
||||||
tooltip: prefState.enableTooltips ? localization!.viewPortal : '',
|
|
||||||
),
|
|
||||||
IconButton(
|
|
||||||
onPressed: copyLinkPressed,
|
|
||||||
icon: Icon(Icons.copy),
|
|
||||||
tooltip: prefState.enableTooltips ? localization!.copyLink : '',
|
|
||||||
),
|
|
||||||
],
|
|
||||||
);
|
|
||||||
} else if (style == PortalLinkStyle.dropdown) {
|
|
||||||
return PopupMenuButton<String>(
|
return PopupMenuButton<String>(
|
||||||
itemBuilder: (BuildContext context) => [
|
itemBuilder: (BuildContext context) => [
|
||||||
PopupMenuItem(
|
PopupMenuItem(
|
||||||
|
|
|
||||||
|
|
@ -393,7 +393,7 @@ class _ClientViewFullwidthState extends State<ClientViewFullwidth>
|
||||||
viewLink: contact.silentLink,
|
viewLink: contact.silentLink,
|
||||||
copyLink: contact.link,
|
copyLink: contact.link,
|
||||||
client: client,
|
client: client,
|
||||||
style: PortalLinkStyle.icons,
|
style: PortalLinkStyle.buttons,
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
] else
|
] else
|
||||||
|
|
|
||||||
|
|
@ -299,7 +299,7 @@ class _VendorViewFullwidthState extends State<VendorViewFullwidth>
|
||||||
viewLink: contact.silentLink,
|
viewLink: contact.silentLink,
|
||||||
copyLink: contact.link,
|
copyLink: contact.link,
|
||||||
client: null,
|
client: null,
|
||||||
style: PortalLinkStyle.icons,
|
style: PortalLinkStyle.buttons,
|
||||||
),
|
),
|
||||||
SizedBox(height: 16),
|
SizedBox(height: 16),
|
||||||
] else
|
] else
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue