mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-16 15:02:53 +00:00
Adapted clients screen
This commit is contained in:
parent
5660aefdc5
commit
3c92457040
14 changed files with 1249 additions and 373 deletions
|
@ -1,5 +1,7 @@
|
|||
// ignore_for_file: use_build_context_synchronously
|
||||
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
||||
|
@ -23,6 +25,8 @@ class ClientsFab extends StatelessWidget {
|
|||
final serversProvider = Provider.of<ServersProvider>(context);
|
||||
final appConfigProvider = Provider.of<AppConfigProvider>(context);
|
||||
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
|
||||
void confirmAddClient(Client client) async {
|
||||
ProcessModal processModal = ProcessModal(context: context);
|
||||
processModal.open(AppLocalizations.of(context)!.addingClient);
|
||||
|
@ -65,13 +69,27 @@ class ClientsFab extends StatelessWidget {
|
|||
}
|
||||
|
||||
void openAddClient() {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (BuildContext context) => ClientScreen(
|
||||
onConfirm: confirmAddClient,
|
||||
serverVersion: serversProvider.serverStatus.data!.serverVersion,
|
||||
)
|
||||
));
|
||||
if (width > 900 || !(Platform.isAndroid | Platform.isIOS)) {
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) => ClientScreen(
|
||||
onConfirm: confirmAddClient,
|
||||
serverVersion: serversProvider.serverStatus.data!.serverVersion,
|
||||
dialog: true,
|
||||
)
|
||||
);
|
||||
}
|
||||
else {
|
||||
Navigator.push(context, MaterialPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (BuildContext context) => ClientScreen(
|
||||
onConfirm: confirmAddClient,
|
||||
serverVersion: serversProvider.serverStatus.data!.serverVersion,
|
||||
dialog: false,
|
||||
)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return FloatingActionButton(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue