Sonnat Project
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

79 lines
2.7 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
  1. import 'package:flutter/material.dart';
  2. import 'package:sonnat/core/extensions/context_extension.dart';
  3. import 'package:sonnat/core/utils/app_constants.dart';
  4. import 'package:sonnat/core/utils/app_utils.dart';
  5. import 'package:sonnat/features/single_post/view_models/post.dart';
  6. class PostItemWidget extends StatelessWidget {
  7. final Post post;
  8. const PostItemWidget({super.key, required this.post});
  9. @override
  10. Widget build(BuildContext context) {
  11. return Container(
  12. padding: EdgeInsets.symmetric(
  13. horizontal: context.width * 11 / AppConstants.instance.appWidth,
  14. vertical: context.width * 11 / AppConstants.instance.appWidth,
  15. ),
  16. decoration: BoxDecoration(
  17. color: const Color(0xffffffff),
  18. borderRadius: BorderRadius.circular(16),
  19. ),
  20. margin: EdgeInsets.only(
  21. left: context.width * 26 / AppConstants.instance.appWidth,
  22. right: context.width * 26 / AppConstants.instance.appWidth,
  23. bottom: context.height * 21 / AppConstants.instance.appHeight,
  24. ),
  25. child: Column(
  26. crossAxisAlignment: CrossAxisAlignment.start,
  27. children: [
  28. Container(
  29. height: context.height * 174 / AppConstants.instance.appHeight,
  30. decoration: BoxDecoration(
  31. borderRadius: const BorderRadius.only(
  32. topLeft: Radius.circular(16),
  33. topRight: Radius.circular(16),
  34. ),
  35. image: DecorationImage(
  36. image: AssetImage(post.image),
  37. fit: BoxFit.cover,
  38. ),
  39. ),
  40. ),
  41. SizedBox(height: context.height * 14 / AppConstants.instance.appHeight),
  42. Text(
  43. post.name,
  44. style: const TextStyle(
  45. color: Color(0xff222D4E),
  46. fontSize: 16,
  47. fontWeight: FontWeight.bold,
  48. ),
  49. ),
  50. SizedBox(height: context.height * 8 / AppConstants.instance.appHeight),
  51. Text(
  52. post.description,
  53. style: const TextStyle(
  54. color: Color(0xff8990A1),
  55. fontSize: 13,
  56. ),
  57. textAlign: TextAlign.justify,
  58. ),
  59. SizedBox(height: context.height * 30 / AppConstants.instance.appHeight),
  60. Align(
  61. alignment: AlignmentDirectional.centerEnd,
  62. child: Text(
  63. Utils.instance.dateToString(post.date),
  64. style: const TextStyle(
  65. color: Color(0xff8D95AB),
  66. fontSize: 11,
  67. fontWeight: FontWeight.bold,
  68. ),
  69. ),
  70. ),
  71. SizedBox(height: context.height * 7 / AppConstants.instance.appHeight),
  72. ],
  73. ),
  74. );
  75. }
  76. }