I have Listview just scroll Horizontal or Vertical. So how the Listview can scroll both Horizontal and Vertical in Flutter?
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: false, // set it to false
appBar: AppBar(
title: Text("List Machine"),
centerTitle: true,
),
body: ListView(
scrollDirection: Axis.horizontal,
children: [_createDataTable()]));
}
wrap the list view with ScrollBar
To scroll listview in vertical and horizontal you have to define scroll direction.
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("List Machine"),
centerTitle: true,
),
body: ListView(
scrollDirection: Axis.horizontal ,
children:[],
}
You can use Axis.horizontal attribute and Axis.vertical
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.