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/pages/_interfaces/abstract_page_state.dart'; 5 : import 'package:flutter/material.dart'; 6 : 7 : abstract class AbstractAddPage<T> extends StatefulWidget { 8 2 : const AbstractAddPage({super.key}); 9 : } 10 : 11 : abstract class AbstractAddPageState<T extends AbstractAddPage> extends AbstractPageState<T> { 12 : bool hasError = false; 13 : 14 : bool hasFormErrors(); 15 : 16 : void updateStorage(); 17 : 18 1 : void triggerActionButton(NavigatorState nav) { 19 2 : setState(() { 20 1 : if (hasFormErrors()) { 21 : return; 22 : } 23 1 : updateStorage(); 24 1 : nav.pop(); 25 1 : nav.pop(); 26 : }); 27 : } 28 : }