forked from eatvio/eatvio_app
269 lines
9.6 KiB
Dart
269 lines
9.6 KiB
Dart
import 'package:eatvio_app/core/theme/theme_helper.dart';
|
|
import 'package:eatvio_app/core/widgets/custom_divider.dart';
|
|
import 'package:eatvio_app/features/consultations/entities/consultations_entity.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:table_calendar/table_calendar.dart';
|
|
|
|
class ConsultationCardWidget extends StatelessWidget {
|
|
final List<String> titles = const [
|
|
'Дневник не заполнялся и никаких движений в тот день не было.',
|
|
'Показывает границы плана питания или публичной диеты в будущем.',
|
|
'Начат дневник питания, но не закончен.',
|
|
'Дневник закончен и прокомментирован консультантом но не просмотрен пользователем.',
|
|
'Дневник заполнен, но не прокомментирован консультантом.',
|
|
'Дневник заполнен, прокомментирован консультантом и после этого клиент просмотрел комментарии.',
|
|
];
|
|
final List<Color> legendColors = const [
|
|
Colors.white,
|
|
Color(0xFFCAC9C9),
|
|
Color(0xFFF0C497),
|
|
Color(0xFF2F80ED),
|
|
Color(0xFFFF9500),
|
|
Color(0xFF4CD964),
|
|
];
|
|
final ConsultationsEntity consultationsEntity;
|
|
|
|
const ConsultationCardWidget({
|
|
super.key,
|
|
required this.consultationsEntity,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Material(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(12),
|
|
child: Padding(
|
|
padding: const EdgeInsets.all(16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Row(
|
|
children: [
|
|
CircleAvatar(
|
|
radius: 30,
|
|
),
|
|
const SizedBox(width: 12),
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
consultationsEntity.name,
|
|
style: TextStyle(
|
|
height: 1,
|
|
color: Color(0xFF323F4B),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
const SizedBox(height: 4),
|
|
Text(
|
|
consultationsEntity.planName,
|
|
style: TextStyle(
|
|
height: 1,
|
|
color: Color(0xFF88949F),
|
|
fontSize: 14,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
'Анкета пользователя',
|
|
style: TextStyle(
|
|
color: appTheme.blueA400,
|
|
decoration: TextDecoration.underline,
|
|
decorationColor: appTheme.blueA400,
|
|
fontWeight: FontWeight.w500,
|
|
height: 1,
|
|
),
|
|
),
|
|
const SizedBox(height: 12),
|
|
CustomDivider(),
|
|
const SizedBox(height: 12),
|
|
Row(
|
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
|
children: [
|
|
Text(
|
|
'День ${consultationsEntity.currentDayOfPlan} из ${consultationsEntity.totalDaysOfPlan}',
|
|
style: TextStyle(
|
|
height: 1,
|
|
color: Color(0xFF323F4B),
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
),
|
|
),
|
|
GestureDetector(
|
|
onTap: () {
|
|
showModalBottomSheet(
|
|
context: context,
|
|
useSafeArea: true,
|
|
useRootNavigator: true,
|
|
showDragHandle: true,
|
|
builder: (context) => Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16),
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Text(
|
|
'Легенда',
|
|
style: TextStyle(
|
|
height: 1,
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w700,
|
|
color: Color(0xFF323F4B),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
ListView.separated(
|
|
shrinkWrap: true,
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
itemBuilder: (context, index) => _legendTitle(titles[index], legendColors[index]),
|
|
separatorBuilder: (context, index) => SizedBox(height: 16),
|
|
itemCount: titles.length,
|
|
),
|
|
const SizedBox(height: 16),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
child: Icon(
|
|
Icons.help_outline_rounded,
|
|
color: Color(0xFF323F4B),
|
|
size: 20,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
const SizedBox(height: 16),
|
|
TableCalendar(
|
|
focusedDay: DateTime.now(),
|
|
firstDay: DateTime.utc(2020, 10, 16),
|
|
lastDay: DateTime.utc(2030, 3, 14),
|
|
locale: 'ru_RU',
|
|
startingDayOfWeek: StartingDayOfWeek.monday,
|
|
headerVisible: false,
|
|
calendarFormat: CalendarFormat.week,
|
|
calendarStyle: CalendarStyle(
|
|
weekendDecoration: BoxDecoration(
|
|
color: Colors.white,
|
|
shape: BoxShape.circle,
|
|
),
|
|
defaultDecoration: BoxDecoration(
|
|
color: Colors.white,
|
|
shape: BoxShape.circle,
|
|
),
|
|
selectedDecoration: BoxDecoration(
|
|
color: appTheme.blueA400,
|
|
shape: BoxShape.circle,
|
|
),
|
|
todayTextStyle: TextStyle(
|
|
color: Colors.black,
|
|
),
|
|
todayDecoration: BoxDecoration(
|
|
border: Border.all(
|
|
color: appTheme.blueA400,
|
|
width: 2,
|
|
),
|
|
color: Colors.white,
|
|
shape: BoxShape.circle,
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
CustomDivider(),
|
|
const SizedBox(height: 12),
|
|
Text(
|
|
'${consultationsEntity.paymentAmount} ₽',
|
|
style: TextStyle(
|
|
color: Color(0xFF019A3E),
|
|
fontSize: 20,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
const SizedBox(height: 16),
|
|
Row(
|
|
children: [
|
|
InkWell(
|
|
borderRadius: BorderRadius.circular(20),
|
|
onTap: () {},
|
|
child: Ink(
|
|
width: MediaQuery.of(context).size.width - 32 - 52 - 8,
|
|
padding: EdgeInsets.all(16),
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(20),
|
|
color: appTheme.blueA400,
|
|
),
|
|
child: Center(
|
|
child: Text(
|
|
'Комментировать отчёт',
|
|
style: TextStyle(
|
|
color: Colors.white,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: 8),
|
|
InkWell(
|
|
borderRadius: BorderRadius.circular(20),
|
|
onTap: () {},
|
|
child: Ink(
|
|
height: 52,
|
|
width: 52,
|
|
decoration: BoxDecoration(
|
|
borderRadius: BorderRadius.circular(20),
|
|
color: Color(0xFFF6F6F6),
|
|
),
|
|
child: Center(
|
|
child: Icon(
|
|
Icons.chat_outlined,
|
|
size: 24,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
_legendTitle(String text, Color color) {
|
|
return Row(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Container(
|
|
height: 20,
|
|
width: 20,
|
|
decoration: BoxDecoration(
|
|
shape: BoxShape.circle,
|
|
color: color,
|
|
),
|
|
),
|
|
const SizedBox(width: 12),
|
|
Flexible(
|
|
child: Text(
|
|
text,
|
|
style: TextStyle(
|
|
height: 1,
|
|
fontSize: 16,
|
|
fontWeight: FontWeight.w500,
|
|
color: Color(0xFF323F4B),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|