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/design/form/list_selector_item.dart'; 6 : 7 : enum AppAccountType { 8 : account, 9 : cash, 10 : debitCard, 11 : creditCard, 12 : deposit, 13 : credit, 14 : } 15 : 16 : class AccountType { 17 1 : static List<ListSelectorItem> getList() { 18 1 : return [ 19 4 : ListSelectorItem(id: AppAccountType.account.toString(), name: AppLocale.labels.bankAccount), 20 4 : ListSelectorItem(id: AppAccountType.cash.toString(), name: AppLocale.labels.cash), 21 4 : ListSelectorItem(id: AppAccountType.debitCard.toString(), name: AppLocale.labels.debitCard), 22 4 : ListSelectorItem(id: AppAccountType.creditCard.toString(), name: AppLocale.labels.creditCard), 23 4 : ListSelectorItem(id: AppAccountType.deposit.toString(), name: AppLocale.labels.deposit), 24 4 : ListSelectorItem(id: AppAccountType.credit.toString(), name: AppLocale.labels.credit), 25 : ]; 26 : } 27 : 28 7 : static String getLabel(String id) => getList().firstWhere((e) => e.id == id).name; 29 : 30 5 : static bool contains(String id, List<AppAccountType> type) => type.map((e) => e.toString()).contains(id); 31 : }