2022-09-27 14:29:36 +02:00
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
|
|
|
|
|
|
|
|
import 'package:adguard_home_manager/screens/home/status_box.dart';
|
|
|
|
|
|
|
|
import 'package:adguard_home_manager/models/server_status.dart';
|
|
|
|
|
|
|
|
class ServerStatus extends StatelessWidget {
|
|
|
|
final ServerStatusData serverStatus;
|
|
|
|
|
|
|
|
const ServerStatus({
|
|
|
|
Key? key,
|
|
|
|
required this.serverStatus,
|
|
|
|
}) : super(key: key);
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
2023-05-01 14:38:46 +02:00
|
|
|
final width = MediaQuery.of(context).size.width;
|
|
|
|
|
2022-09-27 14:29:36 +02:00
|
|
|
return Container(
|
2023-05-20 22:57:38 +02:00
|
|
|
padding: const EdgeInsets.only(left: 16, right: 16, bottom: 16),
|
2022-09-27 14:29:36 +02:00
|
|
|
child: Column(
|
|
|
|
children: [
|
2023-05-21 02:03:33 +02:00
|
|
|
Text(
|
|
|
|
AppLocalizations.of(context)!.serverStatus,
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 18,
|
|
|
|
fontWeight: FontWeight.w500,
|
|
|
|
color: Theme.of(context).colorScheme.onSurface
|
2022-09-27 14:29:36 +02:00
|
|
|
),
|
|
|
|
),
|
2023-05-21 02:03:33 +02:00
|
|
|
const SizedBox(height: 16),
|
2022-09-27 14:29:36 +02:00
|
|
|
SizedBox(
|
2023-05-21 02:03:33 +02:00
|
|
|
height: width > 700 ? 66 : 146,
|
2022-09-27 14:29:36 +02:00
|
|
|
child: GridView(
|
2023-05-21 02:03:33 +02:00
|
|
|
padding: const EdgeInsets.all(0),
|
2022-09-27 14:29:36 +02:00
|
|
|
physics: const NeverScrollableScrollPhysics(),
|
2023-05-01 14:38:46 +02:00
|
|
|
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount(
|
|
|
|
crossAxisCount: width > 700 ? 4 : 2,
|
2022-09-27 14:29:36 +02:00
|
|
|
crossAxisSpacing: 10,
|
|
|
|
mainAxisSpacing: 10,
|
|
|
|
mainAxisExtent: 65
|
|
|
|
),
|
|
|
|
children: [
|
|
|
|
StatusBox(
|
|
|
|
icon: Icons.filter_list_rounded,
|
2022-09-27 18:42:23 +02:00
|
|
|
label: AppLocalizations.of(context)!.ruleFilteringWidget,
|
2022-09-27 14:29:36 +02:00
|
|
|
isEnabled: serverStatus.filteringEnabled
|
|
|
|
),
|
|
|
|
StatusBox(
|
|
|
|
icon: Icons.vpn_lock_rounded,
|
2022-09-27 18:42:23 +02:00
|
|
|
label: AppLocalizations.of(context)!.safeBrowsingWidget,
|
2022-09-27 14:29:36 +02:00
|
|
|
isEnabled: serverStatus.safeBrowsingEnabled
|
|
|
|
),
|
|
|
|
StatusBox(
|
|
|
|
icon: Icons.block,
|
2022-09-27 18:42:23 +02:00
|
|
|
label: AppLocalizations.of(context)!.parentalFilteringWidget,
|
2022-09-27 14:29:36 +02:00
|
|
|
isEnabled: serverStatus.parentalControlEnabled
|
|
|
|
),
|
|
|
|
StatusBox(
|
|
|
|
icon: Icons.search_rounded,
|
2022-09-27 18:42:23 +02:00
|
|
|
label: AppLocalizations.of(context)!.safeSearchWidget,
|
2022-09-27 14:29:36 +02:00
|
|
|
isEnabled: serverStatus.safeSearchEnabled
|
|
|
|
),
|
|
|
|
],
|
|
|
|
),
|
|
|
|
)
|
|
|
|
],
|
|
|
|
),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|