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