2023-07-06 17:18:41 +03:30
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
|
import 'package:hiddify/core/core_providers.dart';
|
|
|
|
|
import 'package:hiddify/core/router/router.dart';
|
2023-08-30 16:18:38 +03:30
|
|
|
import 'package:hiddify/features/common/stats/stats_overview.dart';
|
2023-07-06 17:18:41 +03:30
|
|
|
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
|
|
|
|
|
|
|
|
|
class DesktopWrapper extends HookConsumerWidget {
|
|
|
|
|
const DesktopWrapper(this.navigator, {super.key});
|
|
|
|
|
|
|
|
|
|
final Widget navigator;
|
|
|
|
|
|
|
|
|
|
@override
|
|
|
|
|
Widget build(BuildContext context, WidgetRef ref) {
|
|
|
|
|
final t = ref.watch(translationsProvider);
|
|
|
|
|
|
|
|
|
|
final currentIndex = getCurrentIndex(context);
|
|
|
|
|
|
|
|
|
|
final destinations = [
|
|
|
|
|
NavigationRailDestination(
|
|
|
|
|
icon: const Icon(Icons.power_settings_new),
|
2023-09-07 01:56:59 +03:30
|
|
|
label: Text(t.home.pageTitle),
|
2023-07-06 17:18:41 +03:30
|
|
|
),
|
|
|
|
|
NavigationRailDestination(
|
|
|
|
|
icon: const Icon(Icons.filter_list),
|
2023-09-07 01:56:59 +03:30
|
|
|
label: Text(t.proxies.pageTitle),
|
2023-07-06 17:18:41 +03:30
|
|
|
),
|
|
|
|
|
NavigationRailDestination(
|
|
|
|
|
icon: const Icon(Icons.article),
|
2023-09-07 01:56:59 +03:30
|
|
|
label: Text(t.logs.pageTitle),
|
2023-07-06 17:18:41 +03:30
|
|
|
),
|
|
|
|
|
NavigationRailDestination(
|
|
|
|
|
icon: const Icon(Icons.settings),
|
2023-09-07 01:56:59 +03:30
|
|
|
label: Text(t.settings.pageTitle),
|
2023-07-06 17:18:41 +03:30
|
|
|
),
|
2023-07-22 16:02:06 +03:30
|
|
|
NavigationRailDestination(
|
|
|
|
|
icon: const Icon(Icons.info),
|
2023-09-07 01:56:59 +03:30
|
|
|
label: Text(t.about.pageTitle),
|
2023-07-22 16:02:06 +03:30
|
|
|
),
|
2023-07-06 17:18:41 +03:30
|
|
|
];
|
|
|
|
|
|
|
|
|
|
return Scaffold(
|
|
|
|
|
body: Row(
|
|
|
|
|
children: [
|
|
|
|
|
SizedBox(
|
|
|
|
|
width: 192,
|
|
|
|
|
child: NavigationRail(
|
|
|
|
|
extended: true,
|
|
|
|
|
minExtendedWidth: 192,
|
|
|
|
|
destinations: destinations,
|
|
|
|
|
selectedIndex: currentIndex,
|
|
|
|
|
onDestinationSelected: (index) => switchTab(index, context),
|
|
|
|
|
trailing: const Expanded(
|
|
|
|
|
child: Align(
|
|
|
|
|
alignment: Alignment.bottomCenter,
|
2023-08-30 16:18:38 +03:30
|
|
|
child: StatsOverview(),
|
2023-07-06 17:18:41 +03:30
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
),
|
|
|
|
|
Expanded(child: navigator),
|
|
|
|
|
],
|
|
|
|
|
),
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|