Line data Source code
1 : // Copyright 2024 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 AppBudgetType { week, month, year }
8 :
9 : class BudgetType {
10 0 : static List<ListSelectorItem> getList() {
11 0 : return [
12 0 : ListSelectorItem(id: AppBudgetType.week.name, name: AppLocale.labels.budgetTypeWeek),
13 0 : ListSelectorItem(id: AppBudgetType.month.name, name: AppLocale.labels.budgetTypeMonth),
14 0 : ListSelectorItem(id: AppBudgetType.year.name, name: AppLocale.labels.budgetTypeYear),
15 : ];
16 : }
17 :
18 0 : static String getLabel(String id) => getList().firstWhere((e) => e.id == id).name;
19 :
20 0 : static bool contains(String id, List<AppBudgetType> type) => type.map((e) => e.toString()).contains(id);
21 : }
|