Vertical scroll | Horizontal scroll |
---|---|
In your pubspec.yaml
dependencies:
scroll_cool_widget: ^0.0.1
import 'package:scroll_cool_widget/scroll_cool_widget.dart';
ScrollCoolWidget(
countOfCache: 10,
height: (MediaQuery.of(context).size.height),
width: (MediaQuery.of(context).size.width),
createWidget: (index, width, height) {
return Container(
width: width,
height: height,
color: Color((Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0),
child: Center(
child: Text('${index + 1}',
style: const TextStyle(
fontSize: 30,
),
),
),
);
},
)
ScrollCoolWidget(
countOfCache: 10,
height: (MediaQuery.of(context).size.height),
width: (MediaQuery.of(context).size.width),
scrollDirection: Axis.vertical,
buttonPosition: ButtonPosition.topLeft,
buttonColor: Colors.blueAccent,
buttonIconColor: Colors.white,
createWidget: (index, width, height) {
return Container(
width: width,
height: height,
color: Color((Random().nextDouble() * 0xFFFFFF).toInt()).withOpacity(1.0),
child: Center(
child: Text('${index + 1}',
style: const TextStyle(
fontSize: 30,
),
),
),
);
},
)
Parameters | Description |
---|---|
Widget Function(int index, double width, double height) createWidget |
Function for creating new widgets by index |
int countOfCache |
Count of widgets which will be loaded in advance |
double width |
Width of page |
double height |
Height of page |
Axis scrollDirection |
Direction of scrolling |
ButtonPosition buttonPosition |
Position of button for back |
Color buttonColor |
Color of button for back |
Color buttonIconColor |
Color of icon in button for back |
Available values:
ButtonPosition.none
- defaultButtonPosition.topLeft
ButtonPosition.topRight
ButtonPosition.bottomLeft
ButtonPosition.bottomRight
Here is using MIT license.