Giter VIP home page Giter VIP logo

easy_data_loading's Introduction

添加依赖

1、在pubspec.yaml中加入:

dependencies:
  easy_data_loading:0.1.0

2、执行flutter命令获取包:

flutter pub get

3、引入

import 'package:easy_data_loading/easy_data_loading.dart';

使用

@override
Widget build(BuildContext context) {
  return Scaffold(
    appBar: AppBar(
      title: Text('EasyDataLoading'),
    ),
    body:LoadingView(
      dataLoad: (LoadingViewController controller) async{
        await Future.delayed(const Duration(seconds: 2));
        return Future.value({'name':'1'});
      },
      builder: (data,_) {
        return Text(data['name']??'name');
      },
    ),
  );
}

LoadingView 的成员说明:

参数名 类型 描述 默认值
builder Widget Function(T data, LoadingViewController controller) 需要加载的Widget 必填
dataLoad Future<T?> Function(LoadingViewController controller) 数据加载 必填
controller LoadingViewController 数据加载的控制器 null
todoAfterError Future<T?> Function(LoadingViewController controller) 接口错误加载重试 null
todoAfterNetworkBlocked Future<T?> Function(LoadingViewController controller) 网络错误加载重试 null
networkBlockedDesc String 网络错误提示文案 网络连接超时,请检查你的网络环境
errorDesc String 接口错误提示文案 加载失败
emptyStatus EmptyStatus 暂无数据 EmptyStatus.noData
maxHeight double 最大高度 null
isKeepAlive bool 是否保持状态 false

easy_data_loading's People

Contributors

zhouc125 avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

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.