feat(App): update Finlytic Flutter app UI and blocs
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
import 'package:equatable/equatable.dart';
|
||||
|
||||
class SearchResultModel extends Equatable {
|
||||
final String isin;
|
||||
final String name;
|
||||
final String symbol;
|
||||
final String? image;
|
||||
|
||||
const SearchResultModel({
|
||||
required this.isin,
|
||||
required this.name,
|
||||
required this.symbol,
|
||||
this.image,
|
||||
});
|
||||
|
||||
factory SearchResultModel.fromJson(Map<String, dynamic> json) {
|
||||
return SearchResultModel(
|
||||
isin: json['isin']?.toString() ?? json['Isin']?.toString() ?? '',
|
||||
name: json['name']?.toString() ?? json['Name']?.toString() ?? '',
|
||||
symbol: json['symbol']?.toString() ?? json['Symbol']?.toString() ?? '',
|
||||
image: json['image']?.toString() ?? json['Image']?.toString(),
|
||||
);
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'isin': isin,
|
||||
'name': name,
|
||||
'symbol': symbol,
|
||||
'image': image,
|
||||
};
|
||||
}
|
||||
|
||||
String get displayName => name.isNotEmpty ? name : (symbol.isNotEmpty ? symbol : isin);
|
||||
String get isinCode => isin.isNotEmpty ? isin : (symbol != displayName ? symbol : '');
|
||||
|
||||
@override
|
||||
List<Object?> get props => [isin, name, symbol, image];
|
||||
}
|
||||
Reference in New Issue
Block a user