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

/// show app Loader
/// [backgroundColor] the background color for the app loader
/// [color] the color for the app loader
class AppLoaderWidget extends StatefulWidget {
  AppLoaderWidget(
      {Key? key,
      this.backgroundColor = Colors.black12,
      this.color = Colors.black})
      : super(key: key);

  final Color backgroundColor;
  final Color color;

  @override
  _AppLoaderWidgetState createState() => new _AppLoaderWidgetState();
}

class _AppLoaderWidgetState extends State<AppLoaderWidget> {
  late ProgressHUD _progressHUD;

  @override
  void initState() {
    super.initState();

    /// create progress Hud Indicator
    _progressHUD = new ProgressHUD(
      backgroundColor: widget.backgroundColor,
      indicatorColor: widget.color,
      child: SizedBox(),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Positioned(child: _progressHUD);
  }
}
