Skip to content

Instantly share code, notes, and snippets.

@mohammedsalem97
Created February 20, 2020 22:19
Show Gist options
  • Save mohammedsalem97/e8c93d9691167024122a2eda1dfa92e3 to your computer and use it in GitHub Desktop.
Save mohammedsalem97/e8c93d9691167024122a2eda1dfa92e3 to your computer and use it in GitHub Desktop.
ListWheelScrollView Example
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Flutter Demo',
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar:AppBar(
title:Text("Wheel test"),
),
backgroundColor:Colors.red,
body:ListWheelScrollView.useDelegate(
itemExtent: 100.0,
clipToSize: true,
diameterRatio: 1.0,
magnification: 2,
overAndUnderCenterOpacity: 1,
offAxisFraction: 0.1,
// useMagnifier: true,
physics: PageScrollPhysics(),
onSelectedItemChanged: (i) => print("Changed $i"),
renderChildrenOutsideViewport: false,
//squeeze: 1.5,
childDelegate: ListWheelChildBuilderDelegate(
builder: (context,index){
return Container(
color:Colors.white,
width:MediaQuery.of(context).size.width/3,
child: ListTile(
title:Text(index.toString()),
trailing:Icon(Icons.home),
),
);
},
),
),
);
}
}
@NeoHosseinism
Copy link

TNX :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment