LCOV - code coverage report
Current view: top level - lib/pages/settings/widgets/recover_tab - recover_file_form.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 40 0
Test Date: 2026-11-14 15:08:11 Functions: - 0 0

            Line data    Source code
       1              : // Copyright 2023 The terCAD team. All rights reserved.
       2              : // Use of this source code is governed by a CC BY-NC-ND 4.0 license that can be found in the LICENSE file.
       3              : 
       4              : import 'package:app_finance/_classes/herald/app_design.dart';
       5              : import 'package:app_finance/_classes/herald/app_locale.dart';
       6              : import 'package:app_finance/_classes/storage/transaction_log/file_protocol.dart';
       7              : import 'package:app_finance/_configs/theme_helper.dart';
       8              : import 'package:app_finance/_ext/build_context_ext.dart';
       9              : import 'package:app_finance/design/form/checkbox_input.dart';
      10              : import 'package:app_finance/design/form/simple_input.dart';
      11              : import 'package:app_finance/design/wrapper/required_widget.dart';
      12              : import 'package:app_finance/pages/settings/widgets/recover_tab/nav_button_widget.dart';
      13              : import 'package:app_finance/pages/settings/widgets/recover_tab/recovery_type.dart';
      14              : import 'package:material_ui/material_ui.dart';
      15              : 
      16              : class RecoverFileForm extends StatefulWidget {
      17              :   final Function cbMessage;
      18              :   final Function cbProgress;
      19              :   final Function cbType;
      20              :   final Function cbFinal;
      21              :   final String message;
      22              : 
      23            0 :   const RecoverFileForm({
      24              :     super.key,
      25              :     required this.cbMessage,
      26              :     required this.cbProgress,
      27              :     required this.cbType,
      28              :     required this.cbFinal,
      29              :     this.message = '',
      30              :   });
      31              : 
      32            0 :   @override
      33            0 :   RecoverFileFormState createState() => RecoverFileFormState();
      34              : }
      35              : 
      36              : class RecoverFileFormState extends State<RecoverFileForm> {
      37              :   final path = TextEditingController(text: 'tmp.log');
      38              :   bool isEncrypted = true;
      39              :   bool isCleaned = false;
      40              :   late final FileProtocol file;
      41              : 
      42            0 :   @override
      43              :   void initState() {
      44            0 :     file = FileProtocol(callbackMessage: widget.cbMessage, callbackProgress: widget.cbProgress);
      45            0 :     super.initState();
      46              :   }
      47              : 
      48            0 :   @override
      49              :   Widget build(BuildContext context) {
      50            0 :     final textTheme = context.textTheme;
      51            0 :     return Column(
      52            0 :       crossAxisAlignment: AppDesign.getAlignment(),
      53            0 :       children: [
      54              :         ThemeHelper.hIndent2x,
      55            0 :         NavButtonWidget(
      56            0 :           name: AppLocale.labels.transactionFile,
      57              :           nav: RecoveryType.none,
      58              :           icon: Icons.arrow_left,
      59            0 :           callback: widget.cbType,
      60              :         ),
      61            0 :         Text(
      62            0 :           widget.message,
      63            0 :           style: textTheme.headlineMedium?.copyWith(color: context.colorScheme.inversePrimary),
      64              :         ),
      65            0 :         RequiredWidget(
      66            0 :           title: AppLocale.labels.path,
      67            0 :           showError: widget.message != '' && path.text.isEmpty,
      68              :         ),
      69            0 :         SimpleInput(
      70            0 :           controller: path,
      71              :         ),
      72              :         ThemeHelper.hIndent4x,
      73            0 :         SizedBox(
      74              :           width: double.infinity,
      75            0 :           child: FloatingActionButton(
      76              :             heroTag: 'recover_tab_save',
      77            0 :             onPressed: () => file.save(path.text),
      78            0 :             tooltip: AppLocale.labels.saveTooltip,
      79            0 :             child: Text(AppLocale.labels.saveTooltip),
      80              :           ),
      81              :         ),
      82              :         ThemeHelper.hIndent4x,
      83            0 :         CheckboxInput(
      84            0 :           label: AppLocale.labels.isEncrypted,
      85            0 :           value: isEncrypted,
      86            0 :           onChanged: (value) => setState(() => isEncrypted = value),
      87              :         ),
      88              :         ThemeHelper.hIndent,
      89            0 :         CheckboxInput(
      90            0 :           label: AppLocale.labels.isCleaned,
      91            0 :           value: isCleaned,
      92            0 :           onChanged: (value) => setState(() => isCleaned = value),
      93              :         ),
      94              :         ThemeHelper.hIndent2x,
      95            0 :         SizedBox(
      96              :           width: double.infinity,
      97            0 :           child: FloatingActionButton(
      98              :             heroTag: 'recover_tab_recover',
      99            0 :             onPressed: () => file.load(path.text, isEncrypted, isCleaned).then((_) => widget.cbFinal()),
     100            0 :             tooltip: AppLocale.labels.recoveryTooltip,
     101            0 :             child: Text(AppLocale.labels.recoveryTooltip),
     102              :           ),
     103              :         ),
     104              :       ],
     105              :     );
     106              :   }
     107              : }
        

Generated by: LCOV version 2.0-1