Added option to block and unblock clients from home screen

This commit is contained in:
Juan Gilsanz Polo 2023-12-17 22:09:13 +01:00
parent 71b870b42f
commit 569ab7d569
16 changed files with 139 additions and 53 deletions

View file

@ -28,11 +28,11 @@ class ActiveClientTile extends StatelessWidget {
return Padding(
padding: const EdgeInsets.symmetric(horizontal: 12),
child: OptionsMenu(
options: [
options: (_) => [
MenuOption(
icon: Icons.copy_rounded,
title: AppLocalizations.of(context)!.copyClipboard,
action: (_) => copyToClipboard(
action: () => copyToClipboard(
value: client.name != ''
? client.name!
: client.ip,
@ -99,11 +99,11 @@ class ActiveClientTile extends StatelessWidget {
}
else {
return OptionsMenu(
options: [
options: (_) => [
MenuOption(
icon: Icons.copy_rounded,
title: AppLocalizations.of(context)!.copyClipboard,
action: (_) => copyToClipboard(
action: () => copyToClipboard(
value: client.name != ''
? client.name!
: client.ip,

View file

@ -46,11 +46,11 @@ class _AddedClientTileState extends State<AddedClientTile> {
color: Colors.transparent,
borderRadius: BorderRadius.circular(28),
child: OptionsMenu(
options: [
options: (_) => [
MenuOption(
icon: Icons.copy_rounded,
title: AppLocalizations.of(context)!.copyClipboard,
action: (_) => copyToClipboard(
action: () => copyToClipboard(
value: widget.client.ids.toString().replaceAll(RegExp(r'^\[|\]$'), ''),
successMessage: AppLocalizations.of(context)!.copiedClipboard,
)
@ -164,16 +164,16 @@ class _AddedClientTileState extends State<AddedClientTile> {
}
else {
return OptionsMenu(
options: [
options: (_) => [
if (widget.onEdit != null) MenuOption(
title: AppLocalizations.of(context)!.seeDetails,
icon: Icons.file_open_rounded,
action: (_) => widget.onEdit!(widget.client)
action: () => widget.onEdit!(widget.client)
),
MenuOption(
icon: Icons.copy_rounded,
title: AppLocalizations.of(context)!.copyClipboard,
action: (_) => copyToClipboard(
action: () => copyToClipboard(
value: widget.client.ids.toString().replaceAll(RegExp(r'^\[|\]$'), ''),
successMessage: AppLocalizations.of(context)!.copiedClipboard,
)

View file

@ -226,16 +226,16 @@ class _SearchClientsState extends State<SearchClients> {
itemCount: clientsScreen.length,
padding: const EdgeInsets.only(bottom: 0),
itemBuilder: (context, index) => OptionsMenu(
options: [
options: (v) => [
MenuOption(
icon: Icons.edit_rounded,
title: AppLocalizations.of(context)!.edit,
action: (v) => openClientModal(v)
action: () => openClientModal(v)
),
MenuOption(
icon: Icons.delete_rounded,
title: AppLocalizations.of(context)!.delete,
action: (v) => openDeleteModal(v)
action: () => openDeleteModal(v)
),
],
value: clientsScreen[index],