|
|
@ -2,7 +2,6 @@ import 'package:flutter/material.dart'; |
|
|
|
import 'package:repositories/app_api_domain/models/post_model.dart'; |
|
|
|
import 'package:sonnat/core/extensions/context_extension.dart'; |
|
|
|
import 'package:sonnat/core/utils/app_constants.dart'; |
|
|
|
import 'package:sonnat/core/utils/app_utils.dart'; |
|
|
|
|
|
|
|
class PostItemWidget extends StatelessWidget { |
|
|
|
final PostModel post; |
|
|
@ -11,6 +10,7 @@ class PostItemWidget extends StatelessWidget { |
|
|
|
|
|
|
|
@override |
|
|
|
Widget build(BuildContext context) { |
|
|
|
final String? thumbnail = post.thumbnail; |
|
|
|
return Container( |
|
|
|
padding: EdgeInsets.symmetric( |
|
|
|
horizontal: context.width * 11 / AppConstants.instance.appWidth, |
|
|
@ -30,16 +30,33 @@ class PostItemWidget extends StatelessWidget { |
|
|
|
children: [ |
|
|
|
Container( |
|
|
|
height: context.height * 174 / AppConstants.instance.appHeight, |
|
|
|
decoration: BoxDecoration( |
|
|
|
borderRadius: const BorderRadius.only( |
|
|
|
decoration: const BoxDecoration( |
|
|
|
borderRadius: BorderRadius.only( |
|
|
|
topLeft: Radius.circular(16), |
|
|
|
topRight: Radius.circular(16), |
|
|
|
), |
|
|
|
image: DecorationImage( |
|
|
|
image: NetworkImage(post.thumbnail!), |
|
|
|
fit: BoxFit.cover, |
|
|
|
), |
|
|
|
), |
|
|
|
child: thumbnail == null |
|
|
|
? Center( |
|
|
|
child: Icon( |
|
|
|
Icons.image_search, |
|
|
|
color: Colors.grey.withOpacity(0.5), |
|
|
|
size: 150, |
|
|
|
), |
|
|
|
) |
|
|
|
: Image.network( |
|
|
|
thumbnail, |
|
|
|
fit: BoxFit.cover, |
|
|
|
errorBuilder: (context, error, stackTrace) { |
|
|
|
return Center( |
|
|
|
child: Icon( |
|
|
|
Icons.image_search, |
|
|
|
color: Colors.grey.withOpacity(0.5), |
|
|
|
size: 150, |
|
|
|
), |
|
|
|
); |
|
|
|
}, |
|
|
|
), |
|
|
|
), |
|
|
|
SizedBox(height: context.height * 14 / AppConstants.instance.appHeight), |
|
|
|
Text( |
|
|
|