Improve client portal buttons with empty client

This commit is contained in:
Hillel Coren 2024-01-30 13:57:33 +02:00
parent aab3d2c93b
commit 41c3d54339
3 changed files with 3 additions and 25 deletions

View File

@ -1,15 +1,12 @@
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_redux/flutter_redux.dart';
import 'package:flutter_styled_toast/flutter_styled_toast.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/utils/localization.dart';
import 'package:url_launcher/url_launcher.dart';
enum PortalLinkStyle {
icons,
buttons,
dropdown,
}
@ -30,9 +27,6 @@ class PortalLinks extends StatelessWidget {
@override
Widget build(BuildContext context) {
final store = StoreProvider.of<AppState>(context);
final state = store.state;
final prefState = state.prefState;
final localization = AppLocalization.of(context);
var viewLinkWithHash = viewLink;
@ -49,23 +43,7 @@ class PortalLinks extends StatelessWidget {
showToast(localization!.copiedToClipboard.replaceFirst(':value ', ''));
};
if (style == PortalLinkStyle.icons) {
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) {
if (style == PortalLinkStyle.dropdown) {
return PopupMenuButton<String>(
itemBuilder: (BuildContext context) => [
PopupMenuItem(

View File

@ -393,7 +393,7 @@ class _ClientViewFullwidthState extends State<ClientViewFullwidth>
viewLink: contact.silentLink,
copyLink: contact.link,
client: client,
style: PortalLinkStyle.icons,
style: PortalLinkStyle.buttons,
),
SizedBox(height: 16),
] else

View File

@ -299,7 +299,7 @@ class _VendorViewFullwidthState extends State<VendorViewFullwidth>
viewLink: contact.silentLink,
copyLink: contact.link,
client: null,
style: PortalLinkStyle.icons,
style: PortalLinkStyle.buttons,
),
SizedBox(height: 16),
] else