title: Flutter listview limit scroll
body: <p>I am developing a flutter app. I am using <code>ListView</code> for scrolling. I need a horizontal scrolling. The scrolling slides width is 75% 0f screen width. I have six slides, first three slides colors are red, purple, amber. When I scroll first slide red. It will show the second slide half. That means the scrolling width is 100%. I want to show each slide complete when scroll. If I scroll red I want to show purple complete. </p>
  
  <pre><code>import 'package:flutter/material.dart';
  
  void main() =&gt; runApp(MyApp());
  
  class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
      return MaterialApp(
      title: 'MyApp',
      home: MainPage(),
      );
  }
  }
  
  class MainPage extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
      return Scaffold(
      body: Container(
          height: MediaQuery.of(context).size.width/1.5,
          margin: EdgeInsets.symmetric(vertical: 50.0),
          child: LayoutBuilder(builder: (context, snapshot) {
          final width = MediaQuery.of(context).size.width / 1.5; 
          return ListView(
              itemExtent: width,
              physics: const PageScrollPhysics(), 
              scrollDirection: Axis.horizontal,
              children: [
              Container(margin: EdgeInsets.symmetric(horizontal: 10.0), color: Colors.redAccent,),
              Container(margin: EdgeInsets.symmetric(horizontal: 10.0), color: Colors.purpleAccent,),
              Container(margin: EdgeInsets.symmetric(horizontal: 10.0), color: Colors.amberAccent,),
              Container(margin: EdgeInsets.symmetric(horizontal: 10.0), color: Colors.blueAccent,),
              Container(margin: EdgeInsets.symmetric(horizontal: 10.0), color: Colors.pinkAccent,),
              Container(margin: EdgeInsets.symmetric(horizontal: 10.0), color: Colors.greenAccent,)
              ],
          );
          }),
      ),
      );
  }
  }
  </code></pre>
  
  <p>Current scrolling screenshot</p>
  
  <p><a href="https://i.stack.imgur.com/wDxsl.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/wDxsl.png" alt="screenshot 1"></a></p>
  
  <p><a href="https://i.stack.imgur.com/uG9Lo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/uG9Lo.png" alt="screenshot"></a></p>