|
14 | 14 | * limitations under the License.
|
15 | 15 | */
|
16 | 16 |
|
17 |
| -import 'dart:convert'; |
18 |
| -import 'dart:io'; |
19 |
| - |
20 | 17 | import 'package:flutter/material.dart';
|
21 | 18 | import 'package:flutter_riverpod/flutter_riverpod.dart';
|
22 |
| -import 'package:logging/logging.dart'; |
23 |
| -import 'package:material_symbols_icons/symbols.dart'; |
24 | 19 |
|
25 |
| -import 'android/state.dart'; |
26 | 20 | import 'app/app_url_launcher.dart';
|
27 |
| -import 'app/logging.dart'; |
28 |
| -import 'app/message.dart'; |
29 |
| -import 'app/state.dart'; |
30 | 21 | import 'app/views/keys.dart';
|
31 |
| -import 'core/state.dart'; |
32 |
| -import 'desktop/state.dart'; |
33 | 22 | import 'generated/l10n/app_localizations.dart';
|
34 | 23 | import 'version.dart';
|
35 |
| -import 'widgets/choice_filter_chip.dart'; |
36 | 24 | import 'widgets/responsive_dialog.dart';
|
37 | 25 |
|
38 |
| -final _log = Logger('about'); |
39 |
| - |
40 | 26 | class AboutPage extends ConsumerWidget {
|
41 | 27 | const AboutPage({super.key});
|
42 | 28 |
|
@@ -136,120 +122,9 @@ class AboutPage extends ConsumerWidget {
|
136 | 122 | ),
|
137 | 123 | ],
|
138 | 124 | ),
|
139 |
| - const Padding( |
140 |
| - padding: EdgeInsets.only(top: 24.0, bottom: 8.0), |
141 |
| - child: Divider(), |
142 |
| - ), |
143 |
| - Padding( |
144 |
| - padding: const EdgeInsets.symmetric(vertical: 16.0), |
145 |
| - child: Text( |
146 |
| - l10n.s_troubleshooting, |
147 |
| - style: Theme.of(context).textTheme.titleMedium, |
148 |
| - ), |
149 |
| - ), |
150 |
| - const LoggingPanel(), |
151 |
| - |
152 |
| - // Diagnostics (desktop only) |
153 |
| - if (isDesktop) ...[ |
154 |
| - const SizedBox(height: 12.0), |
155 |
| - ActionChip( |
156 |
| - key: diagnosticsChip, |
157 |
| - avatar: const Icon(Symbols.bug_report), |
158 |
| - label: Text(l10n.s_run_diagnostics), |
159 |
| - onPressed: () async { |
160 |
| - _log.info('Running diagnostics...'); |
161 |
| - final response = await ref |
162 |
| - .read(rpcProvider) |
163 |
| - .requireValue |
164 |
| - .command('diagnose', []); |
165 |
| - final data = response['diagnostics'] as List; |
166 |
| - data.insert(0, { |
167 |
| - 'app_version': version, |
168 |
| - 'dart': Platform.version, |
169 |
| - 'os': Platform.operatingSystem, |
170 |
| - 'os_version': Platform.operatingSystemVersion, |
171 |
| - }); |
172 |
| - data.insert(data.length - 1, ref.read(featureFlagProvider)); |
173 |
| - final text = const JsonEncoder.withIndent(' ').convert(data); |
174 |
| - await ref.read(clipboardProvider).setText(text); |
175 |
| - await ref.read(withContextProvider)( |
176 |
| - (context) async { |
177 |
| - showMessage(context, l10n.l_diagnostics_copied); |
178 |
| - }, |
179 |
| - ); |
180 |
| - }, |
181 |
| - ), |
182 |
| - ], |
183 |
| - |
184 |
| - // Enable screenshots (Android only) |
185 |
| - if (isAndroid) ...[ |
186 |
| - const SizedBox(height: 12.0), |
187 |
| - FilterChip( |
188 |
| - key: screenshotChip, |
189 |
| - label: Text(l10n.s_allow_screenshots), |
190 |
| - selected: ref.watch(androidAllowScreenshotsProvider), |
191 |
| - onSelected: (value) async { |
192 |
| - ref |
193 |
| - .read(androidAllowScreenshotsProvider.notifier) |
194 |
| - .setAllowScreenshots(value); |
195 |
| - }, |
196 |
| - ), |
197 |
| - ], |
198 | 125 | ],
|
199 | 126 | ),
|
200 | 127 | ),
|
201 | 128 | );
|
202 | 129 | }
|
203 | 130 | }
|
204 |
| - |
205 |
| -class LoggingPanel extends ConsumerWidget { |
206 |
| - const LoggingPanel({super.key}); |
207 |
| - |
208 |
| - @override |
209 |
| - Widget build(BuildContext context, WidgetRef ref) { |
210 |
| - final l10n = AppLocalizations.of(context); |
211 |
| - final logLevel = ref.watch(logLevelProvider); |
212 |
| - return Wrap( |
213 |
| - alignment: WrapAlignment.center, |
214 |
| - spacing: 4.0, |
215 |
| - runSpacing: 8.0, |
216 |
| - children: [ |
217 |
| - ChoiceFilterChip<Level>( |
218 |
| - avatar: Icon( |
219 |
| - Symbols.insights, |
220 |
| - color: Theme.of(context).colorScheme.primary, |
221 |
| - ), |
222 |
| - value: logLevel, |
223 |
| - items: Levels.LEVELS, |
224 |
| - selected: logLevel != Level.INFO, |
225 |
| - labelBuilder: (value) => Text(l10n.s_log_level( |
226 |
| - value.name[0] + value.name.substring(1).toLowerCase())), |
227 |
| - itemBuilder: (value) => |
228 |
| - Text('${value.name[0]}${value.name.substring(1).toLowerCase()}'), |
229 |
| - onChanged: (level) { |
230 |
| - ref.read(logLevelProvider.notifier).setLogLevel(level); |
231 |
| - _log.debug('Log level set to $level'); |
232 |
| - }, |
233 |
| - ), |
234 |
| - ActionChip( |
235 |
| - key: logChip, |
236 |
| - avatar: const Icon(Symbols.content_copy), |
237 |
| - label: Text(l10n.s_copy_log), |
238 |
| - onPressed: () async { |
239 |
| - _log.info('Copying log to clipboard ($version)...'); |
240 |
| - final logs = await ref.read(logLevelProvider.notifier).getLogs(); |
241 |
| - var clipboard = ref.read(clipboardProvider); |
242 |
| - await clipboard.setText(logs.join('\n')); |
243 |
| - if (!clipboard.platformGivesFeedback()) { |
244 |
| - await ref.read(withContextProvider)( |
245 |
| - (context) async { |
246 |
| - showMessage(context, l10n.l_log_copied); |
247 |
| - }, |
248 |
| - ); |
249 |
| - } |
250 |
| - }, |
251 |
| - ), |
252 |
| - ], |
253 |
| - ); |
254 |
| - } |
255 |
| -} |
0 commit comments