2022-09-28 15:47:43 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
2023-10-29 02:19:00 +01:00
|
|
|
import 'package:adguard_home_manager/screens/clients/clients_lists.dart';
|
2022-09-28 15:47:43 +02:00
|
|
|
|
|
|
|
import 'package:adguard_home_manager/models/clients.dart';
|
|
|
|
|
2024-03-10 21:15:24 +01:00
|
|
|
final clientsNavigatorKey = GlobalKey<NavigatorState>();
|
|
|
|
|
2023-05-24 14:16:53 +02:00
|
|
|
class Clients extends StatefulWidget {
|
2023-11-26 05:21:35 +01:00
|
|
|
const Clients({super.key});
|
2022-09-28 15:47:43 +02:00
|
|
|
|
|
|
|
@override
|
2023-05-24 14:16:53 +02:00
|
|
|
State<Clients> createState() => _ClientsState();
|
2022-09-28 15:47:43 +02:00
|
|
|
}
|
|
|
|
|
2023-05-24 14:16:53 +02:00
|
|
|
class _ClientsState extends State<Clients> with TickerProviderStateMixin {
|
2022-09-29 00:13:54 +02:00
|
|
|
List<AutoClient> generateClientsList(List<AutoClient> clients, List<String> ips) {
|
|
|
|
return clients.where((client) => ips.contains(client.ip)).toList();
|
|
|
|
}
|
|
|
|
|
2022-09-28 15:47:43 +02:00
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-11-26 05:21:35 +01:00
|
|
|
return Scaffold(
|
|
|
|
body: LayoutBuilder(
|
|
|
|
builder: (context, constraints) {
|
2024-02-09 03:00:42 +01:00
|
|
|
if (constraints.maxWidth > 900) {
|
2024-03-10 21:15:24 +01:00
|
|
|
return Row(
|
|
|
|
children: [
|
|
|
|
const Expanded(
|
|
|
|
flex: 1,
|
|
|
|
child: ClientsLists(
|
|
|
|
splitView: true,
|
|
|
|
)
|
2023-10-29 02:19:00 +01:00
|
|
|
),
|
2024-03-10 21:15:24 +01:00
|
|
|
Expanded(
|
|
|
|
flex: 2,
|
|
|
|
child: Navigator(
|
|
|
|
key: clientsNavigatorKey,
|
|
|
|
onGenerateRoute: (settings) => MaterialPageRoute(builder: (ctx) => const SizedBox()),
|
|
|
|
),
|
2023-11-26 05:21:35 +01:00
|
|
|
)
|
2024-03-10 21:15:24 +01:00
|
|
|
],
|
|
|
|
);
|
2023-11-26 05:21:35 +01:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
return const ClientsLists(
|
|
|
|
splitView: false,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
|
|
|
),
|
2023-10-28 22:38:49 +02:00
|
|
|
);
|
2022-09-28 15:47:43 +02:00
|
|
|
}
|
|
|
|
}
|