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

            Line data    Source code
       1              : // Copyright 2026 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/app_data.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/wrapper/input_wrapper.dart';
      10              : import 'package:material_ui/material_ui.dart';
      11              : 
      12              : class IntegrationTarget {
      13              :   String? appAccount;
      14              :   String? category;
      15              :   DateTime from;
      16              : 
      17            0 :   IntegrationTarget({this.appAccount, this.category, required this.from});
      18              : }
      19              : 
      20              : class IntegrationAccountCard extends StatelessWidget {
      21              :   final String title;
      22              :   final String? subtitle;
      23              :   final IntegrationTarget target;
      24              :   final AppData state;
      25              :   final bool isDisabled;
      26              :   final VoidCallback onChanged;
      27              :   final VoidCallback onImport;
      28              : 
      29            0 :   const IntegrationAccountCard({
      30              :     super.key,
      31              :     required this.title,
      32              :     required this.target,
      33              :     required this.state,
      34              :     required this.onChanged,
      35              :     required this.onImport,
      36              :     this.subtitle,
      37              :     this.isDisabled = false,
      38              :   });
      39              : 
      40            0 :   @override
      41              :   Widget build(BuildContext context) {
      42            0 :     final textTheme = context.textTheme;
      43            0 :     return Card(
      44            0 :       margin: EdgeInsets.symmetric(vertical: ThemeHelper.getIndent()),
      45            0 :       child: Padding(
      46            0 :         padding: EdgeInsets.all(ThemeHelper.getIndent(2)),
      47            0 :         child: LayoutBuilder(
      48            0 :           builder: (context, constraints) => Column(
      49            0 :             crossAxisAlignment: AppDesign.getAlignment(),
      50            0 :             children: [
      51            0 :               Text(title, style: textTheme.titleMedium),
      52            0 :               if (subtitle != null) Text(subtitle!),
      53            0 :               ThemeHelper.hIndent,
      54            0 :               InputWrapper(
      55              :                 type: NamedInputType.accountSelector,
      56            0 :                 title: AppLocale.labels.account,
      57              :                 isRequired: true,
      58            0 :                 value: target.appAccount != null ? state.getByUuid(target.appAccount!) : null,
      59            0 :                 onChange: (value) {
      60            0 :                   target.appAccount = value?.uuid;
      61            0 :                   onChanged();
      62              :                 },
      63            0 :                 state: state,
      64            0 :                 width: constraints.maxWidth,
      65              :               ),
      66            0 :               InputWrapper(
      67              :                 type: NamedInputType.budgetSelector,
      68            0 :                 title: AppLocale.labels.budget,
      69              :                 isRequired: true,
      70            0 :                 value: target.category != null ? state.getByUuid(target.category!) : null,
      71            0 :                 onChange: (value) {
      72            0 :                   target.category = value?.uuid;
      73            0 :                   onChanged();
      74              :                 },
      75            0 :                 state: state,
      76            0 :                 width: constraints.maxWidth,
      77              :               ),
      78            0 :               InputWrapper(
      79              :                 type: NamedInputType.dateSelector,
      80            0 :                 title: AppLocale.labels.integrationDateFrom,
      81            0 :                 value: target.from,
      82            0 :                 onChange: (value) {
      83            0 :                   target.from = value ?? target.from;
      84            0 :                   onChanged();
      85              :                 },
      86              :               ),
      87            0 :               ThemeHelper.hIndent,
      88            0 :               SizedBox(
      89              :                 width: double.infinity,
      90            0 :                 child: FilledButton.icon(
      91              :                   icon: const Icon(Icons.download),
      92            0 :                   onPressed: isDisabled ? null : onImport,
      93            0 :                   label: Text(AppLocale.labels.integrationImport),
      94              :                 ),
      95              :               ),
      96              :             ],
      97              :           ),
      98              :         ),
      99              :       ),
     100              :     );
     101              :   }
     102              : }
        

Generated by: LCOV version 2.0-1