Commit dd0eb34d authored by Uditha Prabhasha 's avatar Uditha Prabhasha

Update parentHome.dart

parent 45a7ed22
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/classroomview.dart';
import 'package:mobile_application_kids/addclassroom.dart';
import 'package:mobile_application_kids/childrenProfile.dart';
import 'package:mobile_application_kids/classroomview.dart';
import 'package:mobile_application_kids/teacherchat.dart';
import 'ChatScreen.dart';
import 'TeacherProfile.dart';
import 'childrenProfile.dart';
class ParentHomePage extends StatelessWidget {
late User? user;
late final Stream<QuerySnapshot> _usersStream;
late String phoneNo;
late String role;
ParentHomePage(param0, role) {
this.role = role;
this.phoneNo = param0;
......@@ -28,7 +29,6 @@ class ParentHomePage extends StatelessWidget {
.snapshots();
}
// Define a TextStyle with the Poppins font
final TextStyle poppinsTextStyle = TextStyle(
fontFamily: 'Poppins',
);
......@@ -37,24 +37,14 @@ class ParentHomePage extends StatelessWidget {
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
// Disable the back button press
return false;
},
child: Scaffold(
appBar: AppBar(
// leading: Flexible(
// child: Image.asset(
// 'lib/assets/logo.png',
// fit: BoxFit.contain,
// height: 150, // Adjust the height to make the logo bigger
// ),
// ),
actions: [
IconButton(
icon: Icon(Icons.notifications),
onPressed: () {
// Handle notification icon press
},
onPressed: () {},
),
],
),
......@@ -67,7 +57,6 @@ class ParentHomePage extends StatelessWidget {
Text(
'Explore, learn, and play in our magical world of wonder!',
style: poppinsTextStyle.copyWith(
// fontWeight: FontWeight.bold,
fontSize: 13,
),
),
......@@ -84,11 +73,9 @@ class ParentHomePage extends StatelessWidget {
children: [
TextButton(
onPressed: () {
// Navigate to the AddClassroomPage
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddClassroomPage()),
MaterialPageRoute(builder: (context) => AddClassroomPage()),
);
},
child: Row(
......@@ -111,7 +98,6 @@ class ParentHomePage extends StatelessWidget {
child: StreamBuilder<QuerySnapshot>(
stream: _usersStream,
builder: (context, snapshot) {
print("--------------------------------------");
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
}
......@@ -119,7 +105,6 @@ class ParentHomePage extends StatelessWidget {
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
}
var itemcount = snapshot.data!.docs.length;
return ListView.builder(
itemCount: snapshot.data!.docs.length,
......@@ -127,16 +112,13 @@ class ParentHomePage extends StatelessWidget {
var document = snapshot.data!.docs[index];
var className = document['className'];
var name = document['Firstname'];
print(document);
return Padding(
padding: const EdgeInsets.only(
bottom: 8.0), // Adjust the spacing as needed
padding: const EdgeInsets.only(bottom: 8.0),
child: ListTile(
leading: CircleAvatar(
radius: 27.0,
backgroundImage:
AssetImage('lib/assets/classlogo.png'),
backgroundImage: AssetImage('lib/assets/classlogo.png'),
),
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
......@@ -170,8 +152,6 @@ class ParentHomePage extends StatelessWidget {
),
child: TextButton(
onPressed: () {
print(document);
// Handle view class button press
Navigator.push(
context,
MaterialPageRoute(
......@@ -209,7 +189,6 @@ class ParentHomePage extends StatelessWidget {
icon: Icon(Icons.chat),
label: 'Chat',
),
// New BottomNavigationBarItem for the game
BottomNavigationBarItem(
icon: Icon(Icons.games),
label: 'Games',
......@@ -221,12 +200,10 @@ class ParentHomePage extends StatelessWidget {
],
selectedItemColor: Colors.blue,
onTap: (index) {
// Handle bottom navigation item tap
switch (index) {
case 0:
break;
case 1:
// Navigate to Chat
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ChatScreen()),
......@@ -236,7 +213,6 @@ class ParentHomePage extends StatelessWidget {
// Handle Game
break;
case 3:
// Navigate to Profile
Navigator.push(
context,
MaterialPageRoute(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment