xuelongqy / flutter_easy_refresh

A flutter widget that provides pull-down refresh and pull-up load.
https://xuelongqy.github.io/flutter_easy_refresh/
MIT License
3.89k stars 633 forks source link

设置triggerAxis: Axis.vertical属性有时候会失效 #765

Closed Dboy233 closed 1 year ago

Dboy233 commented 1 year ago

布局中是 CustomScrollView ->child: PageView。当上下滚动的时候刷新正常出现,但是当滚动PageView的时候,有时候就会出现向右滑动左边出现了刷新头。而且还是在布局上方的。

image

下面是补充的PlaceholderView代码


import 'package:flutter/material.dart';

class PlaceholderView extends StatelessWidget {
  const PlaceholderView(
      {super.key, required this.child, this.showEmptyView = false});

  final bool showEmptyView;

  final Widget child;

  @override
  Widget build(BuildContext context) {
    if (showEmptyView) {
      return const EmptyView();
    }
    return child;
  }
}

class EmptyView extends StatelessWidget {
  const EmptyView({super.key});

  @override
  Widget build(BuildContext context) {
    return LayoutBuilder(
      builder: (context, constraints) {
        return SingleChildScrollView(
          child: SizedBox(
            width: constraints.maxWidth,
            height: constraints.maxHeight,
            child: const Center(
              child: Text("暂无数据"),
            ),
          ),
        );
      },
    );
  }
}
Dboy233 commented 1 year ago

给PageView设置滚动物理效果为 ClampingScrollPhysics 可解决此问题。

xuelongqy commented 1 year ago

请查看Readme第一条