-
Notifications
You must be signed in to change notification settings - Fork 390
Expand file tree
/
Copy pathaccessibility_controls.dart
More file actions
116 lines (108 loc) · 3.55 KB
/
accessibility_controls.dart
File metadata and controls
116 lines (108 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
// Copyright 2025 The Flutter Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
import 'package:devtools_app_shared/ui.dart';
import 'package:flutter/material.dart';
import '../../shared/globals.dart';
import 'accessibility_controller.dart';
class AccessibilityControls extends StatelessWidget {
const AccessibilityControls({super.key});
@override
Widget build(BuildContext context) {
return Column(
children: [
const AreaPaneHeader(title: Text('Settings & Controls')),
Expanded(
child: ListView(
padding: const EdgeInsets.all(defaultSpacing),
children: const [
_SystemSimulationControls(),
SizedBox(height: defaultSpacing),
_AuditControls(),
],
),
),
],
);
}
}
class _SystemSimulationControls extends StatelessWidget {
const _SystemSimulationControls();
@override
Widget build(BuildContext context) {
final controller = screenControllers.lookup<AccessibilityController>();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'SYSTEM SIMULATION',
style: Theme.of(context).textTheme.titleSmall,
),
const SizedBox(height: denseSpacing),
ValueListenableBuilder<bool>(
valueListenable: controller.highContrastEnabled,
builder: (context, enabled, _) {
return SwitchListTile(
title: const Text('High Contrast Mode'),
value: enabled,
onChanged: (value) => controller.toggleHighContrast(value),
);
},
),
const SizedBox(height: denseSpacing),
ValueListenableBuilder<double>(
valueListenable: controller.textScaleFactor,
builder: (context, factor, _) {
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('Text Scale Factor: ${factor.toStringAsFixed(1)}x'),
Slider(
value: factor,
min: 0.5,
max: 3.0,
divisions: 25,
label: factor.toStringAsFixed(1),
onChanged: (value) => controller.setTextScaleFactor(value),
),
],
);
},
),
],
);
}
}
class _AuditControls extends StatelessWidget {
const _AuditControls();
@override
Widget build(BuildContext context) {
final controller = screenControllers.lookup<AccessibilityController>();
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text('AUDIT CONTROLS', style: Theme.of(context).textTheme.titleSmall),
const SizedBox(height: denseSpacing),
SizedBox(
width: double.infinity,
child: ElevatedButton.icon(
icon: const Icon(Icons.play_arrow),
label: const Text('Run Audit'),
onPressed: () => controller.runAudit(),
),
),
const SizedBox(height: denseSpacing),
ValueListenableBuilder<bool>(
valueListenable: controller.autoAuditEnabled,
builder: (context, enabled, _) {
return SwitchListTile(
title: const Text('Auto-run Audit'),
value: enabled,
onChanged: (value) => controller.toggleAutoAudit(value),
);
},
),
],
);
}
}