import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:trans_lark/widget/divider_widget.dart';

class PhotoPickerBottomSheet extends StatelessWidget {
  const PhotoPickerBottomSheet({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 DividerWidget(),
            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,
              )
            ),
          ),
        ),
      ),
    );
  }
}