68 lines
1.7 KiB
Dart
68 lines
1.7 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import 'package:flutter_translate/global/app_general.dart';
|
|
import 'package:get/get.dart';
|
|
|
|
class PhotoPicker extends StatelessWidget {
|
|
const PhotoPicker({
|
|
super.key,
|
|
required this.funCamera,
|
|
required this.funGallery,
|
|
});
|
|
|
|
final Function() funCamera;
|
|
final Function() funGallery;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Container(
|
|
width: MediaQuery.of(context).size.width,
|
|
height: MediaQuery.of(context).padding.bottom + 100.w,
|
|
padding: EdgeInsets.only(bottom: MediaQuery.of(context).padding.bottom).w,
|
|
clipBehavior: Clip.antiAlias,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(10.r),
|
|
),
|
|
child: Column(
|
|
children: [
|
|
Expanded(
|
|
child: _buildItem('Open camera', funCamera),
|
|
),
|
|
divider,
|
|
Expanded(
|
|
child: _buildItem('Open gallery', funGallery),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
Widget _buildItem(String text, Function() function) {
|
|
return Material(
|
|
color: Colors.transparent,
|
|
child: InkWell(
|
|
onTap: () {
|
|
Get.back();
|
|
function();
|
|
},
|
|
child: SizedBox(
|
|
width: double.infinity,
|
|
child: Center(
|
|
child: Text(
|
|
text,
|
|
maxLines: 1,
|
|
overflow: TextOverflow.ellipsis,
|
|
style: TextStyle(
|
|
color: const Color(0xFF333333),
|
|
fontSize: 16.sp,
|
|
fontWeight: FontWeight.w600,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|