list_wheel_scroll_view_nls 0.0.5
list_wheel_scroll_view_nls: ^0.0.5 copied to clipboard
A flutter project which add scroll direction to ListWheelScrollView allowing you to have horizontal ListWheelScroolView.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:list_wheel_scroll_view_nls/list_wheel_scroll_view_nls.dart';
void main() {
runApp(const MaterialApp(
debugShowCheckedModeBanner: false,
home: PremiumExample(),
));
}
class PremiumExample extends StatelessWidget {
const PremiumExample({super.key});
@override
Widget build(BuildContext context) {
// Premium dark theme colors
const backgroundColor = Color(0xFF121212);
const cardColor = Color(0xFF1E1E1E);
const accentColor = Color(0xFFBB86FC);
return Scaffold(
backgroundColor: backgroundColor,
appBar: AppBar(
systemOverlayStyle: SystemUiOverlayStyle.light,
backgroundColor: Colors.transparent,
elevation: 0,
centerTitle: true,
title: const Text(
'M O V I E S',
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.w300,
letterSpacing: 2.0,
),
),
),
body: Center(
child: SizedBox(
height: 450,
child: ListWheelScrollViewX(
scrollDirection: Axis.horizontal,
itemExtent: 250,
diameterRatio: 1.5,
offAxisFraction: -0.5,
perspective: 0.003,
physics: const FixedExtentScrollPhysics(),
children: List.generate(
10,
(index) => MovieCard(
index: index,
color: cardColor,
accent: accentColor,
),
),
),
),
),
);
}
}
class MovieCard extends StatelessWidget {
final int index;
final Color color;
final Color accent;
const MovieCard({
super.key,
required this.index,
required this.color,
required this.accent,
});
@override
Widget build(BuildContext context) {
return Container(
margin: const EdgeInsets.symmetric(horizontal: 10),
decoration: BoxDecoration(
color: color,
borderRadius: BorderRadius.circular(24),
boxShadow: [
BoxShadow(
color: Colors.black.withValues(alpha: 0.5),
blurRadius: 20,
offset: const Offset(0, 10),
),
],
gradient: LinearGradient(
begin: Alignment.topLeft,
end: Alignment.bottomRight,
colors: [
color,
color.withValues(alpha: 0.8),
],
),
),
child: ClipRRect(
borderRadius: BorderRadius.circular(24),
child: Stack(
children: [
// Placeholder for movie poster
Positioned.fill(
child: Container(
decoration: BoxDecoration(
gradient: LinearGradient(
begin: Alignment.topCenter,
end: Alignment.bottomCenter,
colors: [
Colors.transparent,
Colors.black.withValues(alpha: 0.8),
],
),
),
),
),
// Content
Padding(
padding: const EdgeInsets.all(24.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
mainAxisAlignment: MainAxisAlignment.end,
children: [
Text(
'MOVIE ${index + 1}',
style: const TextStyle(
color: Colors.white,
fontSize: 24,
fontWeight: FontWeight.bold,
letterSpacing: 1.2,
),
),
const SizedBox(height: 8),
Row(
children: [
Icon(Icons.star, color: accent, size: 16),
const SizedBox(width: 4),
Text(
(8.5 + (index * 0.1) % 1.5).toStringAsFixed(1),
style: const TextStyle(
color: Colors.white70,
fontSize: 14,
fontWeight: FontWeight.w500,
),
),
const SizedBox(width: 16),
Container(
padding: const EdgeInsets.symmetric(
horizontal: 8,
vertical: 4,
),
decoration: BoxDecoration(
border: Border.all(color: Colors.white30),
borderRadius: BorderRadius.circular(4),
),
child: const Text(
'PG-13',
style: TextStyle(
color: Colors.white70,
fontSize: 10,
),
),
),
],
),
],
),
),
// Accent line
Positioned(
top: 24,
right: 24,
child: Container(
width: 40,
height: 40,
decoration: BoxDecoration(
color: accent.withValues(alpha: 0.1),
shape: BoxShape.circle,
),
child: Center(
child: Icon(
Icons.bookmark_border,
color: accent,
size: 20,
),
),
),
),
],
),
),
);
}
}