Commit 264324d8 authored by Sandunika Senavirathna's avatar Sandunika Senavirathna

Merge branch 'IT20639280' into 'master'

update, bottom nav updated

See merge request !2
parents d4355dcc 21c8d902
No preview for this file type
// Flutter web plugin registrant file.
//
// Generated file. Do not edit.
//
// @dart = 2.13
// ignore_for_file: type=lint
import 'package:cloud_firestore_web/cloud_firestore_web.dart';
import 'package:firebase_auth_web/firebase_auth_web.dart';
import 'package:firebase_core_web/firebase_core_web.dart';
import 'package:firebase_storage_web/firebase_storage_web.dart';
import 'package:image_picker_for_web/image_picker_for_web.dart';
import 'package:rive_common/rive_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_web.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
void registerPlugins([final Registrar? pluginRegistrar]) {
final Registrar registrar = pluginRegistrar ?? webPluginRegistrar;
FirebaseFirestoreWeb.registerWith(registrar);
FirebaseAuthWeb.registerWith(registrar);
FirebaseCoreWeb.registerWith(registrar);
FirebaseStorageWeb.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
RivePlugin.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar);
registrar.registerMessageHandler();
}
This diff is collapsed.
This diff is collapsed.
3.10.1
\ No newline at end of file
# This is a generated file; do not edit or check into version control.
cloud_firestore=/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/
cloud_firestore_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore_web-3.8.10/
file_selector_linux=/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2+1/
file_selector_macos=/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.3+3/
file_selector_windows=/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+1/
firebase_auth=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/
firebase_auth_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth_web-5.8.12/
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_storage=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/
firebase_storage_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage_web-3.6.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_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_ios=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.9+1/
image_picker_linux=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/
image_picker_macos=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+1/
image_picker_windows=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/
path_provider=/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider-2.1.2/
path_provider_android=/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/
path_provider_foundation=/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/
path_provider_linux=/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/
path_provider_windows=/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/
rive_common=/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/
shared_preferences=/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences-2.2.2/
shared_preferences_android=/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.1/
shared_preferences_foundation=/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.5/
shared_preferences_linux=/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/
shared_preferences_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_web-2.2.1/
shared_preferences_windows=/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/
sqflite=/Users/avishkanew/.pub-cache/hosted/pub.dev/sqflite-2.3.2/
url_launcher=/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher-6.1.14/
url_launcher_android=/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.0/
url_launcher_ios=/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/
url_launcher_linux=/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.1/
url_launcher_macos=/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/
url_launcher_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.19/
url_launcher_windows=/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.1/
video_player=/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player-2.7.2/
video_player_android=/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_android-2.4.11/
video_player_avfoundation=/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.4.11/
video_player_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_web-2.0.17/
This diff is collapsed.
This contains all the project files of Student Monitoring system
\ No newline at end of file
# mobile_application_kids
A new Flutter project.
## Getting Started
This project is a starting point for a Flutter application.
A few resources to get you started if this is your first Flutter project:
- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
......@@ -13,8 +13,7 @@ linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at
# https://dart-lang.github.io/linter/lints/index.html.
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
......
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="FacetManager">
<facet type="android" name="Android">
<configuration>
<option name="ALLOW_USER_CONFIGURATION" value="false" />
<option name="GEN_FOLDER_RELATIVE_PATH_APT" value="/gen" />
<option name="GEN_FOLDER_RELATIVE_PATH_AIDL" value="/gen" />
<option name="MANIFEST_FILE_RELATIVE_PATH" value="/app/src/main/AndroidManifest.xml" />
<option name="RES_FOLDER_RELATIVE_PATH" value="/app/src/main/res" />
<option name="ASSETS_FOLDER_RELATIVE_PATH" value="/app/src/main/assets" />
<option name="LIBS_FOLDER_RELATIVE_PATH" value="/app/src/main/libs" />
<option name="PROGUARD_LOGS_FOLDER_RELATIVE_PATH" value="/app/src/main/proguard_logs" />
</configuration>
</facet>
</component>
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/app/src/main/java" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/app/src/main/kotlin" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/gen" isTestSource="false" generated="true" />
</content>
<orderEntry type="jdk" jdkName="Android API 29 Platform" jdkType="Android SDK" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="Flutter for Android" level="project" />
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
</component>
</module>
......@@ -768,6 +768,8 @@ PODS:
- gRPC-Core/Interface (= 1.49.1)
- gRPC-Core/Interface (1.49.1)
- GTMSessionFetcher/Core (3.2.0)
- image_picker_ios (0.0.1):
- Flutter
- leveldb-library (1.22.2)
- nanopb (2.30909.1):
- nanopb/decode (= 2.30909.1)
......@@ -784,6 +786,7 @@ DEPENDENCIES:
- firebase_auth (from `.symlinks/plugins/firebase_auth/ios`)
- firebase_core (from `.symlinks/plugins/firebase_core/ios`)
- Flutter (from `Flutter`)
- image_picker_ios (from `.symlinks/plugins/image_picker_ios/ios`)
- rive_common (from `.symlinks/plugins/rive_common/ios`)
SPEC REPOS:
......@@ -817,6 +820,8 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/firebase_core/ios"
Flutter:
:path: Flutter
image_picker_ios:
:path: ".symlinks/plugins/image_picker_ios/ios"
rive_common:
:path: ".symlinks/plugins/rive_common/ios"
......@@ -840,6 +845,7 @@ SPEC CHECKSUMS:
"gRPC-C++": 2df8cba576898bdacd29f0266d5236fa0e26ba6a
gRPC-Core: a21a60aefc08c68c247b439a9ef97174b0c54f96
GTMSessionFetcher: 41b9ef0b4c08a6db4b7eb51a21ae5183ec99a2c8
image_picker_ios: 4a8aadfbb6dc30ad5141a2ce3832af9214a705b5
leveldb-library: f03246171cce0484482ec291f88b6d563699ee06
nanopb: d4d75c12cd1316f4a64e3c6963f879ecd4b5e0d5
PromisesObjC: c50d2056b5253dadbd6c2bea79b0674bd5a52fa4
......
This diff is collapsed.
No preview for this file type
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'package:video_player/video_player.dart';
class UserActivitiesScreen extends StatelessWidget {
final String userId;
UserActivitiesScreen({required this.userId});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('User Activities'),
),
body: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance
.collection('activities')
.where('user', isEqualTo: userId)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator(); // Loading indicator
}
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}'); // Error handling
}
if (snapshot.data == null || snapshot.data!.docs.isEmpty) {
return Center(
child: Text('No activities found for this user.'),
); // No activities found
}
return ListView(
children: snapshot.data!.docs.map((document) {
final videoUrl = document['videoUrl'];
final imageUrl = document['imageUrl'];
if (videoUrl != null) {
return _buildVideoItem(videoUrl);
} else if (imageUrl != null) {
return _buildImageItem(imageUrl);
} else {
return SizedBox(); // Return an empty widget if neither video nor image URL is available
}
}).toList(),
);
},
),
);
}
Widget _buildVideoItem(String videoUrl) {
return ListTile(
title: Text('Activity Video'),
leading: FutureBuilder(
future: VideoPlayerController.network(videoUrl).initialize(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return CircularProgressIndicator(); // Placeholder while video loads
}
if (snapshot.hasError) {
return Text('Error: ${snapshot.error}');
}
if (snapshot.connectionState == ConnectionState.done) {
try {
final controller = VideoPlayerController.network(videoUrl);
return AspectRatio(
aspectRatio: controller.value.aspectRatio,
child: VideoPlayer(controller),
);
} catch (e) {
return Text('Error playing video: $e');
}
} else {
return SizedBox(); // Return empty widget if still loading
}
},
),
onTap: () {
// Handle tap, e.g., navigate to a detail screen
},
);
}
Widget _buildImageItem(String imageUrl) {
return ListTile(
title: Text('Activity Image'),
leading: CachedNetworkImage(
imageUrl: imageUrl,
placeholder: (context, url) =>
CircularProgressIndicator(), // Placeholder while image loads
errorWidget: (context, url, error) => Icon(Icons.error),
),
onTap: () {
// Handle tap, e.g., navigate to a detail screen
},
);
}
}
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;
String? _username;
@override
void initState() {
super.initState();
_user = _auth.currentUser;
fetchFullName(_user!.uid).then((fullName) {
if (fullName != null) {
_username = fullName;
} else {
print('No such document');
}
});
}
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!));
}
CollectionReference ref =
FirebaseFirestore.instance.collection('users');
DocumentSnapshot snapshot = await ref.doc(_user!.uid).get();
if (snapshot.exists) {
_username = (snapshot.data() as Map<String, dynamic>)['fullName'];
} else {
return null;
}
await _firestore.collection('messages').add({
'text': message,
'createdAt': Timestamp.now(),
'user': _user!.uid,
'imageUrl': imageUrl,
'voiceUrl': voiceUrl,
'userName': _username
});
_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?;
String? __username = (message.data()
as Map<String, dynamic>)['userName'] as String?;
return MessageBubble(
message: text ?? '',
imageUrl: imageUrl,
voiceUrl: voiceUrl,
isCurrentUser: isCurrentUser,
userName: __username!);
},
);
},
),
),
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,
),
],
),
),
],
),
);
}
Future<String?> getFullNameByUid(String uid) async {
CollectionReference ref = FirebaseFirestore.instance.collection('users');
DocumentSnapshot snapshot = await ref.doc(uid).get();
if (snapshot.exists) {
return (snapshot.data() as Map<String, dynamic>)['fullName'];
} else {
return null;
}
}
Future<String?> fetchFullName(String uid) async {
String? fullName = await getFullNameByUid(_user!.uid);
return fullName;
}
}
class MessageBubble extends StatelessWidget {
final String message;
final String? imageUrl;
final String? voiceUrl;
final bool isCurrentUser;
final String userName;
const MessageBubble({
Key? key,
required this.message,
required this.isCurrentUser,
this.imageUrl,
this.voiceUrl,
required this.userName,
}) : 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),
Text(
userName,
style: TextStyle(
color: Color.fromARGB(255, 248, 4, 4),
fontSize: 8,
),
)
],
),
),
),
);
}
}
This diff is collapsed.
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:mobile_application_kids/Attendance.dart';
import 'package:mobile_application_kids/ChildrenVideo.dart';
import 'package:mobile_application_kids/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) {
double width = MediaQuery.of(context).size.width;
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: EdgeInsets.fromLTRB(width * 0.1, 20, width * 0.1, 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( classroom: ),
// ));
},
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');
}
}
}
This diff is collapsed.
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:mobile_application_kids/parentHome.dart';
import 'package:mobile_application_kids/teacherhome.dart';
import 'main.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.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => MyHomePage(
title: '',
backgroundColor: Color.fromARGB(255, 181, 181, 181),
),
),
);
},
),
),
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',
btnOkOnPress: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
ParentHomePage(documentSnapshot.get('phoneNo'), "p"),
),
);
},
)..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();
}
}
}
}
This diff is collapsed.
This diff is collapsed.
......@@ -5,7 +5,7 @@ class ActivitiesPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Activities'),
title: Text('Activities '),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
......@@ -162,7 +162,8 @@ class CameraScreen extends StatelessWidget {
// Implement your camera screen UI here
return Scaffold(
appBar: AppBar(
title: Text(cameraType == CameraType.photo ? 'Take Photo' : 'Record Video'),
title: Text(
cameraType == CameraType.photo ? 'Take Photo' : 'Record Video'),
),
body: Center(
child: Text('Camera Screen Placeholder'),
......
......@@ -2,7 +2,7 @@ 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/teacherhome.dart';
import 'package:mobile_application_kids/teacherhome.dart';
class AddClassroomPage extends StatefulWidget {
@override
......@@ -17,59 +17,77 @@ class _AddClassroomPageState extends State<AddClassroomPage> {
final TextEditingController roomCapacityController = TextEditingController();
final TextEditingController ratioController = TextEditingController();
final TextStyle poppinsTextStyle = TextStyle(
fontFamily: 'Poppins',
);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Add Classroom'),
title: Text('Add Classroom '),
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'lib/assets/addclassroom.png',
height: 260,
width: 340,
fit: BoxFit.contain,
),
SizedBox(height: 20),
TextField(
controller: classNameController,
decoration: InputDecoration(
labelText: 'Classroom Name',
suffixIcon: Icon(Icons.school), // Classroom icon
body: SingleChildScrollView(
child: Center(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Image.asset(
'lib/assets/addclassroom.png',
height: 260,
width: 340,
fit: BoxFit.contain,
),
),
SizedBox(height: 10),
TextField(
controller: roomCapacityController,
decoration: InputDecoration(
labelText: 'Room Capacity',
suffixIcon: Icon(Icons.people), // People icon
SizedBox(height: 20),
TextFormField(
controller: classNameController,
decoration: InputDecoration(
labelText: 'Classroom Name',
prefixIcon: Icon(Icons.school), // Classroom icon
),
),
keyboardType: TextInputType.number,
),
SizedBox(height: 10),
TextField(
controller: ratioController,
decoration: InputDecoration(
labelText: 'Student to Staff Ratio',
suffixIcon: Icon(Icons.numbers), // Your ratio icon
SizedBox(height: 10),
TextFormField(
controller: roomCapacityController,
decoration: InputDecoration(
labelText: 'Room Capacity',
prefixIcon: Icon(Icons.people), // People icon
),
keyboardType: TextInputType.number,
),
keyboardType: TextInputType.number,
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
postDetailsToFirestore(context);
},
child: Text('Create Classroom'),
),
],
SizedBox(height: 10),
TextFormField(
controller: ratioController,
decoration: InputDecoration(
labelText: 'Student to Staff Ratio',
prefixIcon: Icon(Icons.numbers), // Your ratio icon
),
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.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,7 +3,7 @@ import 'package:flutter/material.dart';
class KidsReportsPage extends StatelessWidget {
final List<KidData> kidsData = [
KidData(name: 'Adam', imageUrl: "lib/assets/Ellipse 8.png"),
KidData(name: 'Jude', imageUrl: "lib/assets/Ellipse 8.png"),
KidData(name: 'Jude', imageUrl: "lib/assets/Ellipse 8.png"),
KidData(name: 'Anne', imageUrl: 'url_to_kid3_image'),
KidData(name: 'Adam', imageUrl: 'url_to_kid3_image'),
KidData(name: 'Jeny', imageUrl: 'url_to_kid3_image'),
......@@ -15,7 +15,7 @@ class KidsReportsPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Reports'),
title: Text('Reports '),
),
body: Padding(
padding: const EdgeInsets.all(16.0),
......
......@@ -2,7 +2,11 @@ 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/teacherhome.dart';
import 'package:mobile_application_kids/parentHome.dart';
import 'package:mobile_application_kids/teacherhome.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'main.dart';
class LoginPage extends StatefulWidget {
const LoginPage({Key? key, required this.backgroundColor}) : super(key: key);
......@@ -29,7 +33,15 @@ class _LoginPage extends State<LoginPage> {
color: Color.fromARGB(255, 0, 0, 0),
),
onPressed: () {
Navigator.pop(context);
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => MyHomePage(
title: '',
backgroundColor: Color.fromARGB(255, 181, 181, 181),
),
),
);
},
),
),
......@@ -165,7 +177,6 @@ class _LoginPage extends State<LoginPage> {
animType: AnimType.rightSlide,
title: 'Successfully login',
desc: ' Go to your home page',
btnCancelOnPress: () {},
btnOkOnPress: () {
Navigator.pushReplacement(
context,
......@@ -178,12 +189,24 @@ class _LoginPage extends State<LoginPage> {
print("login teacher");
} else {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => TeacherHomePage(),
),
);
AwesomeDialog(
context: context,
dialogType: DialogType.info,
animType: AnimType.rightSlide,
title: ' login Perent',
desc: ' Go to your home page',
btnCancelOnPress: () {},
btnOkOnPress: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) =>
ParentHomePage(documentSnapshot.get('phoneNo'), "p"),
),
);
},
)..show();
print("login parent");
}
} else {
AwesomeDialog(
......
import 'dart:async';
import 'package:firebase_core/firebase_core.dart';
import 'package:flutter/material.dart';
import 'package:jema_app/sign_in_up.dart';
import 'package:mobile_application_kids/sign_in_up.dart';
import 'firebase_options.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
runApp(const MyApp());
}
......
import 'package:flutter/material.dart';
import 'ParentLogin.dart';
import 'login.dart';
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;
......@@ -53,6 +55,14 @@ class ParentTeacherPage extends StatelessWidget {
ElevatedButton(
onPressed: () {
// logic for navigating to the parent login page
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ParentLoginPage(
backgroundColor: backgroundColor,
),
),
);
},
child: Container(
width: 200,
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:jema_app/p_or_t.dart';
import 'package:jema_app/teachersignup.dart';
import 'package:mobile_application_kids/p_or_t.dart';
import 'package:mobile_application_kids/parentSignUp.dart';
import 'package:mobile_application_kids/teachersignup.dart';
import 'p_or_t_s.dart';
class SignInUpPage extends StatelessWidget {
const SignInUpPage({Key? key, required this.backgroundColor})
......@@ -30,13 +33,16 @@ class SignInUpPage extends StatelessWidget {
),
),
const SizedBox(height: 20),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Navigate to the signup page (TeacherSignupPage)
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TeacherSignupPage(),
builder: (context) => ParentTeacherSignUpPage(
backgroundColor: backgroundColor,
),
),
);
},
......
This diff is collapsed.
This diff is collapsed.
......@@ -209,7 +209,6 @@ class AdditionalInfoPage extends StatelessWidget {
ElevatedButton(
onPressed: () {
// Logic to finish the teacher registration
// You can add your own logic here
signUp(emailController.text, passwordController.text, rool,
context);
},
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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