import 'package:flutter/material.dart';
import 'package:mobile_application_kids/ChatScreen.dart';
import 'package:mobile_application_kids/game1/the_memory_match_game.dart';
import 'package:mobile_application_kids/game2/song_tales.dart';
import 'package:mobile_application_kids/game3/emoX.dart';
import 'package:mobile_application_kids/game4/Posture_pro.dart';

class GamesPage extends StatelessWidget {
  final String commonImagePath = 'assets/act_photo.png';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('Games'),
      ),
      body: Column(
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Padding(
            padding: const EdgeInsets.all(16.0),
            child: Text(
              'My Games',
              style: TextStyle(
                fontSize: 24,
                fontWeight: FontWeight.bold,
              ),
            ),
          ),
          Expanded(
            child: ListView(
              children: [
                // Game 1 Card/Button
                Card(
                  child: ListTile(
                    contentPadding: EdgeInsets.all(16),
                    leading: Container(
                      width: 50,
                      height: 50,
                      child: CircleAvatar(
                        backgroundImage: AssetImage(commonImagePath),
                      ),
                    ),
                    title: Text(
                      'Game 1',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    subtitle: Text('Description for Game 1'),
                    onTap: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(
                            builder: (context) => TheMemoryMatchGame()),
                      );
                    },
                  ),
                ),
                // Game 2 Card/Button
                Card(
                  child: ListTile(
                    contentPadding: EdgeInsets.all(16),
                    leading: Container(
                      width: 50,
                      height: 50,
                      child: CircleAvatar(
                        backgroundImage: AssetImage(commonImagePath),
                      ),
                    ),
                    title: Text(
                      'Game 2',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    subtitle: Text('Description for Game 2'),
                    onTap: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(builder: (context) => SongTalesApp()),
                      );
                    },
                  ),
                ),
                // Game 3 Card/Button
                Card(
                  child: ListTile(
                    contentPadding: EdgeInsets.all(16),
                    leading: Container(
                      width: 50,
                      height: 50,
                      child: CircleAvatar(
                        backgroundImage: AssetImage(commonImagePath),
                      ),
                    ),
                    title: Text(
                      'Game 3',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    subtitle: Text('Description for Game 3'),
                    onTap: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(builder: (context) => EmoXApp()),
                      );
                    },
                  ),
                ),
                // Game 4 Card/Button
                Card(
                  child: ListTile(
                    contentPadding: EdgeInsets.all(16),
                    leading: Container(
                      width: 50,
                      height: 50,
                      child: CircleAvatar(
                        backgroundImage: AssetImage(commonImagePath),
                      ),
                    ),
                    title: Text(
                      'Game 4',
                      style: TextStyle(
                        fontSize: 18,
                        fontWeight: FontWeight.bold,
                      ),
                    ),
                    subtitle: Text('Description for Game 4'),
                    onTap: () {
                      Navigator.push(
                        context,
                        MaterialPageRoute(builder: (context) => PosturePro()),
                      );
                    },
                  ),
                ),
              ],
            ),
          ),
        ],
      ),

      bottomNavigationBar: BottomNavigationBar(
        items: const [
          BottomNavigationBarItem(
            icon: Icon(Icons.home),
            label: 'Home',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.chat),
            label: 'Chat',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.sports_baseball),
            label: 'Games',
          ),
          BottomNavigationBarItem(
            icon: Icon(Icons.person),
            label: 'Profile',
          ),
        ],
        selectedItemColor: Colors.blueAccent,
        unselectedItemColor: Colors.grey,
        currentIndex: 2,
        onTap: (index) {
          switch (index) {
            case 0:
              // Navigate to Home
              // Navigator.push(
              //   context,
              // MaterialPageRoute(builder: (context) => ParentHomePage(phoneNo, role)),
              // );
              break;
            case 1:
              // Navigate to Chat
              Navigator.push(
                context,
                MaterialPageRoute(builder: (context) => ChatScreen()),
              );
              break;
            case 2:
              // Do nothing, we are already on the Games page
              break;
            case 3:
              // Navigate to Profile
            //   Navigator.push(
            //   context,
            //   MaterialPageRoute(
            //     builder: (context) => ParentProfilePage(uid: uid, phoneNo: phoneNo, role: role),
            //   ),
            // );
              break;
          }
        },
      ),
    );
  }
}
