import 'package:apivideo_live_stream/apivideo_live_stream.dart';
import 'package:flutter/material.dart';

class CameraPreviewWidget extends StatelessWidget {
  const CameraPreviewWidget({
    super.key,
    required this.controller,
    required this.isReady,
  });

  final ApiVideoLiveStreamController controller;
  final bool isReady;

  @override
  Widget build(BuildContext context) {
    if (!isReady) {
      return const ColoredBox(color: Colors.black);
    }

    return ApiVideoCameraPreview(controller: controller, fit: BoxFit.cover);
  }
}
