// import 'package:flutter/material.dart';
// class GamingPage extends StatelessWidget {
// const GamingPage({super.key});
// @override
// Widget build(BuildContext context) {
// final games = [
// {"title": "چرخونه شانس", "icon": Icons.casino},
// {"title": "جعبه جایزه", "icon": Icons.card_giftcard},
// {"title": "چیستان", "icon": Icons.quiz},
// {"title": "حدس کلمه", "icon": Icons.spellcheck},
// {"title": "بازی حافظه", "icon": Icons.memory},
// {"title": "پازل", "icon": Icons.extension},
// ];
// return Directionality(
// textDirection: TextDirection.rtl,
// child: Scaffold(
// body: CustomScrollView(
// slivers: [
// // 🔹 هدر بزرگ که کوچیک میشه
// SliverAppBar(
// expandedHeight: 200,
// pinned: true,
// floating: false,
// flexibleSpace: FlexibleSpaceBar(
// title: const Text("🎮 بازیها"),
// background: Container(
// decoration: const BoxDecoration(
// gradient: LinearGradient(
// colors: [Color(0xFF6A11CB), Color(0xFF2575FC)],
// begin: Alignment.topRight,
// end: Alignment.bottomLeft,
// ),
// ),
// child: Center(
// child: Icon(
// Icons.videogame_asset,
// size: 80,
// color: Colors.white.withOpacity(0.8),
// ),
// ),
// ),
// ),
// ),
// // 🔹 Grid بازیها
// SliverPadding(
// padding: const EdgeInsets.all(16),
// sliver: SliverGrid(
// gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2, // دو ستون
// mainAxisSpacing: 16,
// crossAxisSpacing: 16,
// childAspectRatio: 1, // مربعی
// ),
// delegate: SliverChildBuilderDelegate(
// (context, index) {
// final game = games[index];
// return _gameCard(
// context,
// game["title"] as String,
// game["icon"] as IconData,
// );
// },
// childCount: games.length,
// ),
// ),
// ),
// ],
// ),
// ),
// );
// }
// Widget _gameCard(BuildContext context, String title, IconData icon) {
// return InkWell(
// onTap: () {
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text("شروع بازی: $title")),
// );
// },
// child: Card(
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
// elevation: 4,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Icon(icon, size: 50, color: Colors.deepPurple),
// const SizedBox(height: 12),
// Text(
// title,
// style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
// ),
// ],
// ),
// ),
// );
// }
// }
/**
* !عالی
*
*
*/
// import 'package:flutter/material.dart';
// class GamingPage extends StatelessWidget {
// const GamingPage({super.key});
// @override
// Widget build(BuildContext context) {
// final games = [
// {"title": "چرخونه شانس", "icon": Icons.casino},
// {"title": "جعبه جایزه", "icon": Icons.card_giftcard},
// {"title": "چیستان", "icon": Icons.quiz},
// {"title": "حدس کلمه", "icon": Icons.spellcheck},
// {"title": "بازی حافظه", "icon": Icons.memory},
// {"title": "پازل", "icon": Icons.extension},
// ];
// return Directionality(
// textDirection: TextDirection.rtl,
// child: Scaffold(
// body: CustomScrollView(
// slivers: [
// // 🔹 هدر تصویری
// SliverAppBar(
// expandedHeight: 220,
// pinned: true,
// flexibleSpace: FlexibleSpaceBar(
// title: const Text("🎮 بازیها"),
// centerTitle: true,
// background: Image.asset(
// "assets/gaming_banner.jpg", // عکس بنر بزرگ
// fit: BoxFit.cover,
// ),
// ),
// ),
// // 🔹 Grid بازیها
// SliverPadding(
// padding: const EdgeInsets.all(16),
// sliver: SliverGrid(
// gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
// crossAxisCount: 2, // دو ستون
// mainAxisSpacing: 16,
// crossAxisSpacing: 16,
// childAspectRatio: 1, // مربعی دقیق
// ),
// delegate: SliverChildBuilderDelegate(
// (context, index) {
// final game = games[index];
// return _gameCard(
// context,
// game["title"] as String,
// game["icon"] as IconData,
// );
// },
// childCount: games.length,
// ),
// ),
// ),
// ],
// ),
// ),
// );
// }
// Widget _gameCard(BuildContext context, String title, IconData icon) {
// return InkWell(
// onTap: () {
// ScaffoldMessenger.of(context).showSnackBar(
// SnackBar(content: Text("شروع بازی: $title")),
// );
// },
// child: Card(
// shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
// elevation: 4,
// child: Column(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// Icon(icon, size: 50, color: Colors.deepPurple),
// const SizedBox(height: 12),
// Text(
// title,
// style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
// ),
// ],
// ),
// ),
// );
// }
// }
import 'package:flutter/material.dart';
import 'package:lottery_app/games/memory_page.dart';
import 'package:lottery_app/games/slotmachine_data.dart';
import 'package:lottery_app/games/time_game_page.dart';
import 'package:lottery_app/games/tuch_game_page.dart';
class GamingPage extends StatelessWidget {
const GamingPage({super.key});
@override
Widget build(BuildContext context) {
final games = [
{"title": "بازی حافظه", "icon": Icons.memory},
{"title": "ماشین شانس", "icon": Icons.casino},
{"title": "بازی تایم", "icon": Icons.timer_off_outlined},
{"title": "بازی تعداد کلیک", "icon": Icons.touch_app},
// {"title": "حدس کلمه", "icon": Icons.spellcheck},
// {"title": "بازی حافظه", "icon": Icons.memory},
// {"title": "پازل", "icon": Icons.extension},
// {"title": "پازل", "icon": Icons.extension},
// {"title": "پازل", "icon": Icons.extension},
];
return Directionality(
textDirection: TextDirection.rtl,
child: Scaffold(
body: CustomScrollView(
slivers: [
// 🔹 SliverAppBar با Parallax و Rounded Bottom
SliverAppBar(
expandedHeight: 260,
pinned: true,
stretch: true,
//snap: false,
backgroundColor: const Color.fromARGB(235, 0, 0, 0),
flexibleSpace: FlexibleSpaceBar(
title: const Text(
"🎮 بازیها",
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
),
),
centerTitle: true,
stretchModes: const [
StretchMode.zoomBackground,
StretchMode.fadeTitle,
],
background: Stack(
fit: StackFit.expand,
children: [
// تصویر پسزمینه
ClipRRect(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
child: Image.asset(
"assets/gaming_banner.jpg",
fit: BoxFit.cover,
),
),
// Overlay Gradient
Container(
decoration: BoxDecoration(
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30),
),
gradient: LinearGradient(
colors: [
Colors.black.withOpacity(0.4),
Colors.transparent,
],
begin: Alignment.bottomCenter,
end: Alignment.topCenter,
),
),
),
],
),
),
),
// 🔹 Grid بازیها
SliverPadding(
padding: const EdgeInsets.all(16),
sliver: SliverGrid(
gridDelegate: const SliverGridDelegateWithFixedCrossAxisCount(
crossAxisCount: 2,
mainAxisSpacing: 16,
crossAxisSpacing: 16,
childAspectRatio: 1, // مربع دقیق
),
delegate: SliverChildBuilderDelegate((context, index) {
final game = games[index];
return _gameCard(
context,
game["title"] as String,
game["icon"] as IconData,
);
}, childCount: games.length),
),
),
],
),
),
);
}
Widget _gameCard(BuildContext context, String title, IconData icon) {
return InkWell(
onTap: () {
Widget page;
switch (title) {
case "بازی حافظه":
page = MemoryTilesApp(); // صفحه مخصوص شطرنج
break;
case "ماشین شانس":
page = SlotMachineGame(); // صفحه مخصوص فوتبال
break;
case "بازی تایم":
page = TimeGamePage(); // صفحه مخصوص پازل
break;
case "بازی تعداد کلیک":
page = TouchGameApp(); // صفحه مخصوص پازل
break;
default:
page = GamingPage(); // fallback در صورتی که اسم بازی ناشناخته باشه
}
// رفتن به صفحه بعدی
Navigator.push(
context,
MaterialPageRoute(builder: (context) => page),
);
},
child: Card(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
elevation: 4,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Icon(icon, size: 50, color: Colors.deepPurple),
const SizedBox(height: 12),
Text(
title,
style: const TextStyle(fontSize: 16, fontWeight: FontWeight.w600),
),
],
),
),
);
}
}