осталось сделать поиск
This commit is contained in:
parent
9ae72e9613
commit
1c7eb9525f
@ -6,12 +6,15 @@ const _imagePlaceholder =
|
||||
'https://upload.wikimedia.org/wikipedia/en/archive/b/b1/20210811082420%21Portrait_placeholder.png';
|
||||
|
||||
extension CharacterDataDtoMapper on CharacterDataDto {
|
||||
CardData toDomain() => CardData(
|
||||
CardData toDomain() {
|
||||
final cardData = CardData(
|
||||
name ?? 'UNKNOWN',
|
||||
imageUrl: image ?? _imagePlaceholder,
|
||||
descriptionText: '',
|
||||
id: id,
|
||||
descriptionText: description ?? '',
|
||||
id: id ?? '',
|
||||
);
|
||||
return cardData;
|
||||
}
|
||||
}
|
||||
|
||||
extension CharactersDtoToModel on CharactersDto {
|
||||
|
@ -11,7 +11,8 @@ class CardData {
|
||||
this.text, {
|
||||
this.icon = Icons.bookmark_border,
|
||||
required this.descriptionText,
|
||||
this.imageUrl,
|
||||
this.id,
|
||||
});
|
||||
required this.imageUrl,
|
||||
required this.id,
|
||||
}) {
|
||||
}
|
||||
}
|
@ -12,8 +12,7 @@ class DetailsPage extends StatelessWidget {
|
||||
return Scaffold(
|
||||
appBar: AppBar(),
|
||||
body: Padding(
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
@ -25,7 +24,7 @@ class DetailsPage extends StatelessWidget {
|
||||
data.imageUrl ?? '',
|
||||
fit: BoxFit.cover,
|
||||
width: double.infinity,
|
||||
height: 400.0,
|
||||
height: 300.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
@ -36,10 +35,14 @@ class DetailsPage extends StatelessWidget {
|
||||
style: Theme.of(context).textTheme.headlineLarge,
|
||||
),
|
||||
),
|
||||
Text(
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Text(
|
||||
data.descriptionText,
|
||||
style: Theme.of(context).textTheme.bodyLarge?.copyWith(
|
||||
fontSize: 25.0,
|
||||
fontSize: 22.0,
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
],
|
||||
|
@ -4,7 +4,6 @@ typedef OnLikeCallback = void Function(String? id, String title, bool isLiked)?;
|
||||
|
||||
class _Card extends StatelessWidget {
|
||||
final String text;
|
||||
final String descriptionText;
|
||||
final String? imageUrl;
|
||||
final OnLikeCallback onLike;
|
||||
final VoidCallback? onTap;
|
||||
@ -13,7 +12,6 @@ class _Card extends StatelessWidget {
|
||||
|
||||
const _Card(
|
||||
this.text, {
|
||||
required this.descriptionText,
|
||||
this.imageUrl,
|
||||
this.onLike,
|
||||
this.onTap,
|
||||
@ -29,7 +27,6 @@ class _Card extends StatelessWidget {
|
||||
}) =>
|
||||
_Card(
|
||||
data.text,
|
||||
descriptionText: data.descriptionText,
|
||||
imageUrl: data.imageUrl,
|
||||
onLike: onLike,
|
||||
onTap: onTap,
|
||||
@ -56,55 +53,38 @@ class _Card extends StatelessWidget {
|
||||
),
|
||||
],
|
||||
),
|
||||
child: IntrinsicHeight(
|
||||
child: Row(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
ClipRRect(
|
||||
borderRadius: const BorderRadius.only(
|
||||
bottomLeft: Radius.circular(20),
|
||||
topLeft: Radius.circular(20),
|
||||
topRight: Radius.circular(20),
|
||||
),
|
||||
child: SizedBox(
|
||||
height: double.infinity,
|
||||
width: 120,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
height: 220,
|
||||
width: double.infinity,
|
||||
child: Image.network(
|
||||
imageUrl ?? '',
|
||||
fit: BoxFit.cover,
|
||||
errorBuilder: (_, __, ___) => const Placeholder(),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.only(left: 16.0),
|
||||
Padding(
|
||||
padding: const EdgeInsets.all(15.0),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Text(
|
||||
Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Text(
|
||||
text,
|
||||
style: Theme.of(context).textTheme.headlineSmall,
|
||||
),
|
||||
Text(
|
||||
descriptionText,
|
||||
style: Theme.of(context).textTheme.bodyLarge,
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Align(
|
||||
alignment: Alignment.bottomRight,
|
||||
child: Padding(
|
||||
padding:
|
||||
const EdgeInsets.only(left: 8, right: 16, bottom: 16),
|
||||
child: GestureDetector(
|
||||
GestureDetector(
|
||||
onTap: () => onLike?.call(id, text, isLiked),
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 200),
|
||||
@ -120,12 +100,14 @@ class _Card extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user