Add the Flutter video editing application with project management, media import, timeline editing, preview, AI assistance, diagnostics and settings. Include shared UI and native host packages, platform runners, application tests and release tooling. Provide usage and contribution guides, the MIT license and third-party notices. Exclude local credentials, build outputs and validation data.
58 lines
1.9 KiB
Dart
58 lines
1.9 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:cutdex_ui/widgets.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
|
|
import '../../diagnostics/app_diagnostics.dart';
|
|
import '../../integrations/platform/file_picker.dart';
|
|
import '../../l10n/l10n.dart';
|
|
import '../../settings/settings_operation.dart';
|
|
|
|
class DiagnosticSettings extends ConsumerStatefulWidget {
|
|
const DiagnosticSettings({super.key});
|
|
|
|
@override
|
|
ConsumerState<DiagnosticSettings> createState() => _DiagnosticSettingsState();
|
|
}
|
|
|
|
class _DiagnosticSettingsState extends ConsumerState<DiagnosticSettings> {
|
|
bool _exported = false;
|
|
|
|
Future<void> _export() async {
|
|
setState(() => _exported = false);
|
|
final picker = ref.read(filePickerProvider);
|
|
await ref.read(settingsOperationProvider('diagnosticsExport').notifier).run(
|
|
() async {
|
|
final selected = await picker.pickDirectory();
|
|
if (selected == null) return;
|
|
final diagnostics =
|
|
AppDiagnostics.instance ?? await AppDiagnostics.initialize();
|
|
await diagnostics.export(Directory(selected));
|
|
if (mounted) setState(() => _exported = true);
|
|
},
|
|
);
|
|
}
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final operation = ref.watch(settingsOperationProvider('diagnosticsExport'));
|
|
return AppField(
|
|
label: context.l10n.diagnostics,
|
|
orientation: AppFieldOrientation.horizontal,
|
|
error: operation.hasError ? context.l10n.exportDiagnosticsFailed : null,
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.end,
|
|
children: [
|
|
OutlinedButton(
|
|
key: const Key('export-diagnostics'),
|
|
onPressed: operation.isLoading ? null : _export,
|
|
child: Text(context.l10n.exportDiagnostics),
|
|
),
|
|
if (_exported) Text(context.l10n.exportDiagnosticsSucceeded),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|