import 'package:flutter/material.dart';
import 'package:progress_hud_v2/progress_hud.dart';

import 'loader/gif_loader_container.dart';

/* 
 *@author: Elham Rababah 
 *@Date:19/4/2020  
 *@param: 
 *@return: Positioned
 *@desc:   AppLoaderWidget to create loader
 */
class AppLoaderWidget extends StatefulWidget {
  AppLoaderWidget({Key key, this.title, this.containerColor}) : super(key: key);

  final String title;
  final Color containerColor;

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

class _AppLoaderWidgetState extends State<AppLoaderWidget> {
  ProgressHUD _progressHUD;
  @override
  void initState() {
    super.initState();
/* 
 *@author: Elham Rababah 
 *@Date:19/4/2020  
 *@param: 
 *@return:
 *@desc:   create loader the desing
 */
    _progressHUD = new ProgressHUD(
      backgroundColor: widget.containerColor == null ? Colors.black12 : widget.containerColor,
      color: Colors.black,
      // containerColor: Colors.blue,
      borderRadius: 5.0,
      // text: 'Loading...',
    );
  }

  @override
  Widget build(BuildContext context) {
    return Container(
      height: MediaQuery.of(context).size.height,

      child: Stack(
        children: [
          Container(
            color: Colors.grey.withOpacity(0.6),
          ),
          Container(child: GifLoaderContainer(), margin: EdgeInsets.only(
              bottom: MediaQuery.of(context).size.height * 0.09))
        ],
      ),
    );
  }
}
