import 'package:flutter/material.dart';
import 'package:loading_indicator/loading_indicator.dart';
import 'package:pull_to_refresh/pull_to_refresh.dart';

class RefreshHeader extends StatelessWidget {
  final double offsetY;
  final double _height = 44;
  final Color color;
  const RefreshHeader({Key key, this.offsetY = 0,this.color=Colors.white}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    // double top = MediaQueryData.fromWindow(window).padding.top;
    return CustomHeader(
      height: _height,
      builder: (BuildContext context, RefreshStatus mode) {
        return Transform.translate(
          offset: Offset(0, offsetY),
          child: Center(
            child: Container(
              width: 36,
              height: 36,
              child: LoadingIndicator(
                indicatorType: Indicator.ballSpinFadeLoader,
                color: color,
              ),
            ),
          ),
        );
      },
    );
  }
}
