mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-28 17:48:10 +00:00
Changes
This commit is contained in:
parent
2ad99e737d
commit
9d1ae22bdd
5 changed files with 29 additions and 19 deletions
|
@ -185,7 +185,9 @@ class _AddedListState extends State<AddedList> {
|
||||||
client: widget.data[index],
|
client: widget.data[index],
|
||||||
onTap: widget.onClientSelected,
|
onTap: widget.onClientSelected,
|
||||||
onLongPress: openOptionsModal,
|
onLongPress: openOptionsModal,
|
||||||
onEdit: openClientModal,
|
onEdit: statusProvider.serverStatus != null
|
||||||
|
? (c) => openClientModal(c)
|
||||||
|
: null,
|
||||||
onDelete: openDeleteModal,
|
onDelete: openDeleteModal,
|
||||||
splitView: widget.splitView,
|
splitView: widget.splitView,
|
||||||
serverVersion: statusProvider.serverStatus!.serverVersion,
|
serverVersion: statusProvider.serverStatus!.serverVersion,
|
||||||
|
|
|
@ -14,7 +14,7 @@ class AddedClientTile extends StatelessWidget {
|
||||||
final Client client;
|
final Client client;
|
||||||
final void Function(Client) onTap;
|
final void Function(Client) onTap;
|
||||||
final void Function(Client) onLongPress;
|
final void Function(Client) onLongPress;
|
||||||
final void Function(Client) onEdit;
|
final void Function(Client)? onEdit;
|
||||||
final void Function(Client) onDelete;
|
final void Function(Client) onDelete;
|
||||||
final Client? selectedClient;
|
final Client? selectedClient;
|
||||||
final bool? splitView;
|
final bool? splitView;
|
||||||
|
@ -25,7 +25,7 @@ class AddedClientTile extends StatelessWidget {
|
||||||
required this.client,
|
required this.client,
|
||||||
required this.onTap,
|
required this.onTap,
|
||||||
required this.onLongPress,
|
required this.onLongPress,
|
||||||
required this.onEdit,
|
this.onEdit,
|
||||||
required this.onDelete,
|
required this.onDelete,
|
||||||
this.selectedClient,
|
this.selectedClient,
|
||||||
required this.splitView,
|
required this.splitView,
|
||||||
|
@ -44,12 +44,12 @@ class AddedClientTile extends StatelessWidget {
|
||||||
borderRadius: BorderRadius.circular(28),
|
borderRadius: BorderRadius.circular(28),
|
||||||
child: ContextMenuArea(
|
child: ContextMenuArea(
|
||||||
builder: (context) => [
|
builder: (context) => [
|
||||||
CustomListTile(
|
if (onEdit != null) CustomListTile(
|
||||||
title: AppLocalizations.of(context)!.edit,
|
title: AppLocalizations.of(context)!.edit,
|
||||||
icon: Icons.edit_rounded,
|
icon: Icons.edit_rounded,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
onEdit(client);
|
onEdit!(client);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
CustomListTile(
|
CustomListTile(
|
||||||
|
@ -185,12 +185,12 @@ class AddedClientTile extends StatelessWidget {
|
||||||
else {
|
else {
|
||||||
return ContextMenuArea(
|
return ContextMenuArea(
|
||||||
builder: (context) => [
|
builder: (context) => [
|
||||||
CustomListTile(
|
if (onEdit != null) CustomListTile(
|
||||||
title: AppLocalizations.of(context)!.seeDetails,
|
title: AppLocalizations.of(context)!.seeDetails,
|
||||||
icon: Icons.file_open_rounded,
|
icon: Icons.file_open_rounded,
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
onEdit(client);
|
onEdit!(client);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
CustomListTile(
|
CustomListTile(
|
||||||
|
|
|
@ -1,19 +1,16 @@
|
||||||
// ignore_for_file: use_build_context_synchronously
|
// ignore_for_file: use_build_context_synchronously
|
||||||
|
|
||||||
import 'dart:io';
|
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:provider/provider.dart';
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
import 'package:adguard_home_manager/screens/clients/client/client_screen.dart';
|
|
||||||
|
|
||||||
import 'package:adguard_home_manager/screens/clients/client/client_screen_functions.dart';
|
import 'package:adguard_home_manager/screens/clients/client/client_screen_functions.dart';
|
||||||
|
|
||||||
import 'package:adguard_home_manager/functions/snackbar.dart';
|
import 'package:adguard_home_manager/functions/snackbar.dart';
|
||||||
|
import 'package:adguard_home_manager/providers/status_provider.dart';
|
||||||
import 'package:adguard_home_manager/providers/clients_provider.dart';
|
import 'package:adguard_home_manager/providers/clients_provider.dart';
|
||||||
import 'package:adguard_home_manager/models/clients.dart';
|
import 'package:adguard_home_manager/models/clients.dart';
|
||||||
import 'package:adguard_home_manager/classes/process_modal.dart';
|
import 'package:adguard_home_manager/classes/process_modal.dart';
|
||||||
import 'package:adguard_home_manager/providers/status_provider.dart';
|
|
||||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||||
|
|
||||||
class ClientsFab extends StatelessWidget {
|
class ClientsFab extends StatelessWidget {
|
||||||
|
@ -21,8 +18,8 @@ class ClientsFab extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
|
||||||
final statusProvider = Provider.of<StatusProvider>(context);
|
final statusProvider = Provider.of<StatusProvider>(context);
|
||||||
|
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||||
final clientsProvider = Provider.of<ClientsProvider>(context);
|
final clientsProvider = Provider.of<ClientsProvider>(context);
|
||||||
|
|
||||||
final width = MediaQuery.of(context).size.width;
|
final width = MediaQuery.of(context).size.width;
|
||||||
|
@ -59,9 +56,14 @@ class ClientsFab extends StatelessWidget {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FloatingActionButton(
|
if (statusProvider.serverStatus != null) {
|
||||||
onPressed: openAddClient,
|
return FloatingActionButton(
|
||||||
child: const Icon(Icons.add),
|
onPressed: openAddClient,
|
||||||
);
|
child: const Icon(Icons.add),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return const SizedBox();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
import 'package:provider/provider.dart';
|
||||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||||
|
|
||||||
|
import 'package:adguard_home_manager/providers/status_provider.dart';
|
||||||
import 'package:adguard_home_manager/widgets/custom_list_tile_dialog.dart';
|
import 'package:adguard_home_manager/widgets/custom_list_tile_dialog.dart';
|
||||||
|
|
||||||
class OptionsModal extends StatelessWidget {
|
class OptionsModal extends StatelessWidget {
|
||||||
|
@ -15,6 +17,8 @@ class OptionsModal extends StatelessWidget {
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
|
final statusProvider = Provider.of<StatusProvider>(context);
|
||||||
|
|
||||||
return AlertDialog(
|
return AlertDialog(
|
||||||
contentPadding: const EdgeInsets.symmetric(
|
contentPadding: const EdgeInsets.symmetric(
|
||||||
horizontal: 0,
|
horizontal: 0,
|
||||||
|
@ -39,7 +43,7 @@ class OptionsModal extends StatelessWidget {
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: [
|
children: [
|
||||||
const SizedBox(height: 24),
|
const SizedBox(height: 24),
|
||||||
CustomListTileDialog(
|
if (statusProvider.serverStatus != null) CustomListTileDialog(
|
||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
onEdit();
|
onEdit();
|
||||||
|
|
|
@ -231,7 +231,9 @@ class _SearchClientsState extends State<SearchClients> {
|
||||||
: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
: const EdgeInsets.symmetric(horizontal: 20, vertical: 15),
|
||||||
isThreeLine: true,
|
isThreeLine: true,
|
||||||
onLongPress: () => openOptionsModal(clientsScreen[index]),
|
onLongPress: () => openOptionsModal(clientsScreen[index]),
|
||||||
onTap: () => openClientModal(clientsScreen[index]),
|
onTap: statusProvider.serverStatus != null
|
||||||
|
? () => openClientModal(clientsScreen[index])
|
||||||
|
: null,
|
||||||
title: Padding(
|
title: Padding(
|
||||||
padding: const EdgeInsets.only(bottom: 5),
|
padding: const EdgeInsets.only(bottom: 5),
|
||||||
child: Text(
|
child: Text(
|
||||||
|
|
Loading…
Add table
Reference in a new issue