23 lines
710 B
Dart
23 lines
710 B
Dart
import 'package:flutter_app/data/dtos/thrones_character_dto.dart';
|
|
import 'package:flutter_app/domain/models/card.dart';
|
|
|
|
const _imagePlaceholder =
|
|
'https://upload.wikimedia.org/wikipedia/en/archive/b/b1/20210811082420%21Portrait_placeholder.png';
|
|
|
|
extension ThronesCharacterDtoToModel on ThronesCharacterDto {
|
|
CardData toDomain() => CardData(
|
|
fullName,
|
|
imageUrl: imageUrl,
|
|
descriptionText: _makeDescriptionText(title, family),
|
|
);
|
|
|
|
String _makeDescriptionText(String? title, String? family) {
|
|
return title != null && family != null
|
|
? '$title of $family'
|
|
: title != null
|
|
? 'Title: $title'
|
|
: family != null
|
|
? 'Family: $family'
|
|
: '';
|
|
}
|
|
} |