Add config options
This commit is contained in:
56
lib/features/settings/widgets/advanced_setting_tiles.dart
Normal file
56
lib/features/settings/widgets/advanced_setting_tiles.dart
Normal file
@@ -0,0 +1,56 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:go_router/go_router.dart';
|
||||
import 'package:hiddify/core/core_providers.dart';
|
||||
import 'package:hiddify/core/prefs/prefs.dart';
|
||||
import 'package:hiddify/core/router/routes/routes.dart';
|
||||
import 'package:hooks_riverpod/hooks_riverpod.dart';
|
||||
|
||||
class AdvancedSettingTiles extends HookConsumerWidget {
|
||||
const AdvancedSettingTiles({super.key});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context, WidgetRef ref) {
|
||||
final t = ref.watch(translationsProvider);
|
||||
|
||||
final debug = ref.watch(debugModeProvider);
|
||||
|
||||
return Column(
|
||||
children: [
|
||||
ListTile(
|
||||
title: Text(t.settings.config.pageTitle),
|
||||
leading: const Icon(Icons.edit_document),
|
||||
onTap: () async {
|
||||
await const ConfigOptionsRoute().push(context);
|
||||
},
|
||||
),
|
||||
SwitchListTile(
|
||||
title: Text(t.settings.advanced.debugMode),
|
||||
value: debug,
|
||||
secondary: const Icon(Icons.bug_report),
|
||||
onChanged: (value) async {
|
||||
if (value) {
|
||||
await showDialog<bool>(
|
||||
context: context,
|
||||
builder: (context) {
|
||||
return AlertDialog(
|
||||
title: Text(t.settings.advanced.debugMode),
|
||||
content: Text(t.settings.advanced.debugModeMsg),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => context.pop(true),
|
||||
child: Text(
|
||||
MaterialLocalizations.of(context).okButtonLabel,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
await ref.read(debugModeProvider.notifier).update(value);
|
||||
},
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user