Commit 47ccb2f3 authored by Uditha Prabhasha 's avatar Uditha Prabhasha

update prabasha

parent 3a228a79
No preview for this file type
...@@ -195,9 +195,9 @@ ...@@ -195,9 +195,9 @@
}, },
{ {
"name": "image_picker", "name": "image_picker",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker-1.0.7", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker-0.8.9",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "3.0" "languageVersion": "2.18"
}, },
{ {
"name": "image_picker_android", "name": "image_picker_android",
...@@ -362,7 +362,7 @@ ...@@ -362,7 +362,7 @@
"languageVersion": "3.0" "languageVersion": "3.0"
} }
], ],
"generated": "2024-01-15T19:08:05.177861Z", "generated": "2024-02-07T12:20:09.439018Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "3.0.1" "generatorVersion": "3.0.1"
} }
...@@ -131,9 +131,9 @@ http_parser ...@@ -131,9 +131,9 @@ http_parser
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/http_parser-4.0.2/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/http_parser-4.0.2/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/http_parser-4.0.2/lib/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/http_parser-4.0.2/lib/
image_picker image_picker
3.0 2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker-1.0.7/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker-0.8.9/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker-1.0.7/lib/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker-0.8.9/lib/
image_picker_android image_picker_android
3.0 3.0
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/
...@@ -236,6 +236,6 @@ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/vector_math-2.1.4/ ...@@ -236,6 +236,6 @@ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/vector_math-2.1.4/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/vector_math-2.1.4/lib/
jema_app jema_app
3.0 3.0
file:///Users/avishkanew/Desktop/Jema%20Kids%20App/monitoring-and-recommendations-for-early-childhood-development/ file:///Users/avishkanew/Desktop/Avishk678/monitoring-and-recommendations-for-early-childhood-development/
file:///Users/avishkanew/Desktop/Jema%20Kids%20App/monitoring-and-recommendations-for-early-childhood-development/lib/ file:///Users/avishkanew/Desktop/Avishk678/monitoring-and-recommendations-for-early-childhood-development/lib/
2 2
...@@ -9,7 +9,7 @@ firebase_auth_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth_web- ...@@ -9,7 +9,7 @@ firebase_auth_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth_web-
firebase_core=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/ firebase_core=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/
firebase_core_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core_web-2.10.0/ firebase_core_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core_web-2.10.0/
flutter_plugin_android_lifecycle=/Users/avishkanew/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.17/ flutter_plugin_android_lifecycle=/Users/avishkanew/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.17/
image_picker=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker-1.0.7/ image_picker=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker-0.8.9/
image_picker_android=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/ image_picker_android=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/
image_picker_for_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_for_web-2.2.0/ image_picker_for_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_for_web-2.2.0/
image_picker_ios=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.9/ image_picker_ios=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.9/
......
This diff is collapsed.
This diff is collapsed.
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_storage/firebase_storage.dart';
class ChatScreen extends StatefulWidget {
@override
_ChatScreenState createState() => _ChatScreenState();
}
class _ChatScreenState extends State<ChatScreen> {
final TextEditingController _textController = TextEditingController();
final FirebaseFirestore _firestore = FirebaseFirestore.instance;
final FirebaseAuth _auth = FirebaseAuth.instance;
late User? _user;
File? _imageFile;
String? _voiceFilePath;
@override
void initState() {
super.initState();
_user = _auth.currentUser;
}
void _sendMessage() async {
try {
if (_textController.text.isNotEmpty ||
_imageFile != null ||
_voiceFilePath != null) {
String message = _textController.text.trim();
_textController.clear();
String imageUrl = '';
String voiceUrl = '';
if (_imageFile != null) {
imageUrl = await _uploadFile(_imageFile!);
}
if (_voiceFilePath != null) {
voiceUrl = await _uploadFile(File(_voiceFilePath!));
}
await _firestore.collection('messages').add({
'text': message,
'createdAt': Timestamp.now(),
'user': _user!.uid,
'imageUrl': imageUrl,
'voiceUrl': voiceUrl,
});
_imageFile = null;
_voiceFilePath = null;
}
} catch (e, stackTrace) {
print('Error sending message: $e');
print('Stack trace: $stackTrace');
// Handle the error gracefully, e.g., show a snackbar or display an error message
}
}
Future<String> _uploadFile(File file) async {
Reference storageReference = FirebaseStorage.instance
.ref()
.child('uploads/${DateTime.now().millisecondsSinceEpoch}');
UploadTask uploadTask = storageReference.putFile(file);
await uploadTask.whenComplete(() => null);
return await storageReference.getDownloadURL();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Chat'),
),
body: Column(
children: <Widget>[
Expanded(
child: StreamBuilder(
stream: _firestore
.collection('messages')
.orderBy('createdAt', descending: true)
.snapshots(),
builder: (context, AsyncSnapshot<QuerySnapshot> snapshot) {
if (!snapshot.hasData) {
return Center(
child: CircularProgressIndicator(),
);
}
return ListView.builder(
reverse: true,
itemCount: snapshot.data!.docs.length,
itemBuilder: (context, index) {
var message = snapshot.data!.docs[index];
bool isCurrentUser = message['user'] == _user!.uid;
// Perform null check before accessing properties using []
String? text = (message.data()
as Map<String, dynamic>)['text'] as String?;
String? imageUrl = (message.data()
as Map<String, dynamic>)['imageUrl'] as String?;
String? voiceUrl = (message.data()
as Map<String, dynamic>)['voiceUrl'] as String?;
return MessageBubble(
message: text ?? '',
imageUrl: imageUrl,
voiceUrl: voiceUrl,
isCurrentUser: isCurrentUser,
);
},
);
},
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: <Widget>[
IconButton(
icon: Icon(Icons.photo),
onPressed: () async {
XFile? image = await ImagePicker()
.pickImage(source: ImageSource.gallery);
if (image != null) {
setState(() {
_imageFile = File(image.path);
});
}
},
),
Expanded(
child: TextField(
controller: _textController,
decoration: InputDecoration(
labelText: 'Send a message...',
),
),
),
IconButton(
icon: Icon(Icons.send),
onPressed: _sendMessage,
),
],
),
),
],
),
);
}
}
class MessageBubble extends StatelessWidget {
final String message;
final String? imageUrl;
final String? voiceUrl;
final bool isCurrentUser;
const MessageBubble({
Key? key,
required this.message,
required this.isCurrentUser,
this.imageUrl,
this.voiceUrl,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.symmetric(vertical: 4.0, horizontal: 8.0),
child: Align(
alignment: isCurrentUser ? Alignment.centerRight : Alignment.centerLeft,
child: Container(
decoration: BoxDecoration(
color: isCurrentUser ? Colors.blue : Colors.green,
borderRadius: BorderRadius.circular(12.0),
),
padding: EdgeInsets.all(12.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if (imageUrl != null &&
Uri.parse(imageUrl!)
.isAbsolute) // Check if imageUrl is not null and a valid network URL
Image.network(
imageUrl!,
width: 200,
),
if (message.isNotEmpty) Text(message),
],
),
),
),
);
}
}
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jema_app/ChatScreen.dart';
import 'package:jema_app/teacherchat.dart'; import 'package:jema_app/teacherchat.dart';
import 'package:jema_app/classroomview.dart'; import 'package:jema_app/classroomview.dart';
import 'package:jema_app/addclassroom.dart'; import 'package:jema_app/addclassroom.dart';
import 'package:jema_app/teacherhome.dart';
import 'TeacherProfile.dart'; import 'TeacherProfile.dart';
class CheckKidsPage extends StatelessWidget { class CheckKidsPage extends StatelessWidget {
late User? user; late User? user;
...@@ -17,8 +19,8 @@ class CheckKidsPage extends StatelessWidget { ...@@ -17,8 +19,8 @@ class CheckKidsPage extends StatelessWidget {
void initializeStreams() { void initializeStreams() {
_usersStream = FirebaseFirestore.instance _usersStream = FirebaseFirestore.instance
.collection('classroom') .collection('students')
.where('userId', isEqualTo: user?.uid) .where('user', isEqualTo: user?.uid)
.snapshots(); .snapshots();
} }
...@@ -106,22 +108,20 @@ class CheckKidsPage extends StatelessWidget { ...@@ -106,22 +108,20 @@ class CheckKidsPage extends StatelessWidget {
itemCount: itemCount, itemCount: itemCount,
itemBuilder: (context, index) { itemBuilder: (context, index) {
var document = snapshot.data!.docs[index]; var document = snapshot.data!.docs[index];
var className = document['className']; var className = document['Firstname'];
var image = document['image'];
var isCheck = document['isCheck'];
return Padding( return Padding(
padding: const EdgeInsets.fromLTRB(0, 20, 0, 0), padding: const EdgeInsets.fromLTRB(0, 20, 0, 0),
child: InkWell( child: InkWell(
onTap: () { onTap: () {
print(document); print(document);
// Handle view class button press if (isCheck == 1) {
Navigator.push( updateStudentAge(document.id, 0);
context, } else {
MaterialPageRoute( // Handle view class button press
builder: (context) => ClassroomViewPage( updateStudentAge(document.id, 1);
documents: className, }
),
),
);
}, },
child: SingleChildScrollView( child: SingleChildScrollView(
child: Column( child: Column(
...@@ -140,8 +140,9 @@ class CheckKidsPage extends StatelessWidget { ...@@ -140,8 +140,9 @@ class CheckKidsPage extends StatelessWidget {
height: 74.24, height: 74.24,
decoration: ShapeDecoration( decoration: ShapeDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage( image: NetworkImage(
"lib/assets/Ellipse 8.png"), image,
),
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
shape: OvalBorder(), shape: OvalBorder(),
...@@ -155,7 +156,11 @@ class CheckKidsPage extends StatelessWidget { ...@@ -155,7 +156,11 @@ class CheckKidsPage extends StatelessWidget {
width: 74.24, width: 74.24,
height: 74.24, height: 74.24,
decoration: ShapeDecoration( decoration: ShapeDecoration(
color: Color(0x4CB8B4B4), color: isCheck == 1
? Color.fromARGB(
72, 219, 219, 219)
: Color.fromARGB(
71, 218, 49, 11),
shape: OvalBorder(), shape: OvalBorder(),
), ),
), ),
...@@ -167,7 +172,11 @@ class CheckKidsPage extends StatelessWidget { ...@@ -167,7 +172,11 @@ class CheckKidsPage extends StatelessWidget {
width: 59.40, width: 59.40,
padding: const EdgeInsets.all(4.95), padding: const EdgeInsets.all(4.95),
decoration: ShapeDecoration( decoration: ShapeDecoration(
color: Color(0xDD7D8088), color: isCheck == 1
? Color.fromARGB(
160, 28, 136, 224)
: Color.fromARGB(
71, 218, 49, 11),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: borderRadius:
BorderRadius.circular(4.95), BorderRadius.circular(4.95),
...@@ -229,20 +238,26 @@ class CheckKidsPage extends StatelessWidget { ...@@ -229,20 +238,26 @@ class CheckKidsPage extends StatelessWidget {
onTap: (index) { onTap: (index) {
switch (index) { switch (index) {
case 0: case 0:
// Navigate to Home Navigator.push(
context,
MaterialPageRoute(builder: (context) => TeacherHomePage()),
);
break; break;
case 1: case 1:
// Navigate to Chat // Navigate to Chat
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => TeacherChatPage()), MaterialPageRoute(builder: (context) => ChatScreen()),
); );
break; break;
case 2: case 2:
// Navigate to Profile // Navigate to Profile
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => TeacherProfilePage()), MaterialPageRoute(
builder: (context) => TeacherProfilePage(
uid: user?.uid,
)),
); );
break; break;
} }
...@@ -251,4 +266,19 @@ class CheckKidsPage extends StatelessWidget { ...@@ -251,4 +266,19 @@ class CheckKidsPage extends StatelessWidget {
), ),
); );
} }
void updateStudentAge(String documentId, int check) async {
try {
await FirebaseFirestore.instance
.collection('students')
.doc(documentId)
.update({
'isCheck': check,
// Add more fields to update if needed
});
print('Document updated successfully!');
} catch (e) {
print('Error updating document: $e');
}
}
} }
This diff is collapsed.
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:jema_app/Attendance.dart';
import 'package:jema_app/ChildrenVideo.dart';
import 'package:jema_app/ReportKids.dart';
import 'CheckKids.dart';
import 'ChildrenActiPhone.dart';
import 'ChildrenHomePage.dart';
import 'addstudent.dart';
class ChildrenActivity extends StatelessWidget {
late Future<List<DocumentSnapshot>> students = getStudentData();
final TextEditingController _searchController = TextEditingController();
late StreamController<String> _searchTermController;
late User? user;
ChildrenActivity({super.key}) {
user = FirebaseAuth.instance.currentUser;
}
Future<List<DocumentSnapshot>> getStudentData() async {
QuerySnapshot querySnapshot =
await FirebaseFirestore.instance.collection('students').get();
return querySnapshot.docs;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context);
},
),
actions: [
Text(
'Activities ',
style: TextStyle(
color: Color(0xFF554994),
fontSize: 24,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
height: 0.04,
letterSpacing: -0.96,
),
)
],
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Padding(
padding: const EdgeInsets.fromLTRB(20, 40, 20, 20),
child: Container(
width: 293,
height: 44,
decoration: ShapeDecoration(
color: Colors.white,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
shadows: [
BoxShadow(
color: Color(0x3F000000),
blurRadius: 4,
offset: Offset(0, 1),
spreadRadius: 0,
),
],
),
child: TextField(
controller: _searchController,
onChanged: (value) {
_searchTermController.add(value);
},
decoration: InputDecoration(
hintText: 'Search',
border: InputBorder.none,
icon: Padding(
padding: const EdgeInsets.all(8.0),
child: Icon(Icons.search),
),
suffixIcon: Icon(Icons.mic),
contentPadding: EdgeInsets.all(8),
),
),
),
),
SizedBox(height: 10),
GridView.count(
crossAxisCount: 2,
childAspectRatio: (1 / 0.6),
shrinkWrap: true,
children: [
GestureDetector(
onTap: () {
openCamera(context);
},
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
width: 170,
height: 85,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'lib/assets/ac1.png'), // Replace 'path/to/your/image.jpg' with your image path
fit: BoxFit
.cover, // Adjust this according to your needs
)),
),
),
),
GestureDetector(
onTap: () {
openVideoRecorder(context);
},
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
width: 170,
height: 85,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'lib/assets/ac2.png'), // Replace 'path/to/your/image.jpg' with your image path
fit: BoxFit
.cover, // Adjust this according to your needs
)),
),
),
),
GestureDetector(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => ChildrenActivity(),
));
},
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
width: 170,
height: 85,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'lib/assets/ac3.png'), // Replace 'path/to/your/image.jpg' with your image path
fit: BoxFit
.cover, // Adjust this according to your needs
)),
),
),
),
GestureDetector(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => CheckKidsPage(),
));
},
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
width: 170,
height: 85,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'lib/assets/ac4.png'), // Replace 'path/to/your/image.jpg' with your image path
fit: BoxFit
.cover, // Adjust this according to your needs
)),
),
),
),
GestureDetector(
onTap: () {
Navigator.of(context).push(MaterialPageRoute(
builder: (_) => ReportKidsPage(),
));
},
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Container(
width: 170,
height: 85,
clipBehavior: Clip.antiAlias,
decoration: BoxDecoration(
image: DecorationImage(
image: AssetImage(
'lib/assets/ac5.png'), // Replace 'path/to/your/image.jpg' with your image path
fit: BoxFit
.cover, // Adjust this according to your needs
)),
),
),
),
]),
],
),
),
),
);
}
void openCamera(context) async {
final picker = ImagePicker();
final pickedFile = await picker.pickImage(source: ImageSource.camera);
if (pickedFile != null) {
String imagePath = pickedFile.path;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChildrenActiPhone(image: imagePath)),
);
// Use the picked file, for example, display it in an Image widget
// Image.file(File(pickedFile.path))
print('Image selected: ${pickedFile.path}');
} else {
print('No image selected');
}
}
void openVideoRecorder(context) async {
final picker = ImagePicker();
final pickedFile = await picker.pickVideo(source: ImageSource.camera);
if (pickedFile != null) {
String imagePath = pickedFile.path;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChildrenVideo(video: imagePath)),
);
// Use the picked file, for example, display it in a Video widget
// Video.file(File(pickedFile.path))
print('Video selected: ${pickedFile.path}');
} else {
print('No video selected');
}
}
}
import 'dart:async';
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
...@@ -5,24 +7,43 @@ import 'package:jema_app/teacherchat.dart'; ...@@ -5,24 +7,43 @@ import 'package:jema_app/teacherchat.dart';
import 'package:jema_app/classroomview.dart'; import 'package:jema_app/classroomview.dart';
import 'package:jema_app/addclassroom.dart'; import 'package:jema_app/addclassroom.dart';
import 'childrenProfile.dart';
import 'childrenProfile.dart';
class ChildrenHomePage extends StatelessWidget { class ChildrenHomePage extends StatelessWidget {
late User? user; late User? user;
final TextEditingController _searchController = TextEditingController();
late StreamController<String> _searchTermController;
late final Stream<QuerySnapshot> _usersStream; late final Stream<QuerySnapshot> _usersStream;
ChildrenHomePage() { ChildrenHomePage() {
user = FirebaseAuth.instance.currentUser; user = FirebaseAuth.instance.currentUser;
initializeStreams();
_searchTermController = StreamController<String>.broadcast();
_usersStream = FirebaseFirestore.instance
.collection('students')
.where('user', isEqualTo: user?.uid)
.snapshots();
_searchTermController.stream.listen((searchTerm) {
_usersStream = searchStudents(searchTerm);
});
}
@override
void dispose() {
_searchController.dispose();
_searchTermController.close();
} }
void initializeStreams() { void initializeStreams() {
_usersStream = FirebaseFirestore.instance _usersStream = FirebaseFirestore.instance
.collection('classroom') .collection('students')
.where('userId', isEqualTo: user?.uid) .where('user', isEqualTo: user?.uid)
.snapshots(); .snapshots();
} }
@override
void initState() {}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return WillPopScope( return WillPopScope(
...@@ -88,6 +109,10 @@ class ChildrenHomePage extends StatelessWidget { ...@@ -88,6 +109,10 @@ class ChildrenHomePage extends StatelessWidget {
], ],
), ),
child: TextField( child: TextField(
controller: _searchController,
onChanged: (value) {
_searchTermController.add(value);
},
decoration: InputDecoration( decoration: InputDecoration(
hintText: 'Search', hintText: 'Search',
border: InputBorder.none, border: InputBorder.none,
...@@ -120,8 +145,9 @@ class ChildrenHomePage extends StatelessWidget { ...@@ -120,8 +145,9 @@ class ChildrenHomePage extends StatelessWidget {
itemCount: snapshot.data!.docs.length, itemCount: snapshot.data!.docs.length,
itemBuilder: (context, index) { itemBuilder: (context, index) {
var document = snapshot.data!.docs[index]; var document = snapshot.data!.docs[index];
var name = document['className']; var name = document['Firstname'];
var className = document['className']; var className = document['className'];
var image = document['image'];
return Padding( return Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
...@@ -138,15 +164,14 @@ class ChildrenHomePage extends StatelessWidget { ...@@ -138,15 +164,14 @@ class ChildrenHomePage extends StatelessWidget {
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment:
CrossAxisAlignment.center, CrossAxisAlignment.start,
children: [ children: [
Container( Container(
width: 77, width: 77,
height: 77, height: 77,
decoration: ShapeDecoration( decoration: ShapeDecoration(
image: DecorationImage( image: DecorationImage(
image: AssetImage( image: NetworkImage(image),
"lib/assets/tsignup1.png"),
fit: BoxFit.fill, fit: BoxFit.fill,
), ),
shape: OvalBorder(), shape: OvalBorder(),
...@@ -185,7 +210,7 @@ class ChildrenHomePage extends StatelessWidget { ...@@ -185,7 +210,7 @@ class ChildrenHomePage extends StatelessWidget {
padding: padding:
const EdgeInsets.all(8.0), const EdgeInsets.all(8.0),
child: Text( child: Text(
'Class Room 01', className,
style: TextStyle( style: TextStyle(
color: Colors.black, color: Colors.black,
fontSize: 14, fontSize: 14,
...@@ -203,37 +228,44 @@ class ChildrenHomePage extends StatelessWidget { ...@@ -203,37 +228,44 @@ class ChildrenHomePage extends StatelessWidget {
), ),
), ),
const SizedBox(width: 70), const SizedBox(width: 70),
InkWell( Row(
onTap: () { mainAxisAlignment: MainAxisAlignment
Navigator.of(context).push( .end, // Aligns children to the right
MaterialPageRoute( children: [
builder: (_) => ChildrenProfilePage(), GestureDetector(
), onTap: () {
); Navigator.of(context).push(
}, MaterialPageRoute(
child: Container( builder: (_) =>
width: 75, ChildrenProfilePage(document),
height: 36, ),
padding: const EdgeInsets.symmetric( );
horizontal: 20, vertical: 12), },
decoration: ShapeDecoration( child: Container(
color: Color(0xFFB983FF), width: 75,
shape: RoundedRectangleBorder( height: 36,
borderRadius: padding: const EdgeInsets.symmetric(
BorderRadius.circular(4)), horizontal: 20, vertical: 12),
), decoration: ShapeDecoration(
child: Text( color: Color(0xFFB983FF),
'View', shape: RoundedRectangleBorder(
style: TextStyle( borderRadius:
color: Colors.white, BorderRadius.circular(4)),
fontSize: 14, ),
fontFamily: 'Poppins', child: Text(
fontWeight: FontWeight.w600, 'View',
height: 1, style: TextStyle(
color: Colors.white,
fontSize: 14,
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
height: 1,
),
textAlign: TextAlign.right,
),
), ),
textAlign: TextAlign.center,
), ),
), ],
), ),
], ],
), ),
...@@ -247,8 +279,15 @@ class ChildrenHomePage extends StatelessWidget { ...@@ -247,8 +279,15 @@ class ChildrenHomePage extends StatelessWidget {
], ],
), ),
), ),
), ),
); );
} }
Stream<QuerySnapshot> searchStudents(String searchTerm) {
return FirebaseFirestore.instance
.collection('students')
.where('user', isEqualTo: user?.uid)
.where('FirstName', isGreaterThanOrEqualTo: searchTerm)
.snapshots();
}
} }
This diff is collapsed.
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:jema_app/parentHome.dart';
import 'package:jema_app/teacherhome.dart';
class ParentLoginPage extends StatefulWidget {
const ParentLoginPage({Key? key, required this.backgroundColor})
: super(key: key);
final Color backgroundColor;
@override
_ParentLoginPage createState() =>
_ParentLoginPage(backgroundColor: backgroundColor);
}
class _ParentLoginPage extends State<ParentLoginPage> {
_ParentLoginPage({Key? key, required this.backgroundColor});
final Color backgroundColor;
TextEditingController emailController = TextEditingController();
TextEditingController passwordController = TextEditingController();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: const Icon(
Icons.arrow_back,
color: Color.fromARGB(255, 0, 0, 0),
),
onPressed: () {
Navigator.pop(context);
},
),
),
body: Container(
color: backgroundColor,
child: SafeArea(
child: SingleChildScrollView(
child: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.all(10.0),
child: Image.asset(
'lib/assets/teachersignin.png',
width: 290,
height: 250,
),
),
const SizedBox(height: 10),
const Text(
'Welcome back',
style: TextStyle(
color: Colors.purple,
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
const SizedBox(height: 20),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: TextFormField(
controller: emailController,
style: const TextStyle(color: Colors.black),
decoration: InputDecoration(
labelText: 'Email',
labelStyle: TextStyle(color: Colors.black),
fillColor: Colors.grey[200],
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide.none,
),
suffixIcon: Icon(Icons.email, color: Colors.black),
),
validator: (value) {
RegExp regex = new RegExp(r'^.{6,}$');
if (value!.isEmpty) {
return "Password cannot be empty";
}
if (!regex.hasMatch(value)) {
return ("please enter valid password min. 6 character");
} else {
return null;
}
},
),
),
const SizedBox(height: 10),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 20),
child: TextFormField(
controller: passwordController,
style: const TextStyle(color: Colors.black),
obscureText: true,
decoration: InputDecoration(
labelText: 'Password',
labelStyle: TextStyle(color: Colors.black),
fillColor: Colors.grey[200],
filled: true,
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide.none,
),
suffixIcon: Icon(Icons.lock, color: Colors.black),
),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
signIn(emailController.text, passwordController.text,
context);
},
onLongPress: () {},
child: Container(
width: double.infinity,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Colors.green,
),
child: Center(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
'Login',
style: TextStyle(color: Colors.black),
),
),
),
),
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
elevation: 0,
),
),
],
),
),
),
),
),
),
);
}
void route(context) {
User? user = FirebaseAuth.instance.currentUser;
var kk = FirebaseFirestore.instance
.collection('users')
.doc(user!.uid)
.get()
.then((DocumentSnapshot documentSnapshot) {
if (documentSnapshot.exists) {
if (documentSnapshot.get('rool') == "parent") {
AwesomeDialog(
context: context,
dialogType: DialogType.success,
animType: AnimType.rightSlide,
title: 'Successfully login',
desc: ' Go to your home page',
btnCancelOnPress: () {},
btnOkOnPress: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
ParentHomePage(documentSnapshot.get('phoneNo')),
),
);
},
)..show();
print("login teacher");
} else {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => TeacherHomePage(),
),
);
}
} else {
AwesomeDialog(
context: context,
dialogType: DialogType.warning,
animType: AnimType.rightSlide,
title: 'Faild login',
desc: 'No user found for that email',
btnOkOnPress: () {},
)..show();
print('Document does not exist on the database');
}
});
}
void signIn(String email, String password, context) async {
try {
UserCredential userCredential =
await FirebaseAuth.instance.signInWithEmailAndPassword(
email: email,
password: password,
);
route(context);
} on FirebaseAuthException catch (e) {
if (e.code == 'user-not-found') {
AwesomeDialog(
context: context,
dialogType: DialogType.warning,
animType: AnimType.rightSlide,
title: 'Faild login',
desc: ' No user found for that email',
btnOkOnPress: () {},
)..show();
print('No user found for that email.');
} else if (e.code == 'wrong-password') {
AwesomeDialog(
context: context,
dialogType: DialogType.warning,
animType: AnimType.rightSlide,
title: 'Faild login',
desc: ' Wrong password',
btnOkOnPress: () {},
)..show();
print('Wrong password provided for that user.');
} else {
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
title: 'Error',
desc: e.message,
btnOkOnPress: () {},
)..show();
}
}
}
}
...@@ -4,7 +4,9 @@ import 'package:flutter/material.dart'; ...@@ -4,7 +4,9 @@ import 'package:flutter/material.dart';
import 'package:jema_app/teacherchat.dart'; import 'package:jema_app/teacherchat.dart';
import 'package:jema_app/classroomview.dart'; import 'package:jema_app/classroomview.dart';
import 'package:jema_app/addclassroom.dart'; import 'package:jema_app/addclassroom.dart';
import 'package:jema_app/teacherhome.dart';
import 'ChatScreen.dart';
import 'TeacherProfile.dart'; // Import the AddClassroomPage file import 'TeacherProfile.dart'; // Import the AddClassroomPage file
class ReportKidsPage extends StatelessWidget { class ReportKidsPage extends StatelessWidget {
...@@ -229,20 +231,26 @@ class ReportKidsPage extends StatelessWidget { ...@@ -229,20 +231,26 @@ class ReportKidsPage extends StatelessWidget {
onTap: (index) { onTap: (index) {
switch (index) { switch (index) {
case 0: case 0:
// Navigate to Home Navigator.push(
context,
MaterialPageRoute(builder: (context) => TeacherHomePage()),
);
break; break;
case 1: case 1:
// Navigate to Chat // Navigate to Chat
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => TeacherChatPage()), MaterialPageRoute(builder: (context) => ChatScreen()),
); );
break; break;
case 2: case 2:
// Navigate to Profile // Navigate to Profile
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => TeacherProfilePage()), MaterialPageRoute(
builder: (context) => TeacherProfilePage(
uid: user?.uid,
)),
); );
break; break;
} }
......
...@@ -3,23 +3,73 @@ import 'package:firebase_auth/firebase_auth.dart'; ...@@ -3,23 +3,73 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jema_app/login.dart'; import 'package:jema_app/login.dart';
import 'package:jema_app/teacherchat.dart'; import 'package:jema_app/teacherchat.dart';
import 'package:jema_app/classroomview.dart'; import 'package:jema_app/teacherhome.dart';
import 'package:jema_app/addclassroom.dart';
class TeacherProfilePage extends StatelessWidget { import 'ChatScreen.dart';
class TeacherProfilePage extends StatefulWidget {
final String? uid; // Make uid nullable
TeacherProfilePage({required this.uid, Key? key});
@override
_TeacherProfilePageState createState() => _TeacherProfilePageState(uid);
}
class _TeacherProfilePageState extends State<TeacherProfilePage> {
late User? user; late User? user;
late final Stream<QuerySnapshot> _usersStream; late final Stream<QuerySnapshot> _usersStream;
late String fullName = "";
late String email = "";
late String state = "";
late String capacity = "";
late String school = "";
late Map<String, dynamic> targetDoc;
final FirebaseAuth _auth = FirebaseAuth.instance; final FirebaseAuth _auth = FirebaseAuth.instance;
TeacherProfilePage() { late String uid;
_TeacherProfilePageState(uid) {
this.uid = uid;
}
@override
void initState() {
super.initState();
user = FirebaseAuth.instance.currentUser; user = FirebaseAuth.instance.currentUser;
initializeStreams(); initializeStreams();
getUserData();
} }
void initializeStreams() { void initializeStreams() {
_usersStream = FirebaseFirestore.instance print("Document does not exist " + uid);
.collection('classroom') FirebaseFirestore.instance
.where('userId', isEqualTo: user?.uid) .collection('users')
.snapshots(); .doc(
uid) // Assuming you want to get a specific document based on the user's UID
.get()
.then((DocumentSnapshot documentSnapshot) {
if (documentSnapshot.exists) {
// Access the data of the document
targetDoc = documentSnapshot.data() as Map<String, dynamic>? ?? {};
print("doc" + targetDoc.toString());
// Check if the document ID matches a specific value
setState(() {
// Process the document data
fullName = targetDoc['fullName'];
email = targetDoc['email'];
state = targetDoc['state'];
capacity = targetDoc['enrolmentCapacity'];
school = targetDoc['school'];
});
print(
"Full Name: $fullName, Email: $email, State: $state, Capacity: $capacity, School: $school");
} else {
print("Document does not exist");
}
}).catchError((error) {
print("Error getting document: $error");
});
} }
@override @override
...@@ -131,7 +181,7 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -131,7 +181,7 @@ class TeacherProfilePage extends StatelessWidget {
left: 0, left: 0,
top: 0, top: 0,
child: Text( child: Text(
'Name', 'Full Name',
style: TextStyle( style: TextStyle(
color: Color(0xFF797C7B), color: Color(0xFF797C7B),
fontSize: 14, fontSize: 14,
...@@ -145,7 +195,7 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -145,7 +195,7 @@ class TeacherProfilePage extends StatelessWidget {
left: 4, left: 4,
top: 24, top: 24,
child: Text( child: Text(
'Jhon Abraham', fullName,
style: TextStyle( style: TextStyle(
color: Color(0xFF000D07), color: Color(0xFF000D07),
fontSize: 18, fontSize: 18,
...@@ -185,7 +235,7 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -185,7 +235,7 @@ class TeacherProfilePage extends StatelessWidget {
left: 4, left: 4,
top: 24, top: 24,
child: Text( child: Text(
'jhonabraham20@gmail.com', email,
style: TextStyle( style: TextStyle(
color: Color(0xFF000D07), color: Color(0xFF000D07),
fontSize: 18, fontSize: 18,
...@@ -224,7 +274,7 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -224,7 +274,7 @@ class TeacherProfilePage extends StatelessWidget {
left: 4, left: 4,
top: 24, top: 24,
child: Text( child: Text(
'33 street west subidbazar,sylhet', state,
style: TextStyle( style: TextStyle(
color: Color(0xFF000D07), color: Color(0xFF000D07),
fontSize: 18, fontSize: 18,
...@@ -263,7 +313,7 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -263,7 +313,7 @@ class TeacherProfilePage extends StatelessWidget {
left: 4, left: 4,
top: 24, top: 24,
child: Text( child: Text(
'33 street west subidbazar,sylhet', capacity,
style: TextStyle( style: TextStyle(
color: Color(0xFF000D07), color: Color(0xFF000D07),
fontSize: 18, fontSize: 18,
...@@ -288,7 +338,7 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -288,7 +338,7 @@ class TeacherProfilePage extends StatelessWidget {
left: 0, left: 0,
top: 0, top: 0,
child: Text( child: Text(
'Country', 'School',
style: TextStyle( style: TextStyle(
color: Color(0xFF797C7B), color: Color(0xFF797C7B),
fontSize: 14, fontSize: 14,
...@@ -302,7 +352,7 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -302,7 +352,7 @@ class TeacherProfilePage extends StatelessWidget {
left: 4, left: 4,
top: 24, top: 24,
child: Text( child: Text(
'33 street west subidbazar,sylhet', school,
style: TextStyle( style: TextStyle(
color: Color(0xFF000D07), color: Color(0xFF000D07),
fontSize: 18, fontSize: 18,
...@@ -445,10 +495,23 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -445,10 +495,23 @@ class TeacherProfilePage extends StatelessWidget {
selectedItemColor: Colors.blue, selectedItemColor: Colors.blue,
onTap: (index) { onTap: (index) {
// Handle bottom navigation item tap // Handle bottom navigation item tap
if (index == 0) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => TeacherHomePage()),
);
}
if (index == 1) { if (index == 1) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => TeacherChatPage()), MaterialPageRoute(builder: (context) => ChatScreen()),
);
}
if (index == 2) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TeacherProfilePage(uid: user?.uid)),
); );
} }
}, },
...@@ -470,4 +533,35 @@ class TeacherProfilePage extends StatelessWidget { ...@@ -470,4 +533,35 @@ class TeacherProfilePage extends StatelessWidget {
print('Error signing out: $e'); print('Error signing out: $e');
} }
} }
// Define a function to fetch user data from Firestore
Future<void> getUserData() async {
FirebaseFirestore.instance
.collection('users')
.doc(user
?.uid) // Assuming you want to get a specific document based on the user's UID
.get()
.then((DocumentSnapshot documentSnapshot) {
if (documentSnapshot.exists) {
// Access the data of the document
targetDoc = documentSnapshot.data() as Map<String, dynamic>? ?? {};
// Check if the document ID matches a specific value
setState(() {
// Process the document data
fullName = targetDoc['fullName'];
String email = targetDoc['email'];
String state = targetDoc['state'];
String capacity = targetDoc['enrolmentCapacity'];
String school = targetDoc['school'];
});
print(
"Full Name: $fullName, Email: $email, State: $state, Capacity: $capacity, School: $school");
} else {
print("Document does not exist");
}
}).catchError((error) {
print("Error getting document: $error");
});
}
} }
...@@ -17,59 +17,77 @@ class _AddClassroomPageState extends State<AddClassroomPage> { ...@@ -17,59 +17,77 @@ class _AddClassroomPageState extends State<AddClassroomPage> {
final TextEditingController roomCapacityController = TextEditingController(); final TextEditingController roomCapacityController = TextEditingController();
final TextEditingController ratioController = TextEditingController(); final TextEditingController ratioController = TextEditingController();
final TextStyle poppinsTextStyle = TextStyle(
fontFamily: 'Poppins',
);
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Add Classroom'), title: Text('Add Classroom'),
), ),
body: Center( body: SingleChildScrollView(
child: Padding( child: Center(
padding: const EdgeInsets.all(16.0), child: Padding(
child: Column( padding: const EdgeInsets.all(16.0),
crossAxisAlignment: CrossAxisAlignment.center, child: Column(
mainAxisAlignment: MainAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
children: [ mainAxisAlignment: MainAxisAlignment.center,
Image.asset( children: [
'lib/assets/addclassroom.png', Image.asset(
height: 260, 'lib/assets/addclassroom.png',
width: 340, height: 260,
fit: BoxFit.contain, width: 340,
), fit: BoxFit.contain,
SizedBox(height: 20),
TextField(
controller: classNameController,
decoration: InputDecoration(
labelText: 'Classroom Name',
suffixIcon: Icon(Icons.school), // Classroom icon
), ),
), SizedBox(height: 20),
SizedBox(height: 10), TextFormField(
TextField( controller: classNameController,
controller: roomCapacityController, decoration: InputDecoration(
decoration: InputDecoration( labelText: 'Classroom Name',
labelText: 'Room Capacity', prefixIcon: Icon(Icons.school), // Classroom icon
suffixIcon: Icon(Icons.people), // People icon ),
), ),
keyboardType: TextInputType.number, SizedBox(height: 10),
), TextFormField(
SizedBox(height: 10), controller: roomCapacityController,
TextField( decoration: InputDecoration(
controller: ratioController, labelText: 'Room Capacity',
decoration: InputDecoration( prefixIcon: Icon(Icons.people), // People icon
labelText: 'Student to Staff Ratio', ),
suffixIcon: Icon(Icons.numbers), // Your ratio icon keyboardType: TextInputType.number,
), ),
keyboardType: TextInputType.number, SizedBox(height: 10),
), TextFormField(
SizedBox(height: 20), controller: ratioController,
ElevatedButton( decoration: InputDecoration(
onPressed: () { labelText: 'Student to Staff Ratio',
postDetailsToFirestore(context); prefixIcon: Icon(Icons.numbers), // Your ratio icon
}, ),
child: Text('Create Classroom'), keyboardType: TextInputType.number,
), ),
], SizedBox(height: 20),
Container(
height: 50.0,
width: 150.0,
decoration: BoxDecoration(
color: Color.fromARGB(203, 164, 88, 177),
borderRadius: BorderRadius.circular(4.0),
),
child: TextButton(
onPressed: () {
postDetailsToFirestore(context);
},
child: Text(
'Create Classroom',
style: poppinsTextStyle.copyWith(
color: Colors.white,
),
),
),
),
],
),
), ),
), ),
), ),
......
This diff is collapsed.
...@@ -3,14 +3,22 @@ import 'package:firebase_auth/firebase_auth.dart'; ...@@ -3,14 +3,22 @@ import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jema_app/teacherchat.dart'; import 'package:jema_app/teacherchat.dart';
import 'package:jema_app/classroomview.dart'; import 'package:jema_app/classroomview.dart';
import 'package:jema_app/addclassroom.dart'; import 'package:jema_app/addclassroom.dart';
import 'package:jema_app/teacherhome.dart';
import 'ChatScreen.dart';
import 'TeacherProfile.dart';
class ChildrenProfilePage extends StatelessWidget { class ChildrenProfilePage extends StatelessWidget {
late User? user; late User? user;
late final Stream<QuerySnapshot> _usersStream; late final Stream<QuerySnapshot> _usersStream;
ChildrenProfilePage() { int _age = 0;
late final userDetails;
ChildrenProfilePage(document) {
this.userDetails = document;
user = FirebaseAuth.instance.currentUser; user = FirebaseAuth.instance.currentUser;
initializeStreams(); initializeStreams();
calculateAge(userDetails['Birthday']);
} }
void initializeStreams() { void initializeStreams() {
...@@ -136,7 +144,7 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -136,7 +144,7 @@ class ChildrenProfilePage extends StatelessWidget {
CrossAxisAlignment.start, CrossAxisAlignment.start,
children: [ children: [
Text( Text(
'David Smith', userDetails['Firstname'],
style: TextStyle( style: TextStyle(
color: Color(0xFF11324D), color: Color(0xFF11324D),
fontSize: 20, fontSize: 20,
...@@ -163,7 +171,7 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -163,7 +171,7 @@ class ChildrenProfilePage extends StatelessWidget {
), ),
const SizedBox(height: 11), const SizedBox(height: 11),
Text( Text(
'Student', userDetails['role'],
style: TextStyle( style: TextStyle(
color: Color(0xFF21205B), color: Color(0xFF21205B),
fontSize: 14, fontSize: 14,
...@@ -206,7 +214,7 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -206,7 +214,7 @@ class ChildrenProfilePage extends StatelessWidget {
), ),
), ),
TextSpan( TextSpan(
text: '05', text: _age.toString(),
style: TextStyle( style: TextStyle(
color: Color(0xFF21205B), color: Color(0xFF21205B),
fontSize: 14, fontSize: 14,
...@@ -240,7 +248,7 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -240,7 +248,7 @@ class ChildrenProfilePage extends StatelessWidget {
), ),
), ),
TextSpan( TextSpan(
text: '12. 02. 2019', text: userDetails['Birthday'],
style: TextStyle( style: TextStyle(
color: Color(0xFF21205B), color: Color(0xFF21205B),
fontSize: 14, fontSize: 14,
...@@ -274,7 +282,7 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -274,7 +282,7 @@ class ChildrenProfilePage extends StatelessWidget {
), ),
), ),
TextSpan( TextSpan(
text: 'Male', text: userDetails['Sex'],
style: TextStyle( style: TextStyle(
color: Color(0xFF21205B), color: Color(0xFF21205B),
fontSize: 14, fontSize: 14,
...@@ -498,7 +506,7 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -498,7 +506,7 @@ class ChildrenProfilePage extends StatelessWidget {
], ],
), ),
))), ))),
Padding( /* Padding(
padding: const EdgeInsets.fromLTRB(8, 30, 0, 0), padding: const EdgeInsets.fromLTRB(8, 30, 0, 0),
child: SingleChildScrollView( child: SingleChildScrollView(
child: Container( child: Container(
...@@ -727,7 +735,7 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -727,7 +735,7 @@ class ChildrenProfilePage extends StatelessWidget {
), ),
), ),
), ),
) )**/
], ],
), ),
), ),
...@@ -749,10 +757,23 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -749,10 +757,23 @@ class ChildrenProfilePage extends StatelessWidget {
selectedItemColor: Colors.blue, selectedItemColor: Colors.blue,
onTap: (index) { onTap: (index) {
// Handle bottom navigation item tap // Handle bottom navigation item tap
if (index == 0) {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => TeacherHomePage()),
);
}
if (index == 1) { if (index == 1) {
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => TeacherChatPage()), MaterialPageRoute(builder: (context) => ChatScreen()),
);
}
if (index == 2) {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TeacherProfilePage(uid: user?.uid)),
); );
} }
}, },
...@@ -760,4 +781,22 @@ class ChildrenProfilePage extends StatelessWidget { ...@@ -760,4 +781,22 @@ class ChildrenProfilePage extends StatelessWidget {
), ),
); );
} }
void calculateAge(birthday) {
String birthdayText = birthday.trim();
if (birthdayText.isNotEmpty) {
try {
DateTime birthday = DateTime.parse(birthdayText);
DateTime now = DateTime.now();
Duration difference = now.difference(birthday);
_age = (difference.inDays / 365).floor();
} catch (e) {
print('Invalid date format: $e');
// Handle invalid date format
}
} else {
// Handle empty input
}
}
} }
This diff is collapsed.
...@@ -2,7 +2,9 @@ import 'package:awesome_dialog/awesome_dialog.dart'; ...@@ -2,7 +2,9 @@ import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:cloud_firestore/cloud_firestore.dart'; import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jema_app/parentHome.dart';
import 'package:jema_app/teacherhome.dart'; import 'package:jema_app/teacherhome.dart';
import 'package:shared_preferences/shared_preferences.dart';
class LoginPage extends StatefulWidget { class LoginPage extends StatefulWidget {
const LoginPage({Key? key, required this.backgroundColor}) : super(key: key); const LoginPage({Key? key, required this.backgroundColor}) : super(key: key);
...@@ -178,12 +180,24 @@ class _LoginPage extends State<LoginPage> { ...@@ -178,12 +180,24 @@ class _LoginPage extends State<LoginPage> {
print("login teacher"); print("login teacher");
} else { } else {
Navigator.pushReplacement( AwesomeDialog(
context, context: context,
MaterialPageRoute( dialogType: DialogType.info,
builder: (context) => TeacherHomePage(), animType: AnimType.rightSlide,
), title: ' login Perent',
); desc: ' Go to your home page',
btnCancelOnPress: () {},
btnOkOnPress: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
ParentHomePage(documentSnapshot.get('phoneNo')),
),
);
},
)..show();
print("login parent");
} }
} else { } else {
AwesomeDialog( AwesomeDialog(
......
...@@ -7,9 +7,11 @@ import 'firebase_options.dart'; ...@@ -7,9 +7,11 @@ import 'firebase_options.dart';
void main() async { void main() async {
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp( await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform, options: DefaultFirebaseOptions.currentPlatform,
); );
runApp(const MyApp()); runApp(const MyApp());
} }
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'ParentLogin.dart';
import 'login.dart'; import 'login.dart';
class ParentTeacherPage extends StatelessWidget { class ParentTeacherPage extends StatelessWidget {
const ParentTeacherPage({Key? key, required this.backgroundColor}) : super(key: key); const ParentTeacherPage({Key? key, required this.backgroundColor})
: super(key: key);
final Color backgroundColor; final Color backgroundColor;
...@@ -53,6 +55,14 @@ class ParentTeacherPage extends StatelessWidget { ...@@ -53,6 +55,14 @@ class ParentTeacherPage extends StatelessWidget {
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
// logic for navigating to the parent login page // logic for navigating to the parent login page
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ParentLoginPage(
backgroundColor: backgroundColor,
),
),
);
}, },
child: Container( child: Container(
width: 200, width: 200,
......
import 'package:flutter/material.dart';
import 'package:jema_app/parentSignUp.dart';
import 'package:jema_app/teachersignup.dart';
import 'ParentLogin.dart';
import 'login.dart';
class ParentTeacherSignUpPage extends StatelessWidget {
const ParentTeacherSignUpPage({Key? key, required this.backgroundColor})
: super(key: key);
final Color backgroundColor;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.transparent,
elevation: 0,
leading: IconButton(
icon: Icon(
Icons.arrow_back,
color: const Color.fromARGB(255, 0, 0, 0),
),
onPressed: () {
Navigator.pop(context);
},
),
),
body: Container(
color: backgroundColor,
child: SafeArea(
child: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Padding(
padding: const EdgeInsets.all(10.0),
child: Image.asset(
'lib/assets/p_or_t.png',
width: 280,
height: 450,
),
),
const SizedBox(height: 20),
Text(
'Which Best Describe You ?',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
color: Color.fromARGB(255, 105, 19, 145),
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// logic for navigating to the parent login page
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ParentSignupPage(),
),
);
},
child: Container(
width: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Color.fromARGB(220, 164, 68, 215),
),
child: Center(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
'Parent',
style: TextStyle(color: Colors.white),
),
),
),
),
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
elevation: 0,
),
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TeacherSignupPage(),
),
);
},
child: Container(
width: 200,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(10.0),
color: Color.fromARGB(220, 164, 68, 215),
),
child: Center(
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
'Teacher',
style: TextStyle(color: Colors.white),
),
),
),
),
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
elevation: 0,
),
),
],
),
),
),
),
),
);
}
}
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:jema_app/classroomview.dart';
import 'package:jema_app/addclassroom.dart';
import 'package:jema_app/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;
ParentHomePage(param0) {
this.phoneNo = param0;
user = FirebaseAuth.instance.currentUser;
initializeStreams();
}
void initializeStreams() {
_usersStream = FirebaseFirestore.instance
.collection('students')
.where('Parentphone', isEqualTo: phoneNo)
.snapshots();
}
// Define a TextStyle with the Poppins font
final TextStyle poppinsTextStyle = TextStyle(
fontFamily: 'Poppins',
);
@override
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
},
),
],
),
body: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(height: 20),
Text(
'Explore, learn, and play in our magical world of wonder!',
style: poppinsTextStyle.copyWith(
// fontWeight: FontWeight.bold,
fontSize: 13,
),
),
SizedBox(height: 10),
Expanded(
child: Image.asset(
'lib/assets/teacherhome.png',
fit: BoxFit.contain,
),
),
SizedBox(height: 20),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
onPressed: () {
// Navigate to the AddClassroomPage
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddClassroomPage()),
);
},
child: Row(
children: [],
),
),
],
),
Divider(),
SizedBox(height: 10),
Text(
'All Kids',
style: poppinsTextStyle.copyWith(
fontSize: 16,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 12),
Expanded(
child: StreamBuilder<QuerySnapshot>(
stream: _usersStream,
builder: (context, snapshot) {
print("--------------------------------------");
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator();
}
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
}
var itemcount = snapshot.data!.docs.length;
return ListView.builder(
itemCount: snapshot.data!.docs.length,
itemBuilder: (context, index) {
var document = snapshot.data!.docs[index];
var className = document['className'];
var name = document['Firstname'];
print(className);
return Padding(
padding: const EdgeInsets.only(
bottom: 8.0), // Adjust the spacing as needed
child: ListTile(
leading: CircleAvatar(
radius: 27.0,
backgroundImage:
AssetImage('lib/assets/classlogo.png'),
),
title: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Row(
children: [
Text(
'$name',
style: poppinsTextStyle.copyWith(
fontWeight: FontWeight.bold),
),
],
),
Row(
children: [
Text(
'$className',
style: poppinsTextStyle.copyWith(
fontSize: 12.0),
),
],
),
],
),
trailing: Container(
height: 35.0,
width: 80.0,
decoration: BoxDecoration(
color: Color.fromARGB(203, 164, 88, 177),
borderRadius: BorderRadius.circular(4.0),
),
child: TextButton(
onPressed: () {
print(document);
// Handle view class button press
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChildrenProfilePage(
document,
),
),
);
},
child: Text(
'View',
style: poppinsTextStyle.copyWith(
color: Colors.white,
),
),
),
),
),
);
},
);
},
),
),
],
),
),
bottomNavigationBar: BottomNavigationBar(
items: const [
BottomNavigationBarItem(
icon: Icon(Icons.home),
label: 'Home',
),
BottomNavigationBarItem(
icon: Icon(Icons.chat),
label: 'Chat',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
],
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()),
);
break;
case 2:
// Navigate to Profile
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TeacherProfilePage(
uid: user?.uid,
)),
);
break;
}
},
),
),
);
}
}
import 'package:awesome_dialog/awesome_dialog.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'login.dart';
class ParentSignupPage extends StatefulWidget {
const ParentSignupPage({Key? key}) : super(key: key);
@override
_ParentSignupPageState createState() => _ParentSignupPageState();
}
class _ParentSignupPageState extends State<ParentSignupPage> {
// TextEditingController for text input fields
final _formkey = GlobalKey<FormState>();
final _auth = FirebaseAuth.instance;
TextEditingController fullNameController = TextEditingController();
TextEditingController emailController = TextEditingController();
TextEditingController phoneNumberController = TextEditingController();
TextEditingController passwordController = TextEditingController();
// TextEditingController schoolNameController = TextEditingController();
// TextEditingController enrolmentCapacityController = TextEditingController();
// TextEditingController countryController = TextEditingController();
// TextEditingController stateRegionController = TextEditingController();
bool agreeTermsAndConditions = false;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Parent Signup'),
),
body: SingleChildScrollView(
child: Column(
children: [
Image.asset(
'lib/assets/tsignup1.png',
width: 240,
height: 270,
fit: BoxFit.cover,
),
Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
_buildTextInputWithIcon(
controller: fullNameController,
labelText: 'Full Name',
icon: Icons.person,
),
const SizedBox(height: 10),
_buildTextInputWithIcon(
controller: emailController,
labelText: 'Email',
icon: Icons.email,
),
const SizedBox(height: 10),
_buildTextInputWithIcon(
controller: phoneNumberController,
labelText: 'Phone Number',
icon: Icons.phone,
),
const SizedBox(height: 10),
_buildTextInputWithIcon(
controller: passwordController,
labelText: 'Password',
icon: Icons.lock,
obscureText: true,
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Logic to navigate to the next page with additional information
signUp(emailController.text, passwordController.text,
'parent', context);
},
child: Text('Finish'),
),
],
),
),
],
),
),
);
}
Widget _buildTextInputWithIcon({
required TextEditingController controller,
required String labelText,
required IconData icon,
bool obscureText = false,
}) {
return TextFormField(
controller: controller,
obscureText: obscureText,
decoration: InputDecoration(
labelText: labelText,
suffixIcon: Icon(icon),
filled: true,
fillColor: Colors.grey[200], // Light gray background color
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.transparent), // No border color when focused
borderRadius: BorderRadius.circular(10.0),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Colors.transparent), // No border color when not focused
borderRadius: BorderRadius.circular(10.0),
),
),
);
}
void signUp(String email, String password, String rool, context) async {
CircularProgressIndicator();
await _auth
.createUserWithEmailAndPassword(email: email, password: password)
.then((value) => {postDetailsToFirestore(email, rool, context)})
.catchError((e) {
AwesomeDialog(
context: context,
dialogType: DialogType.error,
animType: AnimType.rightSlide,
title: 'Error',
desc: ' error',
btnOkOnPress: () {},
)..show();
});
}
postDetailsToFirestore(String email, String rool, context) async {
FirebaseFirestore firebaseFirestore = FirebaseFirestore.instance;
var user = _auth.currentUser;
CollectionReference ref = FirebaseFirestore.instance.collection('users');
print("user!.uid == : " + emailController.text);
ref.doc(user!.uid).set({
"fullName": fullNameController.text,
'email': emailController.text,
'phoneNo': phoneNumberController.text,
"agreeTermsAndConditions": agreeTermsAndConditions,
'rool': rool
});
AwesomeDialog(
context: context,
dialogType: DialogType.success,
animType: AnimType.rightSlide,
title: 'Successfully Created',
desc: ' Go to Login page',
btnOkOnPress: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => LoginPage(
backgroundColor: Color.fromARGB(255, 0, 183, 255),
)));
},
)..show();
}
}
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:jema_app/p_or_t.dart'; import 'package:jema_app/p_or_t.dart';
import 'package:jema_app/parentSignUp.dart';
import 'package:jema_app/teachersignup.dart'; import 'package:jema_app/teachersignup.dart';
import 'p_or_t_s.dart';
class SignInUpPage extends StatelessWidget { class SignInUpPage extends StatelessWidget {
const SignInUpPage({Key? key, required this.backgroundColor}) const SignInUpPage({Key? key, required this.backgroundColor})
: super(key: key); : super(key: key);
...@@ -30,13 +33,16 @@ class SignInUpPage extends StatelessWidget { ...@@ -30,13 +33,16 @@ class SignInUpPage extends StatelessWidget {
), ),
), ),
const SizedBox(height: 20), const SizedBox(height: 20),
const SizedBox(height: 20),
ElevatedButton( ElevatedButton(
onPressed: () { onPressed: () {
// Navigate to the signup page (TeacherSignupPage) // Navigate to the signup page (TeacherSignupPage)
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => TeacherSignupPage(), builder: (context) => ParentTeacherSignUpPage(
backgroundColor: backgroundColor,
),
), ),
); );
}, },
......
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'ChatScreen.dart';
class TeacherChatPage extends StatefulWidget { class TeacherChatPage extends StatefulWidget {
@override @override
_TeacherChatPageState createState() => _TeacherChatPageState(); _TeacherChatPageState createState() => _TeacherChatPageState();
...@@ -12,7 +14,10 @@ class _TeacherChatPageState extends State<TeacherChatPage> { ...@@ -12,7 +14,10 @@ class _TeacherChatPageState extends State<TeacherChatPage> {
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text('Chat'), title: GestureDetector(
onTap: () => Navigator.push(
context, MaterialPageRoute(builder: (context) => ChatScreen())),
child: Text('Chat')),
), ),
body: ChatList(), body: ChatList(),
bottomNavigationBar: BottomNavigationBar( bottomNavigationBar: BottomNavigationBar(
......
...@@ -5,6 +5,7 @@ import 'package:jema_app/classroomview.dart'; ...@@ -5,6 +5,7 @@ import 'package:jema_app/classroomview.dart';
import 'package:jema_app/addclassroom.dart'; import 'package:jema_app/addclassroom.dart';
import 'package:jema_app/teacherchat.dart'; import 'package:jema_app/teacherchat.dart';
import 'ChatScreen.dart';
import 'TeacherProfile.dart'; import 'TeacherProfile.dart';
class TeacherHomePage extends StatelessWidget { class TeacherHomePage extends StatelessWidget {
...@@ -40,7 +41,7 @@ class TeacherHomePage extends StatelessWidget { ...@@ -40,7 +41,7 @@ class TeacherHomePage extends StatelessWidget {
child: Image.asset( child: Image.asset(
'lib/assets/logo.png', 'lib/assets/logo.png',
fit: BoxFit.contain, fit: BoxFit.contain,
height: 150, // Adjust the height to make the logo bigger height: 150, // Adjust the height to make the logo bigger
), ),
), ),
actions: [ actions: [
...@@ -81,7 +82,8 @@ class TeacherHomePage extends StatelessWidget { ...@@ -81,7 +82,8 @@ class TeacherHomePage extends StatelessWidget {
// Navigate to the AddClassroomPage // Navigate to the AddClassroomPage
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => AddClassroomPage()), MaterialPageRoute(
builder: (context) => AddClassroomPage()),
); );
}, },
child: Row( child: Row(
...@@ -94,8 +96,8 @@ class TeacherHomePage extends StatelessWidget { ...@@ -94,8 +96,8 @@ class TeacherHomePage extends StatelessWidget {
), ),
), ),
Container( Container(
margin: EdgeInsets.only(left: 8.0), margin: EdgeInsets.only(left: 8.0),
padding: EdgeInsets.all(8.0), padding: EdgeInsets.all(8.0),
decoration: BoxDecoration( decoration: BoxDecoration(
color: Color.fromARGB(203, 164, 88, 177), color: Color.fromARGB(203, 164, 88, 177),
borderRadius: BorderRadius.circular(8.0), borderRadius: BorderRadius.circular(8.0),
...@@ -141,11 +143,13 @@ class TeacherHomePage extends StatelessWidget { ...@@ -141,11 +143,13 @@ class TeacherHomePage extends StatelessWidget {
var className = document['className']; var className = document['className'];
return Padding( return Padding(
padding: const EdgeInsets.only(bottom: 8.0), // Adjust the spacing as needed padding: const EdgeInsets.only(
bottom: 8.0), // Adjust the spacing as needed
child: ListTile( child: ListTile(
leading: CircleAvatar( leading: CircleAvatar(
radius: 27.0, radius: 27.0,
backgroundImage: AssetImage('lib/assets/classlogo.png'), backgroundImage:
AssetImage('lib/assets/classlogo.png'),
), ),
title: Column( title: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -154,7 +158,8 @@ class TeacherHomePage extends StatelessWidget { ...@@ -154,7 +158,8 @@ class TeacherHomePage extends StatelessWidget {
children: [ children: [
Text( Text(
'$className', '$className',
style: poppinsTextStyle.copyWith(fontWeight: FontWeight.bold), style: poppinsTextStyle.copyWith(
fontWeight: FontWeight.bold),
), ),
], ],
), ),
...@@ -162,7 +167,8 @@ class TeacherHomePage extends StatelessWidget { ...@@ -162,7 +167,8 @@ class TeacherHomePage extends StatelessWidget {
children: [ children: [
Text( Text(
'Class $index', 'Class $index',
style: poppinsTextStyle.copyWith(fontSize: 12.0), style: poppinsTextStyle.copyWith(
fontSize: 12.0),
), ),
], ],
), ),
...@@ -232,14 +238,15 @@ class TeacherHomePage extends StatelessWidget { ...@@ -232,14 +238,15 @@ class TeacherHomePage extends StatelessWidget {
// Navigate to Chat // Navigate to Chat
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => TeacherChatPage()), MaterialPageRoute(builder: (context) => ChatScreen()),
); );
break; break;
case 2: case 2:
// Navigate to Profile // Navigate to Profile
Navigator.push( Navigator.push(
context, context,
MaterialPageRoute(builder: (context) => TeacherProfilePage()), MaterialPageRoute(
builder: (context) => TeacherProfilePage(uid: user?.uid)),
); );
break; break;
} }
......
...@@ -252,10 +252,10 @@ packages: ...@@ -252,10 +252,10 @@ packages:
dependency: "direct main" dependency: "direct main"
description: description:
name: image_picker name: image_picker
sha256: "26222b01a0c9a2c8fe02fc90b8208bd3325da5ed1f4a2acabf75939031ac0bdd" sha256: b6951e25b795d053a6ba03af5f710069c99349de9341af95155d52665cb4607c
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.7" version: "0.8.9"
image_picker_android: image_picker_android:
dependency: transitive dependency: transitive
description: description:
......
...@@ -35,11 +35,11 @@ dependencies: ...@@ -35,11 +35,11 @@ dependencies:
# The following adds the Cupertino Icons font to your application. # The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons. # Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2 cupertino_icons: ^1.0.2
image_picker: ^0.8.0
firebase_core: ^2.24.2 firebase_core: ^2.24.2
firebase_auth: ^4.15.3 firebase_auth: ^4.15.3
cloud_firestore: ^4.13.6 cloud_firestore: ^4.13.6
awesome_dialog: ^3.1.0 awesome_dialog: ^3.1.0
image_picker: ^1.0.6
dev_dependencies: dev_dependencies:
...@@ -82,7 +82,6 @@ flutter: ...@@ -82,7 +82,6 @@ flutter:
- lib/assets/Vector25.png - lib/assets/Vector25.png
- lib/assets/Vector26.png - lib/assets/Vector26.png
- lib/assets/Ellipse 8.png - lib/assets/Ellipse 8.png
- lib/assets/classlogo.png
......
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