ListWheelScrollView
import "package:flutter/material.dart";
void main() {
runApp(MakeApp(),);
}
class MakeApp extends StatelessWidget {
MakeApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "ListWheel ScrollView in Flutter",
theme: ThemeData(
primarySwatch: Colors.green,
),
home: WheelDemo(),
);
}
}
class WheelDemo extends StatefulWidget {
WheelDemo({super.key});
@override
State<WheelDemo> createState() {
return WheelState();
}
}
class WheelState extends State<WheelDemo> {
var arrIndex = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("ListWheel ScrollView"),
),
body: Center(
child: ListWheelScrollView(
//scrollBehavior: ScrollBehavior(),
itemExtent: 200.0,
children: arrIndex.map((value) {
return Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
child: Center(child: Text("$value",
style: TextStyle(fontWeight: FontWeight.bold, color: Colors.white, fontSize: 40.0,),),),
decoration: BoxDecoration(
color: Colors.blue,
borderRadius: BorderRadius.circular(21.0,),
),
width: double.infinity,
),
);
},).toList(),
),
),
);
}
}
Comments
Post a Comment