Files
afterwork/lib/presentation/widgets/image_picker.dart
2024-09-25 21:28:04 +00:00

35 lines
1.0 KiB
Dart

import 'package:flutter/material.dart';
class ImagePickerField extends StatelessWidget {
final String? imagePath;
final VoidCallback onImagePicked;
const ImagePickerField({Key? key, this.imagePath, required this.onImagePicked}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onImagePicked,
child: Container(
padding: const EdgeInsets.symmetric(vertical: 12.0, horizontal: 16.0),
decoration: BoxDecoration(
color: Colors.white.withOpacity(0.1),
borderRadius: BorderRadius.circular(10.0),
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
imagePath == null
? 'Sélectionnez une image'
: 'Image sélectionnée: $imagePath',
style: const TextStyle(color: Colors.white70),
),
const Icon(Icons.image, color: Colors.white70),
],
),
),
);
}
}