Skip to content

Instantly share code, notes, and snippets.

@Ahmadre
Created November 24, 2019 22:06
Show Gist options
  • Save Ahmadre/23f442f88f080365c2d81ad335b266b7 to your computer and use it in GitHub Desktop.
Save Ahmadre/23f442f88f080365c2d81ad335b266b7 to your computer and use it in GitHub Desktop.
Scrolling not working in ListView in Flutter Web
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class SimpleList extends StatefulWidget {
SimpleList({Key key}) : super(key: key);
@override
_SimpleList createState() => _SimpleList();
}
class _SimpleList extends State<SimpleList> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(),
body: ListView(
padding: EdgeInsets.only(
left: 20, right: 20, bottom: 30),
physics: AlwaysScrollableScrollPhysics(),
shrinkWrap: true,
scrollDirection: Axis.horizontal,
children: [
Container(
color: Colors.red,
width: 200,
height: 500
),
Container(
color: Colors.red,
width: 200,
height: 500
),
Container(
color: Colors.red,
width: 200,
height: 500
),
Container(
color: Colors.red,
width: 200,
height: 500
),
Container(
color: Colors.red,
width: 200,
height: 500
),
Container(
color: Colors.red,
width: 200,
height: 500
),
],
),
);
}
}
class MyApp extends StatefulWidget {
MyApp({Key key}) : super(key: key);
@override
_MyApp createState() => _MyApp();
}
class _MyApp extends State<MyApp> {
@override
Widget build(BuildContext context) {
return new MaterialApp(
debugShowCheckedModeBanner: false,
title: 'MyApp',
home: SimpleList(),
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment