Finish screen - attention message added
This commit is contained in:
@@ -81,7 +81,6 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
);
|
||||
}
|
||||
|
||||
// ✅ Метод для получения изображения из выбранного источника
|
||||
Future<void> _getImage(ImageSource source) async {
|
||||
final XFile? pickedFile = await _imagePicker.pickImage(
|
||||
source: source,
|
||||
@@ -96,14 +95,12 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
}
|
||||
}
|
||||
|
||||
// Метод для удаления конкретного фото
|
||||
void _removeImage(String path) {
|
||||
final currentImages = context.read<SendPhotoBloc>().state.selectedImages;
|
||||
final updatedList = currentImages.where((p) => p != path).toList();
|
||||
context.read<SendPhotoBloc>().add(PhotoSelected(updatedList));
|
||||
}
|
||||
|
||||
// ✅ Динамический заголовок в зависимости от количества фото
|
||||
String _getTopText(int photoCount) {
|
||||
if (photoCount == 0) {
|
||||
return 'Для завершения аренды\nсфотографируйте самокат';
|
||||
@@ -135,9 +132,17 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
child: CustomAppBar(title: "Отправить фото"),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 100),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 60,
|
||||
),
|
||||
child: Text(
|
||||
_getTopText(context.select((SendPhotoBloc bloc) => bloc.state.selectedImages.length)),
|
||||
_getTopText(
|
||||
context.select(
|
||||
(SendPhotoBloc bloc) =>
|
||||
bloc.state.selectedImages.length,
|
||||
),
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
@@ -152,10 +157,14 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: SingleChildScrollView(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 20, vertical: 20),
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 20,
|
||||
vertical: 20,
|
||||
),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
// ... inside SingleChildScrollView -> Column children:
|
||||
BlocBuilder<SendPhotoBloc, SendPhotoState>(
|
||||
builder: (context, state) {
|
||||
final photoCount = state.selectedImages.length;
|
||||
@@ -167,11 +176,13 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
crossAxisAlignment: WrapCrossAlignment.center,
|
||||
children: [
|
||||
// Список выбранных фото
|
||||
...state.selectedImages.map((path) => _buildPhotoThumbnail(path)),
|
||||
...state.selectedImages.map(
|
||||
(path) => _buildPhotoThumbnail(path),
|
||||
),
|
||||
|
||||
const SizedBox(height: 35),
|
||||
|
||||
// Кнопка "Добавить", если фото меньше лимита (например, 5)
|
||||
// Кнопка "Добавить", если фото меньше лимита
|
||||
if (photoCount < 2)
|
||||
GestureDetector(
|
||||
onTap: _pickImage,
|
||||
@@ -181,28 +192,69 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
);
|
||||
},
|
||||
),
|
||||
const SizedBox(height: 200),
|
||||
|
||||
const SizedBox(height: 100),
|
||||
|
||||
// Информационный блок под кнопкой добавления фото
|
||||
Container(
|
||||
width: double.infinity,
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: 16,
|
||||
vertical: 14,
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
color: Colors.black.withOpacity(0.25),
|
||||
borderRadius: BorderRadius.circular(12),
|
||||
border: Border.all(
|
||||
color: Colors.white.withOpacity(0.08),
|
||||
width: 1,
|
||||
),
|
||||
),
|
||||
child: const Text(
|
||||
'Перед завершением поездки убедитесь, что Вы находитесь в зоне завершения поездки фиолетового цвета.',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 14,
|
||||
height: 1.4,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
const SizedBox(
|
||||
height: 40,
|
||||
), // Уменьшено со 200 для гармоничного отступа
|
||||
// Кнопка отправки
|
||||
BlocConsumer<SendPhotoBloc, SendPhotoState>(
|
||||
listener: (context, state) {
|
||||
if (state.status == SendPhotoStatus.success) {
|
||||
context.go('/home/checkout/${widget.orderId}', extra: state.recievedPhotoIds);
|
||||
} else if (state.status == SendPhotoStatus.failure) {
|
||||
context.go(
|
||||
'/home/checkout/${widget.orderId}',
|
||||
extra: state.recievedPhotoIds,
|
||||
);
|
||||
} else if (state.status ==
|
||||
SendPhotoStatus.failure) {
|
||||
ScaffoldMessenger.of(context).showSnackBar(
|
||||
SnackBar(content: Text(state.errorMessage ?? 'Ошибка')),
|
||||
SnackBar(
|
||||
content: Text(
|
||||
state.errorMessage ?? 'Ошибка',
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
},
|
||||
builder: (context, state) {
|
||||
final photoCount = state.selectedImages.length;
|
||||
final isEnabled = photoCount >= 2 &&
|
||||
final isEnabled =
|
||||
photoCount >= 2 &&
|
||||
state.status != SendPhotoStatus.loading;
|
||||
|
||||
return GradientButton(
|
||||
text: 'Отправить',
|
||||
onTap: isEnabled
|
||||
? () => context.read<SendPhotoBloc>().add(PhotoUploadSubmitted(widget.orderId))
|
||||
? () => context.read<SendPhotoBloc>().add(
|
||||
PhotoUploadSubmitted(widget.orderId),
|
||||
)
|
||||
: null,
|
||||
enabled: isEnabled,
|
||||
showArrows: true,
|
||||
@@ -232,9 +284,7 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
CircularProgressIndicator(
|
||||
color: Color(0xFF8BFFAA),
|
||||
),
|
||||
CircularProgressIndicator(color: Color(0xFF8BFFAA)),
|
||||
SizedBox(height: 16),
|
||||
Text(
|
||||
'Загружаем фото...',
|
||||
@@ -270,15 +320,12 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
color: Colors.black.withOpacity(0.1),
|
||||
blurRadius: 8,
|
||||
offset: const Offset(0, 4),
|
||||
)
|
||||
),
|
||||
],
|
||||
),
|
||||
child: ClipRRect(
|
||||
borderRadius: BorderRadius.circular(16),
|
||||
child: Image.file(
|
||||
File(path),
|
||||
fit: BoxFit.cover,
|
||||
),
|
||||
child: Image.file(File(path), fit: BoxFit.cover),
|
||||
),
|
||||
),
|
||||
// Кнопка удаления (крестик)
|
||||
@@ -338,11 +385,7 @@ class _SendPhotoViewState extends State<SendPhotoView> {
|
||||
],
|
||||
),
|
||||
child: const Center(
|
||||
child: Icon(
|
||||
Icons.add,
|
||||
size: 32,
|
||||
color: Colors.white,
|
||||
),
|
||||
child: Icon(Icons.add, size: 32, color: Colors.white),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user