LCOV - code coverage report
Current view: top level - lib/pages/goal - goal_edit_page.dart Coverage Total Hit
Test: lcov.info Lines: 0.0 % 30 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_locale.dart';
       5              : import 'package:app_finance/_classes/structure/goal_app_data.dart';
       6              : import 'package:app_finance/pages/goal/goal_add_page.dart';
       7              : import 'package:material_ui/material_ui.dart';
       8              : 
       9              : class GoalEditPage extends GoalAddPage {
      10              :   final String uuid;
      11              : 
      12            0 :   const GoalEditPage({
      13              :     super.key,
      14              :     required this.uuid,
      15              :   });
      16              : 
      17            0 :   @override
      18            0 :   GoalEditPageState createState() => GoalEditPageState();
      19              : }
      20              : 
      21              : class GoalEditPageState extends GoalAddPageState<GoalEditPage> {
      22              :   bool isFirstRun = true;
      23              : 
      24            0 :   @override
      25              :   String getTitle() {
      26            0 :     return AppLocale.labels.editGoalHeader;
      27              :   }
      28              : 
      29            0 :   @override
      30              :   void updateStorage() {
      31            0 :     var data = state.getByUuid(widget.uuid) as GoalAppData;
      32            0 :     data.title = title.text;
      33            0 :     data.color = color;
      34            0 :     data.icon = icon;
      35            0 :     data.details = double.tryParse(details.text) ?? 0.0;
      36            0 :     data.closedAt = closedAt ?? DateTime.now();
      37            0 :     data.currency = currency;
      38            0 :     state.update(widget.uuid, data);
      39              :   }
      40              : 
      41            0 :   void bindState() {
      42            0 :     if (!isFirstRun) {
      43              :       return;
      44              :     }
      45            0 :     setState(() {
      46            0 :       isFirstRun = false;
      47            0 :       var form = super.state.getByUuid(widget.uuid) as GoalAppData;
      48            0 :       super.title.text = form.title;
      49            0 :       super.details.text = form.details != null ? form.details.toString() : '';
      50            0 :       super.color = form.color;
      51            0 :       super.icon = form.icon;
      52            0 :       super.currency = form.currency;
      53            0 :       super.closedAt = form.closedAt;
      54              :     });
      55              :   }
      56              : 
      57            0 :   @override
      58              :   String getButtonName() {
      59            0 :     return AppLocale.labels.updateGoalTooltip;
      60              :   }
      61              : 
      62            0 :   @override
      63              :   Widget buildContent(BuildContext context, BoxConstraints constraints) {
      64            0 :     WidgetsBinding.instance.addPostFrameCallback((_) => bindState());
      65            0 :     return super.buildContent(context, constraints);
      66              :   }
      67              : }
        

Generated by: LCOV version 2.0-1