import 'package:flutter/material.dart';
import 'package:gap/gap.dart';
import 'package:pharmacy_mobile/widgets/text_widget.dart';

class DropdownWrapperWidget extends StatelessWidget {
  final List list;
  final String text;
  final Widget widget;

  const DropdownWrapperWidget({
    super.key,
    required this.list,
    required this.text,
    required this.widget,
  });

  @override
  Widget build(BuildContext context) {
    return (list.isEmpty)
        ? Column(
            children: [
              const Gap(8),
              Column(
                mainAxisAlignment: MainAxisAlignment.center,
                crossAxisAlignment: CrossAxisAlignment.center,
                spacing: 16,
                children: [
                  const CircularProgressIndicator(color: Color.fromRGBO(255, 255, 255, 1)),
                  const Gap(4),
                  TextWidget(text: 'Fetching $text', size: 14)
                ],
              ),
            ],
          )
        : widget;
  }
}
