mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-04-23 15:29:13 +00:00
Fixed split view
This commit is contained in:
parent
954a8ad496
commit
de8a7818c3
8 changed files with 66 additions and 53 deletions
|
@ -607,5 +607,7 @@
|
|||
"safeSearchSettings": "Safe search settings",
|
||||
"loadingSafeSearchSettings": "Loading safe search settings...",
|
||||
"safeSearchSettingsNotLoaded": "Error when loading safe search settings.",
|
||||
"loadingLogsSettings": "Loading logs settings..."
|
||||
"loadingLogsSettings": "Loading logs settings...",
|
||||
"selectOptionLeftColumn": "Select an option of the left column",
|
||||
"selectClientLeftColumn": "Select a client of the left column"
|
||||
}
|
|
@ -607,5 +607,7 @@
|
|||
"safeSearchSettings": "Configuración de búsqueda segura",
|
||||
"loadingSafeSearchSettings": "Cargando configuración de búsqueda segura...",
|
||||
"safeSearchSettingsNotLoaded": "Error al cargar la configuración de búsqueda segura.",
|
||||
"loadingLogsSettings": "Cargando configuración de registros..."
|
||||
"loadingLogsSettings": "Cargando configuración de registros...",
|
||||
"selectOptionLeftColumn": "Selecciona una opción de la columna de la izquierda",
|
||||
"selectClientLeftColumn": "Selecciona un cliente de la columna de la izquierda"
|
||||
}
|
|
@ -166,9 +166,11 @@ class AppConfigProvider with ChangeNotifier {
|
|||
notifyListeners();
|
||||
}
|
||||
|
||||
void setSelectedSettingsScreen(int? screen) {
|
||||
void setSelectedSettingsScreen({required int? screen, bool? notify}) {
|
||||
_selectedSettingsScreen = screen;
|
||||
notifyListeners();
|
||||
if (notify == true) {
|
||||
notifyListeners();
|
||||
}
|
||||
}
|
||||
|
||||
Future<bool> setOverrideSslCheck(bool status) async {
|
||||
|
|
|
@ -172,8 +172,20 @@ class _ClientsWidgetState extends State<ClientsWidget> with TickerProviderStateM
|
|||
if (!(Platform.isAndroid || Platform.isIOS)) {
|
||||
if (width > 900) {
|
||||
return SplitView.material(
|
||||
breakpoint: 900,
|
||||
hideDivider: true,
|
||||
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
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: ClientsDesktopView(
|
||||
serversProvider: serversProvider,
|
||||
appConfigProvider: appConfigProvider,
|
||||
|
|
|
@ -29,6 +29,7 @@ import 'package:adguard_home_manager/functions/compare_versions.dart';
|
|||
import 'package:adguard_home_manager/constants/urls.dart';
|
||||
import 'package:adguard_home_manager/providers/servers_provider.dart';
|
||||
import 'package:adguard_home_manager/providers/app_config_provider.dart';
|
||||
|
||||
class Settings extends StatelessWidget {
|
||||
const Settings({Key? key}) : super(key: key);
|
||||
|
||||
|
@ -36,11 +37,23 @@ class Settings extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
|
||||
if (width > 900 || !(Platform.isAndroid || Platform.isIOS)) {
|
||||
return const SplitView.material(
|
||||
breakpoint: 900,
|
||||
if (width > 900) {
|
||||
return SplitView.material(
|
||||
hideDivider: true,
|
||||
child: SettingsWidget(),
|
||||
placeholder: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(24),
|
||||
child: Text(
|
||||
AppLocalizations.of(context)!.selectOptionLeftColumn,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 24,
|
||||
color: Theme.of(context).colorScheme.onSurfaceVariant
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: const SettingsWidget(),
|
||||
);
|
||||
}
|
||||
else {
|
||||
|
@ -58,6 +71,10 @@ class SettingsWidget extends StatelessWidget {
|
|||
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
|
||||
if (width <= 900 && appConfigProvider.selectedSettingsScreen != null) {
|
||||
appConfigProvider.setSelectedSettingsScreen(screen: null);
|
||||
}
|
||||
|
||||
Widget settingsTile({
|
||||
required String title,
|
||||
required String subtitle,
|
||||
|
@ -75,7 +92,7 @@ class SettingsWidget extends StatelessWidget {
|
|||
thisItem: thisItem,
|
||||
selectedItem: appConfigProvider.selectedSettingsScreen,
|
||||
onTap: () {
|
||||
appConfigProvider.setSelectedSettingsScreen(thisItem);
|
||||
appConfigProvider.setSelectedSettingsScreen(screen: thisItem, notify: true);
|
||||
SplitView.of(context).setSecondary(screenToNavigate);
|
||||
},
|
||||
);
|
||||
|
@ -87,15 +104,9 @@ class SettingsWidget extends StatelessWidget {
|
|||
icon: icon,
|
||||
trailing: trailing,
|
||||
onTap: () {
|
||||
appConfigProvider.setSelectedSettingsScreen(thisItem);
|
||||
if (!(Platform.isIOS || Platform.isAndroid)) {
|
||||
SplitView.of(context).setSecondary(screenToNavigate);
|
||||
}
|
||||
else {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => screenToNavigate)
|
||||
);
|
||||
}
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(builder: (context) => screenToNavigate)
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ class BottomNavBar extends StatelessWidget {
|
|||
}
|
||||
// Reset settings selected screen
|
||||
if (value != screens.length-1) {
|
||||
appConfigProvider.setSelectedSettingsScreen(null);
|
||||
appConfigProvider.setSelectedSettingsScreen(screen: null);
|
||||
}
|
||||
appConfigProvider.setSelectedScreen(value);
|
||||
},
|
||||
|
|
|
@ -26,8 +26,6 @@ class CustomSettingsTile extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final width = MediaQuery.of(context).size.width;
|
||||
|
||||
Widget tileBody = Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
children: [
|
||||
|
@ -80,41 +78,27 @@ class CustomSettingsTile extends StatelessWidget {
|
|||
],
|
||||
);
|
||||
|
||||
if (width < 700) {
|
||||
return Material(
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
child: InkWell(
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: tileBody,
|
||||
)
|
||||
),
|
||||
);
|
||||
}
|
||||
else {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12),
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
color: thisItem == selectedItem
|
||||
? Theme.of(context).colorScheme.primaryContainer
|
||||
: null
|
||||
),
|
||||
child: tileBody
|
||||
onTap: onTap,
|
||||
child: Container(
|
||||
width: double.maxFinite,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: BorderRadius.circular(28),
|
||||
color: thisItem == selectedItem
|
||||
? Theme.of(context).colorScheme.primaryContainer
|
||||
: null
|
||||
),
|
||||
child: tileBody
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
|
@ -68,7 +68,7 @@ class SideNavigationRail extends StatelessWidget {
|
|||
}
|
||||
// Reset settings selected screen
|
||||
if (value != screens.length-1) {
|
||||
appConfigProvider.setSelectedSettingsScreen(null);
|
||||
appConfigProvider.setSelectedSettingsScreen(screen: null);
|
||||
}
|
||||
appConfigProvider.setSelectedScreen(value);
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue