Refactoring + Version améliorée
This commit is contained in:
34
lib/presentation/widgets/image_picker.dart
Normal file
34
lib/presentation/widgets/image_picker.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
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),
|
||||
],
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user