12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- // @dart=2.9
- import 'package:expandable/expandable.dart';
- import 'package:flutter/material.dart';
- import 'package:flutter_sodium/flutter_sodium.dart';
- import 'package:photos/core/configuration.dart';
- import 'package:photos/ui/settings/common_settings.dart';
- import 'package:photos/ui/settings/settings_section_title.dart';
- import 'package:photos/ui/settings/settings_text_item.dart';
- class DebugSectionWidget extends StatelessWidget {
- const DebugSectionWidget({Key key}) : super(key: key);
- @override
- Widget build(BuildContext context) {
- return ExpandablePanel(
- header: const SettingsSectionTitle("Debug"),
- collapsed: Container(),
- expanded: _getSectionOptions(context),
- theme: getExpandableTheme(context),
- );
- }
- Widget _getSectionOptions(BuildContext context) {
- return Column(
- children: [
- GestureDetector(
- behavior: HitTestBehavior.translucent,
- onTap: () async {
- _showKeyAttributesDialog(context);
- },
- child: const SettingsTextItem(
- text: "Key attributes",
- icon: Icons.navigate_next,
- ),
- ),
- ],
- );
- }
- void _showKeyAttributesDialog(BuildContext context) {
- final keyAttributes = Configuration.instance.getKeyAttributes();
- final AlertDialog alert = AlertDialog(
- title: const Text("key attributes"),
- content: SingleChildScrollView(
- child: Column(
- children: [
- const Text(
- "Key",
- style: TextStyle(fontWeight: FontWeight.bold),
- ),
- Text(Sodium.bin2base64(Configuration.instance.getKey())),
- const Padding(padding: EdgeInsets.all(12)),
- const Text(
- "Encrypted Key",
- style: TextStyle(fontWeight: FontWeight.bold),
- ),
- Text(keyAttributes.encryptedKey),
- const Padding(padding: EdgeInsets.all(12)),
- const Text(
- "Key Decryption Nonce",
- style: TextStyle(fontWeight: FontWeight.bold),
- ),
- Text(keyAttributes.keyDecryptionNonce),
- const Padding(padding: EdgeInsets.all(12)),
- const Text(
- "KEK Salt",
- style: TextStyle(fontWeight: FontWeight.bold),
- ),
- Text(keyAttributes.kekSalt),
- const Padding(padding: EdgeInsets.all(12)),
- ],
- ),
- ),
- actions: [
- TextButton(
- child: const Text("OK"),
- onPressed: () {
- Navigator.of(context, rootNavigator: true).pop('dialog');
- },
- ),
- ],
- );
- showDialog(
- context: context,
- builder: (BuildContext context) {
- return alert;
- },
- );
- }
- }
|