GithubHelp home page GithubHelp logo

frefresh's People

Contributors

fliggyandroid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

frefresh's Issues

NestedScrollView not work

import 'dart:async';

import 'package:flutter/material.dart' hide NestedScrollView;
import 'package:frefresh/frefresh.dart';
import 'package:extended_nested_scroll_view/extended_nested_scroll_view.dart';
import '../commons/index.dart' show Util;

class CustomScrollViewPage extends StatefulWidget {
  @override
  _CustomScrollViewPageState createState() => _CustomScrollViewPageState();
}

class _CustomScrollViewPageState extends State<CustomScrollViewPage> {
  FRefreshController _fRefreshController;
  List<String> _tabs = ['111', '222', '333', '444', '555', '666'];
  String _appID = '';

  @override
  void initState() {
    super.initState();
    _getAppID();
    _fRefreshController = FRefreshController();
    _fRefreshController.setOnStateChangedCallback((state) {
      print('state = $state');
    });
  }

  _getAppID() async {
    _appID = await Util.appID();
    setState(() {});
  }

  @override
  Widget build(BuildContext context) {
    final double statusBarHeight = MediaQuery.of(context).padding.top;
    double pinnedHeaderHeight = statusBarHeight + kToolbarHeight;
    List<Widget> _silverBuilder(BuildContext context, bool innerBoxIsScrolled) {
      return <Widget>[
        SliverToBoxAdapter(
          child: Container(
            height: 368.0,
            color: Colors.yellow,
            child: Center(
              child: Text(
                _appID,
                style: TextStyle(color: Colors.red),
              ),
            ),
          ),
        ),
      ];
    }

    return FRefresh(
      controller: _fRefreshController,
      header: Image.asset(
        "assets/icon_refresh4.gif",
        height: 80.0,
        fit: BoxFit.fitHeight,
      ),
      headerHeight: 80.0,
      onRefresh: () {
        Timer(Duration(milliseconds: 3000), () {
          _fRefreshController.finishRefresh();
        });
      },
      child: Scaffold(
        body: Stack(
          children: <Widget>[
            DefaultTabController(
              length: _tabs.length, // This is the number of tabs.
              child: NestedScrollView(
                headerSliverBuilder: _silverBuilder,
                pinnedHeaderSliverHeightBuilder: () {
                  return pinnedHeaderHeight;
                },
                body: Column(
                  children: <Widget>[
                    TabBar(
                      labelColor: Theme.of(context).accentColor,
                      unselectedLabelColor: Theme.of(context).hintColor,
                      indicatorSize: TabBarIndicatorSize.label,
                      isScrollable: true,
                      tabs:
                          _tabs.map((String name) => Tab(text: name)).toList(),
                    ),
                    Divider(
                      height: 0,
                    ),
                    Expanded(
                      child: TabBarView(
                        children: _tabs.map((String name) {
                          return MediaQuery.removePadding(
                            context: context,
                            removeTop: true,
                            removeBottom: false,
                            child: ListView.separated(
                              key: PageStorageKey<String>(name),
                              itemCount: 100,
                              itemBuilder: (BuildContext context, int index) {
                                return ListTile(
                                    title: Text('title: ' + index.toString()));
                              },
                              separatorBuilder:
                                  (BuildContext context, int index) {
                                return Divider(
                                  height: 0,
                                );
                              },
                            ),
                          );
                        }).toList(),
                      ),
                    )
                  ],
                ),
              ),
            ),
            Positioned(
              left: 0,
              top: 0,
              right: 0,
              child: Container(
                padding: EdgeInsets.only(top: statusBarHeight),
                color: Theme.of(context).accentColor,
                height: pinnedHeaderHeight,
                child: Container(
                  height: kToolbarHeight,
                  color: Colors.red,
                  child: Row(
                    children: <Widget>[
                      Text('data'),
                      Icon(Icons.home),
                    ],
                  ),
                ),
              ),
            ),
          ],
        ),
      ),
    );
  }
}
[✓] Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.5 19F101, locale zh-Hans-CN)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 4.0)
[✓] VS Code (version 1.45.1)
[✓] Connected device (1 available)

• No issues found!

稍微长一点的列表掉帧卡顿

直接渲染和FutureBuilder渲染长列表数据都是一样的掉帧

换成 flutter_easyrefresh就不卡了,一样的数据和逻辑
dbjSld.jpg

dbji0P.jpg

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel master, 1.21.0-5.0.pre, on Mac OS X 10.15.4 19E287, locale zh-Hans)
[!] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
    ✗ Android license status unknown.
      Try re-installing or updating your Android SDK Manager.
      See https://developer.android.com/studio/#downloads or visit
      https://flutter.dev/docs/get-started/install/macos#android-setup for detailed instructions.
 
[✓] Xcode - develop for iOS and macOS (Xcode 11.4.1)
[✓] Android Studio (version 3.5)
[✓] VS Code (version 1.48.0)
[✓] Connected device (1 available)
❯ dart --version
Dart SDK version: 2.9.0-21.0.dev.flutter-9dca49e71e (be) (Fri Jul 17 13:26:08 2020 +0000) on "macos_x64"
frefresh: ^1.1.0

补充一点 真机上卡顿一样的存在和明显,而真机flutter_easyrefresh已经变成一条直线了,流畅丝滑

nestedscrollview

[✓] Flutter (Channel stable, v1.17.3, on Mac OS X 10.15.5 19F101, locale
zh-Hans-CN)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Android Studio (version 3.6)

pull up or pull down,Overall refresh is not supported,

设备切换方向报错

设备从竖屏切换至横屏报错

Another exception was thrown: RenderBox.size accessed beyond the scope of resize, layout, or permitted parent access. RenderBox can always access its own size, otherwise, the only object that is allowed to read RenderBox.size is its parent, if they have said they will. It you hit this assert trying to access a child's size, pass "parentUsesSize: true" to that child's layout().

════════ Exception caught by rendering library ═════════════════════════════════
RenderBox.size accessed beyond the scope of resize, layout, or permitted parent access. RenderBox can always access its own size, otherwise, the only object that is allowed to read RenderBox.size is its parent, if they have said they will. It you hit this assert trying to access a child's size, pass "parentUsesSize: true" to that child's layout().
'package:flutter/src/rendering/box.dart':
Failed assertion: line 1709 pos 13: 'debugDoingThisResize || debugDoingThisLayout ||
              (RenderObject.debugActiveLayout == parent && _size._canBeUsedByParent)'
The relevant error-causing widget was
    FRefresh 

child多样性问题

代码设计上child包装了一个CustomScrollView,其实是不可取的。 如果是Scrollable的widget,按照scrollable的逻辑处理,如果不是则再考虑包装到CustomScrollView里。不过仔细阅读了源代码也给我自己设计下拉刷新上拉加载提供了很大帮助。Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.