123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- import 'package:flutter/material.dart';
- import 'package:flutter_easyrefresh/easy_refresh.dart';
- import 'package:sport/widgets/misc.dart';
- import 'package:sport/widgets/refresh_header.dart' as loading;
- class RequestLoadingWidget extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Container(
- height: 150.0,
- padding: const EdgeInsets.symmetric(vertical: 32.0),
- child: Center(
- child: loading.ClassicalHeaderWidget(
- refreshState: RefreshMode.refresh,
- pulledExtent: 90.0,
- refreshTriggerPullDistance: 80.0,
- refreshIndicatorExtent: 80.0,
- classicalHeader: buildClassicalHeader(),
- axisDirection: AxisDirection.up,
- noMore: false,
- enableInfiniteRefresh: true,
- ),
- ),
- );
- }
- }
- Widget FadeingCircleLoading(BuildContext context,
- {Color? backgroundColor, Function? callBack}) {
- return Positioned(
- top: 0,
- left: 0,
- right: 0,
- bottom: 0,
- child: callBack != null
- ? InkWell(
- child: Container(
- color: backgroundColor != null
- ? backgroundColor
- : Color.fromRGBO(255, 255, 255, 0.5),
- width: 100,
- height: 100,
- child: CircularProgressIndicator(),
- ),
- onTap: () {
- callBack();
- },
- )
- : Container(
- color: backgroundColor != null
- ? backgroundColor
- : Color.fromRGBO(255, 255, 255, 0.5),
- width: 100,
- height: 100,
- child: CircularProgressIndicator(),
- ),
- );
- }
- class LoadingWidget extends StatelessWidget {
- bool loading = false;
- bool willPop = true;
- Widget child;
- LoadingWidget({this.loading = false, this.willPop = true, required this.child});
- @override
- Widget build(BuildContext context) {
- return WillPopScope(
- onWillPop: () async {
- if(willPop == true) {
- bool result = !loading;
- return result;
- }
- return true;
- },
- child: Stack(
- alignment: Alignment.center,
- children: <Widget>[
- Center(child: child),
- Offstage(
- offstage: !loading,
- child: Container(
- padding: EdgeInsets.all(16.0),
- child: Column(
- mainAxisSize: MainAxisSize.min,
- children: <Widget>[
- Container(
- width: 100,
- height: 100,
- decoration: BoxDecoration(
- borderRadius: BorderRadius.all(Radius.circular(10.0)),
- color: Colors.black45,
- ),
- child: Padding(
- padding: const EdgeInsets.all(20.0),
- child: CircularProgressIndicator(),
- )
- ),
- ],
- )),
- )
- ],
- ),
- );
- }
- }
|