dynamic_list_view

Creator: coderz1093

Last updated:

0 purchases

dynamic_list_view Image
dynamic_list_view Images
Add to Cart

Description:

dynamic list view

Language: English | 中文简体
Dynamic List View #


A list component that can refreshes and adds more data for Flutter App. 🚀
github

Installation #
Add this to your package's pubspec.yaml file:
dependencies:
dynamic_list_view: ^0.2.1
copied to clipboard
Usage example #
import 'package:dynamic_list_view/dynamic_list.dart';
import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
DynamicListController _dynamicListController = DynamicListController();

@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(
backgroundColor: Colors.grey[200],
leading: Icon(Icons.accessibility, color: Colors.cyan),
title: Text('Dynamic list', style: TextStyle(color: Colors.black)),
),
body: Container(
child: DynamicList.build(
controller: _dynamicListController,
itemBuilder: _itemBuilder,
dataRequester: _dataRequester,
initRequester: _initRequester,
),
),
persistentFooterButtons: <Widget>[
MaterialButton(
onPressed: () => this._dynamicListController.fireRefresh(),
child: Icon(Icons.refresh)),
MaterialButton(
onPressed: () => this._dynamicListController.toTop(),
child: Icon(Icons.vertical_align_top))
],
),
);
}

Future<List> _initRequester() async {
return Future.value(List.generate(15, (i) => i));
}

Future<List> _dataRequester() async {
return Future.delayed(Duration(seconds: 2), () {
return List.generate(10, (i) => 15 + i);
});
}

final Function _itemBuilder =
(List dataList, BuildContext context, int index) {
String title = dataList[index].toString();
return ListTile(title: Text("Number $title"));
};
}
copied to clipboard
Contribute #
We would ❤️ to see your contribution!
License #
Distributed under the MIT license. See LICENSE for more information.
About #
Created by Shusheng.

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.