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