Wallpaper-Genie/lib/common/components/photo_picker_bottom_sheet.dart
xuhang-x 121e423c8b 1
2024-07-24 20:13:27 +08:00

66 lines
1.6 KiB
Dart

import 'package:flutter/material.dart';
import 'package:get/get.dart';
class TPhotoPickerBottomSheet extends StatelessWidget {
const TPhotoPickerBottomSheet({super.key, required this.funCamera, required this.funGallery});
final Function() funCamera;
final Function() funGallery;
@override
Widget build(BuildContext context) {
return SafeArea(
child: Container(
width: MediaQuery.of(context).size.width,
height: 120,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
color: Colors.white,
borderRadius: BorderRadius.circular(26),
),
child: Column(
children: [
Expanded(
child: _buildItem('Open camera', funCamera),
),
const Divider(
height: 1,
thickness: 1,
color: Color(0xFFEDEDED),
),
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: const TextStyle(
color: Color(0xFF333333),
fontSize: 16,
fontWeight: FontWeight.w600,
)
),
),
),
),
);
}
}