forked from eatvio/eatvio_app
177 lines
5.5 KiB
Dart
177 lines
5.5 KiB
Dart
import 'package:cached_network_image/cached_network_image.dart';
|
|
import 'package:eatvio_app/core/const.dart';
|
|
import 'package:eatvio_app/features/feed/models/plan_pagination_model.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:flutter_html/flutter_html.dart';
|
|
import 'package:go_router/go_router.dart';
|
|
|
|
class PlanWidget extends StatelessWidget {
|
|
final PlanModel planModel;
|
|
|
|
const PlanWidget({
|
|
super.key,
|
|
required this.planModel,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return InkWell(
|
|
borderRadius: BorderRadius.circular(12),
|
|
onTap: () => GoRouter.of(context).pushNamed(
|
|
'aboutPlanScreen',
|
|
extra: {
|
|
'plan': planModel,
|
|
'navigateToComments': false,
|
|
},
|
|
),
|
|
child: Ink(
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(12),
|
|
color: Colors.white,
|
|
),
|
|
child: Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Stack(
|
|
children: [
|
|
ClipRRect(
|
|
borderRadius: BorderRadius.vertical(top: Radius.circular(12)),
|
|
child: CachedNetworkImage(
|
|
imageUrl: baseUrl + '/storage/' + planModel.image,
|
|
fit: BoxFit.fitWidth,
|
|
width: MediaQuery.of(context).size.width,
|
|
),
|
|
),
|
|
Positioned(
|
|
left: 8,
|
|
bottom: 8,
|
|
child: Wrap(
|
|
runSpacing: 8,
|
|
children: [
|
|
_iconButton(Icons.timelapse_rounded, '${planModel.duration} дней'),
|
|
SizedBox(width: 8),
|
|
],
|
|
),
|
|
),
|
|
Positioned(
|
|
left: 8,
|
|
top: 8,
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.8),
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
Icons.favorite_rounded,
|
|
size: 16,
|
|
color: Colors.black,
|
|
),
|
|
SizedBox(width: 4),
|
|
Text(
|
|
'0',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
Positioned(
|
|
right: 8,
|
|
top: 8,
|
|
child: Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 8, vertical: 4),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.8),
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
child: Row(
|
|
children: [
|
|
Icon(
|
|
Icons.visibility_rounded,
|
|
size: 16,
|
|
color: Colors.black,
|
|
),
|
|
SizedBox(width: 4),
|
|
Text(
|
|
'0',
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w400,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
SizedBox(height: 12),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 12),
|
|
child: Text(
|
|
planModel.name,
|
|
style: TextStyle(
|
|
fontWeight: FontWeight.w600,
|
|
color: Colors.black87,
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 4),
|
|
child: Html(
|
|
data: planModel.details,
|
|
style: {
|
|
"*": Style(
|
|
color: Colors.black87,
|
|
),
|
|
},
|
|
),
|
|
),
|
|
SizedBox(height: 12),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
_iconButton(IconData icon, [String? text]) {
|
|
return Container(
|
|
padding: EdgeInsets.symmetric(horizontal: 12, vertical: 4),
|
|
decoration: BoxDecoration(
|
|
color: Colors.white.withOpacity(0.8),
|
|
borderRadius: BorderRadius.circular(16),
|
|
),
|
|
height: 32,
|
|
child: Row(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Icon(
|
|
icon,
|
|
size: 16,
|
|
color: Colors.black,
|
|
),
|
|
if (text != null) SizedBox(width: 8),
|
|
if (text != null)
|
|
Text(
|
|
text,
|
|
style: TextStyle(
|
|
fontSize: 12,
|
|
color: Colors.black,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|