2022-09-28 15:47:43 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2023-10-29 02:19:00 +01:00
|
|
|
import 'package:flutter_split_view/flutter_split_view.dart';
|
2022-09-28 15:47:43 +02:00
|
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.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';
|
|
|
|
|
2023-05-24 14:16:53 +02:00
|
|
|
class Clients extends StatefulWidget {
|
2023-10-29 02:19:00 +01:00
|
|
|
const Clients({Key? key}) : super(key: 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-10-29 02:19:00 +01:00
|
|
|
return LayoutBuilder(
|
|
|
|
builder: (context, constraints) {
|
|
|
|
if (constraints.maxWidth > 1000) {
|
|
|
|
return SplitView.material(
|
|
|
|
hideDivider: true,
|
|
|
|
flexWidth: const FlexWidth(mainViewFlexWidth: 1, secondaryViewFlexWidth: 2),
|
|
|
|
placeholder: Center(
|
|
|
|
child: Padding(
|
|
|
|
padding: const EdgeInsets.all(24),
|
|
|
|
child: Text(
|
|
|
|
AppLocalizations.of(context)!.selectClientLeftColumn,
|
|
|
|
textAlign: TextAlign.center,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 24,
|
|
|
|
color: Theme.of(context).colorScheme.onSurfaceVariant
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
2023-05-02 13:42:01 +02:00
|
|
|
),
|
2023-10-29 02:19:00 +01:00
|
|
|
child: const ClientsLists(
|
|
|
|
splitView: true,
|
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return const ClientsLists(
|
|
|
|
splitView: false,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
2023-10-28 22:38:49 +02:00
|
|
|
);
|
2022-09-28 15:47:43 +02:00
|
|
|
}
|
|
|
|
}
|