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/_configs/custom_text_theme.dart';
6 : import 'package:app_finance/design/wrapper/text_wrapper.dart';
7 : import 'package:dart_intl_search/dart_intl_search.dart';
8 : import 'package:material_ui/material_ui.dart' show Widget, BuildContext, Theme, Locale;
9 :
10 : class ListSelectorItem {
11 : final String id;
12 : final String name;
13 :
14 0 : Widget build(BuildContext context) {
15 0 : final textTheme = Theme.of(context).textTheme;
16 0 : return TextWrapper(toString(), style: textTheme.numberMedium.copyWith(color: textTheme.headlineSmall?.color));
17 : }
18 :
19 0 : Widget suggest(BuildContext context) => build(context);
20 :
21 0 : bool match(String search) =>
22 0 : search.isPartOf(name, Locale(AppLocale.code)) || name.toLowerCase().contains(search.toLowerCase());
23 :
24 0 : bool equal(dynamic val) => val is ListSelectorItem ? id == val.id : id == val;
25 :
26 0 : @override
27 0 : toString() => name;
28 :
29 0 : ListSelectorItem({required this.id, required this.name});
30 : }
|