Commit bdffde06 authored by Sandunika Senavirathna's avatar Sandunika Senavirathna

Merge branch 'IT20639280' into 'master'

It20639280

See merge request !6
parents 8ece126f 977c086c
......@@ -11,10 +11,12 @@ 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:package_info_plus/src/package_info_plus_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:wakelock_plus/src/wakelock_plus_web_plugin.dart';
import 'package:flutter_web_plugins/flutter_web_plugins.dart';
void registerPlugins([final Registrar? pluginRegistrar]) {
......@@ -24,9 +26,11 @@ void registerPlugins([final Registrar? pluginRegistrar]) {
FirebaseCoreWeb.registerWith(registrar);
FirebaseStorageWeb.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar);
PackageInfoPlusWebPlugin.registerWith(registrar);
RivePlugin.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar);
WakelockPlusWebPlugin.registerWith(registrar);
registrar.registerMessageHandler();
}
......@@ -7,6 +7,12 @@
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "args",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/args-2.4.2",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "async",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/async-2.11.0",
......@@ -43,6 +49,12 @@
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "carousel_slider",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/carousel_slider-4.2.1",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "characters",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/characters-1.3.0",
......@@ -61,6 +73,12 @@
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "chewie",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/chewie-1.7.5",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "clock",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/clock-1.1.1",
......@@ -91,6 +109,12 @@
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "confetti",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/confetti-0.7.0",
"packageUri": "lib/",
"languageVersion": "2.17"
},
{
"name": "cross_file",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cross_file-0.3.3+7",
......@@ -115,6 +139,12 @@
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "dbus",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/dbus-0.7.10",
"packageUri": "lib/",
"languageVersion": "2.17"
},
{
"name": "fake_async",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/fake_async-1.3.1",
......@@ -367,12 +397,30 @@
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "nested",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/nested-1.0.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "octo_image",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/octo_image-2.0.0",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "package_info_plus",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "package_info_plus_platform_interface",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus_platform_interface-2.0.1",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "path",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path-1.8.3",
......@@ -415,6 +463,12 @@
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "petitparser",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/petitparser-5.4.0",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "pie_chart",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/pie_chart-5.4.0",
......@@ -433,6 +487,12 @@
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "provider",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/provider-6.1.2",
"packageUri": "lib/",
"languageVersion": "2.12"
},
{
"name": "rive",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/rive-0.11.17",
......@@ -667,6 +727,18 @@
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "wakelock_plus",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "wakelock_plus_platform_interface",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus_platform_interface-1.1.0",
"packageUri": "lib/",
"languageVersion": "2.18"
},
{
"name": "win32",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/win32-5.0.9",
......@@ -679,6 +751,12 @@
"packageUri": "lib/",
"languageVersion": "3.0"
},
{
"name": "xml",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/xml-6.3.0",
"packageUri": "lib/",
"languageVersion": "2.19"
},
{
"name": "mobile_application_kids",
"rootUri": "../",
......@@ -686,7 +764,7 @@
"languageVersion": "3.0"
}
],
"generated": "2024-03-18T12:13:20.503381Z",
"generated": "2024-03-18T22:34:44.866484Z",
"generator": "pub",
"generatorVersion": "3.0.1"
}
......@@ -18,6 +18,10 @@ _flutterfire_internals
2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/_flutterfire_internals-1.3.16/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/_flutterfire_internals-1.3.16/lib/
args
2.19
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/args-2.4.2/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/args-2.4.2/lib/
async
2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/async-2.11.0/
......@@ -42,6 +46,10 @@ cached_network_image_web
3.0
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cached_network_image_web-1.1.1/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cached_network_image_web-1.1.1/lib/
carousel_slider
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/carousel_slider-4.2.1/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/carousel_slider-4.2.1/lib/
characters
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/characters-1.3.0/
......@@ -54,6 +62,10 @@ charts_flutter
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/charts_flutter-0.12.0/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/charts_flutter-0.12.0/lib/
chewie
2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/chewie-1.7.5/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/chewie-1.7.5/lib/
clock
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/clock-1.1.1/
......@@ -74,6 +86,10 @@ collection
2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/collection-1.17.1/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/collection-1.17.1/lib/
confetti
2.17
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/confetti-0.7.0/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/confetti-0.7.0/lib/
cross_file
3.0
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cross_file-0.3.3+7/
......@@ -90,6 +106,10 @@ cupertino_icons
2.19
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.6/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.6/lib/
dbus
2.17
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/dbus-0.7.10/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/dbus-0.7.10/lib/
fake_async
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/fake_async-1.3.1/
......@@ -246,10 +266,22 @@ mime
2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/mime-1.0.4/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/mime-1.0.4/lib/
nested
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/nested-1.0.0/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/nested-1.0.0/lib/
octo_image
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/octo_image-2.0.0/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/octo_image-2.0.0/lib/
package_info_plus
2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/lib/
package_info_plus_platform_interface
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus_platform_interface-2.0.1/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus_platform_interface-2.0.1/lib/
path
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path-1.8.3/
......@@ -278,6 +310,10 @@ path_provider_windows
2.19
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/lib/
petitparser
2.19
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/petitparser-5.4.0/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/petitparser-5.4.0/lib/
pie_chart
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/pie_chart-5.4.0/
......@@ -290,6 +326,10 @@ plugin_platform_interface
3.0
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.7/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.7/lib/
provider
2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/provider-6.1.2/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/provider-6.1.2/lib/
rive
2.14
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/rive-0.11.17/
......@@ -442,6 +482,14 @@ video_player_web
2.19
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_web-2.0.17/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_web-2.0.17/lib/
wakelock_plus
2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/lib/
wakelock_plus_platform_interface
2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus_platform_interface-1.1.0/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus_platform_interface-1.1.0/lib/
win32
3.0
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/win32-5.0.9/
......@@ -450,6 +498,10 @@ xdg_directories
3.0
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/xdg_directories-1.0.4/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/xdg_directories-1.0.4/lib/
xml
2.19
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/xml-6.3.0/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/xml-6.3.0/lib/
mobile_application_kids
3.0
file:///Users/avishkanew/Documents/Jema678/monitoring-and-recommendations-for-early-childhood-development/
......
......@@ -18,6 +18,7 @@ image_picker_ios=/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_ios-0.
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/
package_info_plus=/Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/
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/
......@@ -42,3 +43,4 @@ 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/
wakelock_plus=/Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/
This diff is collapsed.
// 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
// },
// );
// }
// }
\ No newline at end of file
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;
......@@ -12,90 +11,154 @@ class UserActivitiesScreen extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('User Activities'),
title: Text(' '),
actions: [
Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 16),
child: Text(
'Activities',
style: TextStyle(
color: Color(0xFF554994),
fontSize: 24,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
height: 0.04,
letterSpacing: -0.96,
),
),
),
],
),
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
}
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance
.collection('activities')
.where('user', isEqualTo: userId)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child:
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'];
final imageDocs = snapshot.data!.docs
.where((doc) => doc['imageUrl'] != null)
.toList();
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(),
);
},
return ImageWall(
imageDocs: imageDocs,
);
},
),
),
);
}
}
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
class ImageWall extends StatelessWidget {
final List<DocumentSnapshot> imageDocs;
ImageWall({required this.imageDocs});
@override
Widget build(BuildContext context) {
// Sort the imageDocs based on timestamp in descending order
imageDocs.sort((a, b) => b['timestamp'].compareTo(a['timestamp']));
return ListView.separated(
itemCount: imageDocs.length,
itemBuilder: (context, index) {
final imageUrl = imageDocs[index]['imageUrl'];
final timestamp = imageDocs[index]['timestamp'];
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: ImageItem(
imageUrl: imageUrl,
timestamp: timestamp,
),
);
},
separatorBuilder: (context, index) => SizedBox(height: 16.0),
);
}
}
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
},
class ImageItem extends StatelessWidget {
final String imageUrl;
final Timestamp timestamp;
final double imageHeight = 200.0;
ImageItem({required this.imageUrl, required this.timestamp});
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
height: imageHeight,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.0), // Rounded corners
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 2), // Drop shadow
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(16.0), // Clip rounded corners
child: CachedNetworkImage(
imageUrl: imageUrl,
fit: BoxFit.cover,
placeholder: (context, url) => Center(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) => Icon(Icons.error),
),
),
),
Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.7), // Semi-transparent background
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(16.0), // Round only bottom corners
bottomRight: Radius.circular(16.0),
),
),
child: Row(
children: [
Expanded(
child: Text(
'Uploaded: ${timestamp.toDate()}',
style: TextStyle(color: Colors.white),
),
),
IconButton(
icon: Icon(Icons.date_range),
color: Colors.white,
onPressed: () {
},
),
],
),
),
],
);
}
}
\ No newline at end of file
}
import 'package:flutter/material.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:cached_network_image/cached_network_image.dart';
class pUserActivitiesScreen extends StatelessWidget {
final String pUser;
pUserActivitiesScreen({required this.pUser});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(' '),
actions: [
Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 16),
child: Text(
'Activities',
style: TextStyle(
color: Color(0xFF554994),
fontSize: 24,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
height: 0.04,
letterSpacing: -0.96,
),
),
),
],
),
body: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: StreamBuilder<QuerySnapshot>(
stream: FirebaseFirestore.instance
.collection('activities')
// .where('pUser', isEqualTo: pUser)
.snapshots(),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.waiting) {
return Center(
child:
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
}
final imageDocs = snapshot.data!.docs
.where((doc) => doc['imageUrl'] != null)
.toList();
return ImageWall(
imageDocs: imageDocs,
);
},
),
),
);
}
}
class ImageWall extends StatelessWidget {
final List<DocumentSnapshot> imageDocs;
ImageWall({required this.imageDocs});
@override
Widget build(BuildContext context) {
// Sort the imageDocs based on timestamp in descending order
imageDocs.sort((a, b) => b['timestamp'].compareTo(a['timestamp']));
return ListView.separated(
itemCount: imageDocs.length,
itemBuilder: (context, index) {
final imageUrl = imageDocs[index]['imageUrl'];
final timestamp = imageDocs[index]['timestamp'];
return Padding(
padding: const EdgeInsets.symmetric(vertical: 8.0),
child: ImageItem(
imageUrl: imageUrl,
timestamp: timestamp,
),
);
},
separatorBuilder: (context, index) => SizedBox(height: 16.0),
);
}
}
class ImageItem extends StatelessWidget {
final String imageUrl;
final Timestamp timestamp;
final double imageHeight = 200.0;
ImageItem({required this.imageUrl, required this.timestamp});
@override
Widget build(BuildContext context) {
return Column(
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Container(
height: imageHeight,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(16.0), // Rounded corners
boxShadow: [
BoxShadow(
color: Colors.grey.withOpacity(0.5),
spreadRadius: 2,
blurRadius: 5,
offset: Offset(0, 2), // Drop shadow
),
],
),
child: ClipRRect(
borderRadius: BorderRadius.circular(16.0), // Clip rounded corners
child: CachedNetworkImage(
imageUrl: imageUrl,
fit: BoxFit.cover,
placeholder: (context, url) => Center(
child: CircularProgressIndicator(),
),
errorWidget: (context, url, error) => Icon(Icons.error),
),
),
),
Container(
padding: EdgeInsets.all(8.0),
decoration: BoxDecoration(
color: Colors.black.withOpacity(0.7), // Semi-transparent background
borderRadius: BorderRadius.only(
bottomLeft: Radius.circular(16.0), // Round only bottom corners
bottomRight: Radius.circular(16.0),
),
),
child: Row(
children: [
Expanded(
child: Text(
'Uploaded: ${timestamp.toDate()}',
style: TextStyle(color: Colors.white),
),
),
IconButton(
icon: Icon(Icons.date_range),
color: Colors.white,
onPressed: () {
// Implement your comment functionality here
// You can navigate to a comment screen or show a dialog
// to add comments for the current image.
},
),
],
),
),
],
);
}
}
This diff is collapsed.
......@@ -273,11 +273,13 @@ class ChildrenActivity extends StatelessWidget {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChildrenActiPhone(image: imagePath)),
builder: (context) => ChildrenActiPhone(
image: imagePath,
// userId: user?.uid, // Pass the user ID to the next screen
),
),
);
// 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');
......@@ -289,15 +291,17 @@ class ChildrenActivity extends StatelessWidget {
final pickedFile = await picker.pickVideo(source: ImageSource.camera);
if (pickedFile != null) {
String imagePath = pickedFile.path;
String videoPath = pickedFile.path;
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ChildrenVideo(video: imagePath)),
builder: (context) => ChildrenVideo(
video: videoPath,
// userId: user?.uid, // Pass the user ID to the next screen
),
),
);
// 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 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/ActivitiesView_parent.dart';
import 'package:mobile_application_kids/progressReport.dart';
import 'package:mobile_application_kids/teacherchat.dart';
import 'package:mobile_application_kids/classroomview.dart';
......@@ -19,7 +20,7 @@ class pChildrenProfilePage extends StatelessWidget {
int _age = 10;
String role = '';
late final userDetails;
pChildrenProfilePage(document, role) {
pChildrenProfilePage(document, role, {required String pUser}) {
print(role);
this.role = role;
this.userDetails = document;
......@@ -477,8 +478,8 @@ class pChildrenProfilePage extends StatelessWidget {
context,
MaterialPageRoute(
builder: (context) =>
UserActivitiesScreen(
userId: user!.uid)),
pUserActivitiesScreen(pUser: user!.uid)
)
);
},
child: Container(
......@@ -738,7 +739,7 @@ class pChildrenProfilePage extends StatelessWidget {
TextSpan(
children: [
TextSpan(
text: 'Monthly \npsycholo. report \n ',
text: 'Monthly progress report \n',
style: TextStyle(
color:
Color(0xFF403572),
......@@ -760,7 +761,7 @@ class pChildrenProfilePage extends StatelessWidget {
child: Opacity(
opacity: 0.70,
child: Text(
'Some short description of this type of report.',
"Progress of kid's learning and behavior",
style: TextStyle(
color: Color(0xFF8DAEAE),
fontSize: 9.55,
......@@ -847,7 +848,7 @@ class pChildrenProfilePage extends StatelessWidget {
TextSpan(
children: [
TextSpan(
text: 'Monthly prediction report \n',
text: 'Monthly \nPsychology Report \n',
style: TextStyle(
color:
Color(0xFF479696),
......@@ -868,7 +869,7 @@ class pChildrenProfilePage extends StatelessWidget {
child: Opacity(
opacity: 0.70,
child: Text(
'Some short description of this type of report.',
'Monthly insights of activity reports',
style: TextStyle(
color: Color(0xFF8DAEAE),
fontSize: 9.55,
......
......@@ -5,6 +5,8 @@ import 'package:firebase_storage/firebase_storage.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'dart:io';
import 'package:intl/intl.dart';
class AddStudentPage extends StatefulWidget {
const AddStudentPage({required this.classname});
......@@ -17,6 +19,7 @@ class AddStudentPage extends StatefulWidget {
class _AddStudentState extends State<AddStudentPage> {
final _formkey = GlobalKey<FormState>();
final _auth = FirebaseAuth.instance;
//Bio Part
TextEditingController _firstnameController = TextEditingController();
TextEditingController _lastnameController = TextEditingController();
......@@ -50,6 +53,9 @@ class _AddStudentState extends State<AddStudentPage> {
XFile? _selectedImage;
String classname;
String? _selectedSex;
DateTime? _selectedBirthday;
_AddStudentState(String classname) : this.classname = classname;
@override
......@@ -163,6 +169,31 @@ class _AddStudentState extends State<AddStudentPage> {
),
),
// SizedBox(height: 20),
// GestureDetector(
// onTap: () => _selectDate(context),
// child: Container(
// padding: EdgeInsets.symmetric(horizontal: 10, vertical: 15),
// decoration: BoxDecoration(
// color: Color.fromARGB(107, 196, 196, 196),
// borderRadius: BorderRadius.circular(10.0),
// ),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween, // Aligns children to both ends
// children: [
// Expanded( // Text takes up all available space, pushing the icon to the right
// child: Text(
// _selectedBirthday != null ? DateFormat('yyyy-MM-dd').format(_selectedBirthday!) : 'Select Birthday',
// style: TextStyle(fontSize: 14.0, color: Colors.black54),
// ),
// ),
// Icon(Icons.cake, size: 23.0, color: Color.fromARGB(132, 12, 12, 12)), // Icon on the right
// ],
// ),
// ),
// ),
SizedBox(height: 20),
Container(
height: 55.0,
......@@ -186,25 +217,34 @@ class _AddStudentState extends State<AddStudentPage> {
SizedBox(height: 20),
Container(
height: 55.0,
child: TextField(
controller: _sexController,
padding: EdgeInsets.symmetric(horizontal: 10, vertical: 2),
decoration: BoxDecoration(
color: Color.fromARGB(107, 196, 196, 196), // Background color
borderRadius: BorderRadius.circular(10.0), // Border radius
),
child: DropdownButtonFormField<String>(
value: _selectedSex, // This should be a variable in your state class initialized to null or the default value
decoration: InputDecoration(
hintText: 'Male/Female',
filled: true,
fillColor: Color.fromARGB(107, 196, 196, 196),
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(10.0),
borderSide: BorderSide.none,
),
suffixIcon: Icon(Icons.people,
size: 23.0, color: Color.fromARGB(132, 12, 12, 12)),
hintStyle: TextStyle(fontSize: 14.0), // Add border here
border: InputBorder.none,
// contentPadding: EdgeInsets.zero,
suffixIcon: Icon(Icons.people, size: 23.0, color: Color.fromARGB(132, 12, 12, 12)),
),
hint: Text('Gender', style: TextStyle(fontSize: 14.0)), // Placeholder text
onChanged: (String? newValue) {
setState(() {
_selectedSex = newValue; // Update the state with the new value
});
},
items: <String>['Male', 'Female'].map<DropdownMenuItem<String>>((String value) {
return DropdownMenuItem<String>(
value: value,
child: Text(value),
);
}).toList(),
),
),
//Medicine Part
SizedBox(height: 50),
Row(
children: [
......@@ -586,7 +626,7 @@ class _AddStudentState extends State<AddStudentPage> {
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
ElevatedButton(
onPressed: () async {
if (Image == null) {
AwesomeDialog(
......@@ -664,36 +704,38 @@ class _AddStudentState extends State<AddStudentPage> {
}
},
style:
TextButton.styleFrom(backgroundColor: Colors.green),
child: Text(
'Save',
style: TextStyle(
color: Colors.white,
fontSize: 14,
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
height: 1,
ElevatedButton.styleFrom(
primary: const Color.fromARGB(255, 48, 206, 53),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
'Save',
style: TextStyle(color: const Color.fromARGB(255, 255, 255, 255)),
),
),
),
TextButton(
onPressed: () {
// Handle signup logic here
Navigator.pop(context);
},
style: TextButton.styleFrom(
backgroundColor: Colors.grey.shade200),
child: Text(
'Cancel',
style: TextStyle(
color: Colors.black,
fontSize: 14,
fontFamily: 'Poppins',
fontWeight: FontWeight.w600,
height: 1,
ElevatedButton(
onPressed: () {
Navigator.pop(context);
},
style: ElevatedButton.styleFrom(
primary: const Color.fromARGB(255, 255, 255, 255),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Padding(
padding: const EdgeInsets.all(10.0),
child: Text(
'Cancel',
style: TextStyle(color: Colors.black),
),
),
),
)
],
),
],
......@@ -766,3 +808,18 @@ class _AddStudentState extends State<AddStudentPage> {
)..show();
}
}
Future<void> _selectDate(BuildContext context) async {
final DateTime? pickedDate = await showDatePicker(
context: context,
initialDate: DateTime.now(), // Initial date set to current date
firstDate: DateTime(1900), // Earliest allowable date
lastDate: DateTime.now(), // Latest allowable date is today
);
// if (pickedDate != null && pickedDate != DateTime.now()) {
// setState(() {
// // Format the date and update the text field
// _birthdayController.text = DateFormat('yyyy-MM-dd').format(pickedDate);
// });
// }
}
This diff is collapsed.
......@@ -738,7 +738,7 @@ child: Container(
TextSpan(
children: [
TextSpan(
text: 'Monthly \npsycholo. report \n ',
text: 'Monthly progress report \n',
style: TextStyle(
color:
Color(0xFF403572),
......@@ -760,7 +760,7 @@ child: Container(
child: Opacity(
opacity: 0.70,
child: Text(
'Some short description of this type of report.',
"Progress of kid's learning and behavior.",
style: TextStyle(
color: Color(0xFF8DAEAE),
fontSize: 9.55,
......@@ -847,7 +847,7 @@ child: Container(
TextSpan(
children: [
TextSpan(
text: 'Monthly prediction report \n',
text: 'Monthly \nPsychology Report \n ',
style: TextStyle(
color:
Color(0xFF479696),
......@@ -868,7 +868,7 @@ child: Container(
child: Opacity(
opacity: 0.70,
child: Text(
'Some short description of this type of report.',
'Monthly insights of activity reports',
style: TextStyle(
color: Color(0xFF8DAEAE),
fontSize: 9.55,
......
......@@ -125,7 +125,7 @@ class ClassroomViewPage extends StatelessWidget {
}
// Use the result of getStudentCount
return Text(
'Children Count ' + (snapshot.data ?? '0'), // Default to '0' if data is null
'Kids Count: ' + (snapshot.data ?? '0'), // Default to '0' if data is null
style: TextStyle(
color: Colors.black,
fontSize: 15,
......
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/the_memory_match_game.dart';
void main() {
runApp(
const TheMemoryMatchGame(),
);
}
import 'package:flutter/material.dart';
enum CardState { hidden, visible, guessed }
class CardItem {
CardItem({
required this.value,
required this.icon,
required this.color,
this.state = CardState.hidden,
});
final int value;
final IconData icon;
final Color color;
CardState state;
}
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/models/card_item.dart';
import 'package:mobile_application_kids/game1/utils/icons.dart';
class Game {
Game(this.gridSize) {
generateCards();
}
final int gridSize;
List<CardItem> cards = [];
bool isGameOver = false;
Set<IconData> icons = {};
void generateCards() {
generateIcons();
cards = [];
final List<Color> cardColors = Colors.primaries.toList();
for (int i = 0; i < (gridSize * gridSize / 2); i++) {
final cardValue = i + 1;
final IconData icon = icons.elementAt(i);
final Color cardColor = cardColors[i % cardColors.length];
final List<CardItem> newCards =
_createCardItems(icon, cardColor, cardValue);
cards.addAll(newCards);
}
cards.shuffle(Random());
}
void generateIcons() {
icons = <IconData>{};
for (int j = 0; j < (gridSize * gridSize / 2); j++) {
final IconData icon = _getRandomCardIcon();
icons.add(icon);
icons.add(icon); // Add the icon twice to ensure pairs are generated.
}
}
void resetGame() {
generateCards();
isGameOver = false;
}
void onCardPressed(int index) {
cards[index].state = CardState.visible;
final List<int> visibleCardIndexes = _getVisibleCardIndexes();
if (visibleCardIndexes.length == 2) {
final CardItem card1 = cards[visibleCardIndexes[0]];
final CardItem card2 = cards[visibleCardIndexes[1]];
if (card1.value == card2.value) {
card1.state = CardState.guessed;
card2.state = CardState.guessed;
isGameOver = _isGameOver();
} else {
Future.delayed(const Duration(milliseconds: 1000), () {
card1.state = CardState.hidden;
card2.state = CardState.hidden;
});
}
}
}
List<CardItem> _createCardItems(
IconData icon, Color cardColor, int cardValue) {
return List.generate(
2,
(index) => CardItem(
value: cardValue,
icon: icon,
color: cardColor,
),
);
}
IconData _getRandomCardIcon() {
final Random random = Random();
IconData icon;
do {
icon = cardIcons[random.nextInt(cardIcons.length)];
} while (icons.contains(icon));
return icon;
}
List<int> _getVisibleCardIndexes() {
return cards
.asMap()
.entries
.where((entry) => entry.value.state == CardState.visible)
.map((entry) => entry.key)
.toList();
}
bool _isGameOver() {
return cards.every((card) => card.state == CardState.guessed);
}
}
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/pages/startup_page.dart';
class TheMemoryMatchGame extends StatelessWidget {
const TheMemoryMatchGame({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: const StartUpPage(),
title: 'Memory Match',
theme: ThemeData.dark(),
debugShowCheckedModeBanner: false,
);
}
}
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/widgets/web/game_board.dart';
import 'package:mobile_application_kids/game1/ui/widgets/mobile/game_board_mobile.dart';
class MemoryMatchPage extends StatelessWidget {
const MemoryMatchPage({
required this.gameLevel,
super.key,
});
final int gameLevel;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: LayoutBuilder(
builder: ((context, constraints) {
if (constraints.maxWidth > 720) {
return GameBoard(
gameLevel: gameLevel,
);
} else {
return GameBoardMobile(
gameLevel: gameLevel,
);
}
}),
),
),
);
}
}
//startup_page.dart
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_options.dart';
import 'package:mobile_application_kids/game1/utils/constants.dart';
import 'package:mobile_application_kids/games.dart';
class StartUpPage extends StatelessWidget {
const StartUpPage({Key? key}) : super(key: key); // Fix super key
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
gameTitle,
style: TextStyle(fontSize: 24, color: Colors.white),
),
GameOptions(),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => GamesPage()),
);
},
child: Text('Quit'), // Add quit button
),
],
),
),
),
);
}
}
import 'package:flutter/material.dart';
class GameButton extends StatelessWidget {
const GameButton({
required this.title,
required this.onPressed,
required this.color,
this.height = 40,
this.width = double.infinity,
this.fontSize = 18,
Key? key,
}) : super(key: key);
final String title;
final VoidCallback onPressed;
final Color color;
final double height;
final double width;
final double fontSize;
@override
Widget build(BuildContext context) {
return SizedBox(
height: height,
width: width,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: color,
textStyle: TextStyle(fontSize: fontSize),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(height / 2),
),
),
),
onPressed: onPressed,
child: Text(title),
),
);
}
}
import 'package:confetti/confetti.dart';
import 'package:flutter/material.dart';
class GameConfetti extends StatefulWidget {
const GameConfetti({
super.key,
});
@override
State<GameConfetti> createState() => _GameConfettiState();
}
class _GameConfettiState extends State<GameConfetti> {
final controllerCenter =
ConfettiController(duration: const Duration(seconds: 10));
@override
void initState() {
super.initState();
controllerCenter.play();
}
@override
void dispose() {
controllerCenter.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.topCenter,
child: ConfettiWidget(
confettiController: controllerCenter,
blastDirectionality: BlastDirectionality.explosive,
shouldLoop: false,
gravity: 0.5,
emissionFrequency: 0.05,
numberOfParticles: 20,
colors: const [
Colors.green,
Colors.blue,
Colors.pink,
Colors.orange,
Colors.purple
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/pages/startup_page.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_button.dart';
import 'package:mobile_application_kids/game1/utils/constants.dart';
class GameControlsBottomSheet extends StatelessWidget {
const GameControlsBottomSheet({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Center(
child: Text(
'PAUSE',
style: TextStyle(fontSize: 24, color: Colors.white),
),
),
const SizedBox(height: 10),
GameButton(
onPressed: () => Navigator.of(context).pop(false),
title: 'CONTINUE',
color: continueButtonColor,
width: 200,
),
const SizedBox(height: 10),
GameButton(
onPressed: () => Navigator.of(context).pop(true),
title: 'RESTART',
color: restartButtonColor,
width: 200,
),
const SizedBox(height: 10),
GameButton(
onPressed: () {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
return const StartUpPage();
},
),
(Route<dynamic> route) => false,
);
},
title: 'QUIT',
color: quitButtonColor,
width: 200,
),
const SizedBox(height: 20),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/pages/memory_match_page.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_button.dart';
import 'package:mobile_application_kids/game1/utils/constants.dart';
class GameOptions extends StatelessWidget {
const GameOptions({
super.key,
});
static Route<dynamic> _routeBuilder(BuildContext context, int gameLevel) {
return MaterialPageRoute(
builder: (_) {
return MemoryMatchPage(gameLevel: gameLevel);
},
);
}
@override
Widget build(BuildContext context) {
return Column(
children: gameLevels.map((level) {
return Padding(
padding: const EdgeInsets.all(10.0),
child: GameButton(
onPressed: () => Navigator.of(context).pushAndRemoveUntil(
_routeBuilder(context, level['level']),
(Route<dynamic> route) => false),
title: level['title'],
color: level['color']![700]!,
width: 250,
),
);
}).toList(),
);
}
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/models/card_item.dart';
class MemoryCard extends StatelessWidget {
const MemoryCard({
required this.card,
required this.index,
required this.onCardPressed,
super.key,
});
final CardItem card;
final int index;
final ValueChanged<int> onCardPressed;
void _handleCardTap() {
if (card.state == CardState.hidden) {
Timer(const Duration(milliseconds: 100), () {
onCardPressed(index);
});
}
}
@override
Widget build(BuildContext context) {
return InkWell(
onTap: _handleCardTap,
child: Card(
elevation: 8,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
color:
card.state == CardState.visible || card.state == CardState.guessed
? card.color
: Colors.grey,
child: Center(
child: card.state == CardState.hidden
? null
: SizedBox.expand(
child: FittedBox(
child: Icon(
card.icon,
color: Colors.white,
),
),
),
),
),
);
}
}
import 'package:flutter/material.dart';
class GameBestTimeMobile extends StatelessWidget {
const GameBestTimeMobile({
required this.bestTime,
super.key,
});
final int bestTime;
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.symmetric(
vertical: 50,
horizontal: 60,
),
elevation: 8,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
color: Colors.greenAccent[700],
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
const Expanded(
flex: 1,
child: Icon(
Icons.celebration,
size: 40,
),
),
Expanded(
flex: 2,
child: Text(
textAlign: TextAlign.center,
Duration(seconds: bestTime)
.toString()
.split('.')
.first
.padLeft(8, "0"),
style: const TextStyle(
fontSize: 28.0,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
);
}
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:mobile_application_kids/game1/models/game.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_confetti.dart';
import 'package:mobile_application_kids/game1/ui/widgets/memory_card.dart';
import 'package:mobile_application_kids/game1/ui/widgets/mobile/game_best_time_mobile.dart';
import 'package:mobile_application_kids/game1/ui/widgets/mobile/game_timer_mobile.dart';
import 'package:mobile_application_kids/game1/ui/widgets/restart_game.dart';
class GameBoardMobile extends StatefulWidget {
const GameBoardMobile({
required this.gameLevel,
super.key,
});
final int gameLevel;
@override
State<GameBoardMobile> createState() => _GameBoardMobileState();
}
class _GameBoardMobileState extends State<GameBoardMobile> {
late Timer timer;
late Game game;
late Duration duration;
int bestTime = 0;
bool showConfetti = false;
@override
void initState() {
super.initState();
game = Game(widget.gameLevel);
duration = const Duration();
startTimer();
getBestTime();
}
void getBestTime() async {
SharedPreferences gameSP = await SharedPreferences.getInstance();
if (gameSP.getInt('${widget.gameLevel.toString()}BestTime') != null) {
bestTime = gameSP.getInt('${widget.gameLevel.toString()}BestTime')!;
}
setState(() {});
}
startTimer() {
timer = Timer.periodic(const Duration(seconds: 1), (_) async {
setState(() {
final seconds = duration.inSeconds + 1;
duration = Duration(seconds: seconds);
});
if (game.isGameOver) {
timer.cancel();
SharedPreferences gameSP = await SharedPreferences.getInstance();
if (gameSP.getInt('${widget.gameLevel.toString()}BestTime') == null ||
gameSP.getInt('${widget.gameLevel.toString()}BestTime')! >
duration.inSeconds) {
gameSP.setInt(
'${widget.gameLevel.toString()}BestTime', duration.inSeconds);
setState(() {
showConfetti = true;
bestTime = duration.inSeconds;
});
}
}
});
}
pauseTimer() {
timer.cancel();
}
void _resetGame() {
game.resetGame();
setState(() {
timer.cancel();
duration = const Duration();
startTimer();
});
}
@override
Widget build(BuildContext context) {
final aspectRatio = MediaQuery.of(context).size.aspectRatio;
return SafeArea(
child: Stack(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
height: 20,
),
RestartGame(
isGameOver: game.isGameOver,
pauseGame: () => pauseTimer(),
restartGame: () => _resetGame(),
continueGame: () => startTimer(),
color: Colors.amberAccent[700]!,
),
GameTimerMobile(
time: duration,
),
Expanded(
child: GridView.count(
crossAxisCount: game.gridSize,
childAspectRatio: aspectRatio * 2,
children: List.generate(game.cards.length, (index) {
return MemoryCard(
index: index,
card: game.cards[index],
onCardPressed: game.onCardPressed,
);
}),
),
),
GameBestTimeMobile(
bestTime: bestTime,
),
],
),
showConfetti ? const GameConfetti() : const SizedBox(),
],
),
);
}
}
import 'package:flutter/material.dart';
class GameTimerMobile extends StatelessWidget {
const GameTimerMobile({
required this.time,
super.key,
});
final Duration time;
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.symmetric(
vertical: 20,
horizontal: 60,
),
elevation: 8,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
color: Colors.red[700],
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
const Expanded(
flex: 1,
child: Icon(
Icons.timer,
size: 40,
),
),
Expanded(
flex: 2,
child: Text(
textAlign: TextAlign.center,
time.toString().split('.').first.padLeft(8, "0"),
style: const TextStyle(
fontSize: 28.0,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
);
}
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/pages/startup_page.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_controls_bottomsheet.dart';
class RestartGame extends StatelessWidget {
const RestartGame({
required this.isGameOver,
required this.pauseGame,
required this.restartGame,
required this.continueGame,
this.color = Colors.white,
super.key,
});
final VoidCallback pauseGame;
final VoidCallback restartGame;
final VoidCallback continueGame;
final bool isGameOver;
final Color color;
Future<void> showGameControls(BuildContext context) async {
pauseGame();
var value = await showModalBottomSheet<bool>(
isScrollControlled: true,
elevation: 5,
context: context,
builder: (sheetContext) {
return const GameControlsBottomSheet();
},
);
value ??= false;
if (value) {
restartGame();
} else {
continueGame();
}
}
void navigateback(BuildContext context) {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (BuildContext context) {
return const StartUpPage();
}), (Route<dynamic> route) => false);
}
@override
Widget build(BuildContext context) {
return IconButton(
color: color,
icon: (isGameOver)
? const Icon(Icons.replay_circle_filled)
: const Icon(Icons.pause_circle_filled),
iconSize: 40,
onPressed: () =>
isGameOver ? navigateback(context) : showGameControls(context),
);
}
}
import 'package:flutter/material.dart';
class GameBestTime extends StatelessWidget {
const GameBestTime({
required this.bestTime,
super.key,
});
final int bestTime;
@override
Widget build(BuildContext context) {
return Text(
'Best: ${Duration(seconds: bestTime).toString().split('.').first.padLeft(8, "0")}',
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold),
);
}
}
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:mobile_application_kids/game1/models/game.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_confetti.dart';
import 'package:mobile_application_kids/game1/ui/widgets/memory_card.dart';
import 'package:mobile_application_kids/game1/ui/widgets/restart_game.dart';
import 'package:mobile_application_kids/game1/ui/widgets/web/game_best_time.dart';
import 'package:mobile_application_kids/game1/ui/widgets/web/game_timer.dart';
class GameBoard extends StatefulWidget {
const GameBoard({
required this.gameLevel,
super.key,
});
final int gameLevel;
@override
State<GameBoard> createState() => _GameBoardState();
}
class _GameBoardState extends State<GameBoard> {
late Timer timer;
late Game game;
late Duration duration;
int bestTime = 0;
bool showConfetti = false;
@override
void initState() {
super.initState();
game = Game(widget.gameLevel);
duration = const Duration();
startTimer();
getBestTime();
}
void getBestTime() async {
SharedPreferences gameSP = await SharedPreferences.getInstance();
if (gameSP.getInt('${widget.gameLevel.toString()}BestTime') != null) {
bestTime = gameSP.getInt('${widget.gameLevel.toString()}BestTime')!;
}
setState(() {});
}
startTimer() {
timer = Timer.periodic(const Duration(seconds: 1), (_) async {
setState(() {
final seconds = duration.inSeconds + 1;
duration = Duration(seconds: seconds);
});
if (game.isGameOver) {
timer.cancel();
SharedPreferences gameSP = await SharedPreferences.getInstance();
if (gameSP.getInt('${widget.gameLevel.toString()}BestTime') == null ||
gameSP.getInt('${widget.gameLevel.toString()}BestTime')! >
duration.inSeconds) {
gameSP.setInt(
'${widget.gameLevel.toString()}BestTime', duration.inSeconds);
setState(() {
showConfetti = true;
bestTime = duration.inSeconds;
});
}
}
});
}
pauseTimer() {
timer.cancel();
}
void _resetGame() {
game.resetGame();
setState(() {
timer.cancel();
duration = const Duration();
startTimer();
});
}
@override
Widget build(BuildContext context) {
final responsiveSpacing = sqrt(MediaQuery.of(context).size.width) *
sqrt(MediaQuery.of(context).size.height);
return Stack(
children: [
GridView.count(
padding: const EdgeInsets.fromLTRB(8.0, 80.0, 8.0, 8.0),
childAspectRatio: MediaQuery.of(context).size.aspectRatio * 1.2,
mainAxisSpacing: responsiveSpacing / 100,
crossAxisSpacing: responsiveSpacing / 100,
crossAxisCount: game.gridSize,
children: List.generate(game.cards.length, (index) {
return MemoryCard(
index: index,
card: game.cards[index],
onCardPressed: game.onCardPressed,
);
}),
),
Positioned(
top: 12.0,
right: 24.0,
child: RestartGame(
isGameOver: game.isGameOver,
pauseGame: () => pauseTimer(),
restartGame: () => _resetGame(),
continueGame: () => startTimer(),
),
),
Positioned(
bottom: 12.0,
right: 24.0,
child: GameTimer(
time: duration,
),
),
Positioned(
bottom: 12.0,
left: 24.0,
child: GameBestTime(
bestTime: bestTime,
),
),
showConfetti ? const GameConfetti() : const SizedBox(),
],
);
}
}
import 'package:flutter/material.dart';
class GameTimer extends StatelessWidget {
const GameTimer({
required this.time,
super.key,
});
final Duration time;
@override
Widget build(BuildContext context) {
return Text(
time.toString().split('.').first.padLeft(8, "0"),
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
);
}
}
import 'package:flutter/material.dart';
const Color continueButtonColor = Color.fromRGBO(235, 32, 93, 1);
const Color restartButtonColor = Color.fromRGBO(243, 181, 45, 1);
const Color quitButtonColor = Color.fromRGBO(39, 162, 149, 1);
const List<Map<String, dynamic>> gameLevels = [
{'title': 'Easy', 'level': 4, 'color': Colors.amberAccent},
{'title': 'Medium', 'level': 6, 'color': Colors.blueAccent},
{'title': 'Hard', 'level': 8, 'color': Colors.cyanAccent},
];
const String gameTitle = 'MEMORY MATCH';
import 'package:flutter/material.dart';
const List<IconData> cardIcons = <IconData>[
Icons.celebration,
Icons.directions_car_filled,
Icons.directions_bike,
Icons.house,
Icons.local_shipping,
Icons.fastfood,
Icons.album_sharp,
Icons.forest,
Icons.anchor,
Icons.ac_unit,
Icons.android,
Icons.favorite,
Icons.light,
Icons.agriculture_sharp,
Icons.airplanemode_on,
Icons.umbrella,
Icons.alarm,
Icons.directions_subway_rounded,
Icons.person,
Icons.light_mode_outlined,
Icons.bedtime_sharp,
Icons.all_inclusive,
Icons.wine_bar,
Icons.star,
Icons.headset_rounded,
Icons.apple_sharp,
Icons.whatshot_outlined,
Icons.delete,
Icons.audiotrack_rounded,
Icons.back_hand_sharp,
Icons.visibility,
Icons.traffic_rounded,
Icons.beach_access_rounded,
Icons.battery_charging_full_sharp,
Icons.downhill_skiing_rounded,
Icons.directions_boat_rounded,
Icons.eco_sharp,
Icons.restaurant,
Icons.balance_sharp,
Icons.shopping_cart_rounded,
Icons.radar_sharp,
Icons.sports_esports_rounded,
];
//main.dart
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game2/song_tales.dart';
void main() => runApp(SongTalesApp()); // Using the specific name for the app
This diff is collapsed.
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'emoX.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: EmotionGame(),
);
}
}
class EmotionGame extends StatefulWidget {
@override
_EmotionGameState createState() => _EmotionGameState();
}
class _EmotionGameState extends State<EmotionGame> {
late String correctEmotion;
bool isCorrect = false;
int questionIndex = 0;
bool allQuestionsCompleted =
false; // Flag to track if all questions are completed
// Map containing emotions, questions, and corresponding image paths
final Map<String, Map<String, String>> emotionData = {
'Sad': {
'question': 'How Lili looks like if she is Sad?',
'image': 'gsad.png'
},
'Angry': {
'question': 'How Lili looks like if she is Angry?',
'image': 'gangry.png'
},
'Happy': {
'question': 'How Lili looks like if she is Happy?',
'image': 'ghappy.png'
},
'Confused': {
'question': 'How Lili looks like if she is Confused?',
'image': 'gconfused.png'
},
'Surprised': {
'question': 'How Lili looks like if she is Surprised?',
'image': 'gsurprised.png'
},
};
// Lists containing shuffled emotions and questions
late List<String> shuffledEmotions;
late List<String> shuffledQuestions;
@override
void initState() {
super.initState();
// Set preferred orientations to portrait mode after navigating to this screen
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
shuffledEmotions = List.from(emotionData.keys)..shuffle();
shuffledQuestions = List.from(emotionData.values.map((e) => e['question']!))
..shuffle();
correctEmotion = _getCorrectEmotion(shuffledQuestions[questionIndex]);
}
// Function to get the correct emotion based on the question
String _getCorrectEmotion(String question) {
return emotionData.entries
.firstWhere((entry) => entry.value['question'] == question)
.key;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Emotion Game'),
),
body: Column(
children: [
Text(
shuffledQuestions[questionIndex],
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 60.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: shuffledEmotions.map((emotion) {
return Draggable(
child: Image.asset(
'game_assets/${emotionData[emotion]!['image']}',
width: 65,
height: 65,
),
feedback: Image.asset(
'game_assets/${emotionData[emotion]!['image']}',
width: 60,
height: 60,
),
data: emotion,
);
}).toList(),
),
SizedBox(height: 70.0),
DragTarget<String>(
builder: (BuildContext context, List<String?> candidateData,
List<dynamic> rejectedData) {
return Container(
width: 240,
height: 240,
color: Color.fromARGB(255, 222, 214, 145).withOpacity(0.5),
child: isCorrect
? Image.asset(
'game_assets/${emotionData[correctEmotion]!['image']}')
: null,
);
},
onWillAccept: (data) => data == correctEmotion,
onAccept: (data) {
setState(() {
isCorrect = true;
});
},
),
SizedBox(height: 20.0),
ElevatedButton(
onPressed: () {
setState(() {
if (questionIndex < shuffledQuestions.length - 1) {
questionIndex++;
isCorrect = false;
correctEmotion =
_getCorrectEmotion(shuffledQuestions[questionIndex]);
} else {
// Last question, set the flag to true
allQuestionsCompleted = true;
}
});
},
child: Text(
questionIndex < shuffledQuestions.length - 1
? 'Next Question >>'
: 'Finish Game',
),
),
if (allQuestionsCompleted)
SizedBox(
height: 30,
), // Show the text only when all questions are completed
if (allQuestionsCompleted)
Text(
'Game Over! You Won!',
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
if (allQuestionsCompleted)
SizedBox(
height: 10,
), // Show the single Quit button only when all questions are completed
if (allQuestionsCompleted)
ElevatedButton(
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => LevelScreen()),
);
},
child: Text('Quit'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 247, 56, 35),
onPrimary: Colors.white,
),
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'emoX.dart';
class Level3 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Level 3'),
),
body: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Center(
child: Column(
children: [
Text(
"Let's Identify",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
Text(
"Different Human Emotions",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 21,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
// Display the first GIF (laugh.gif)
Image.asset(
'game_assets/laugh.gif',
width: 380,
height: 350,
),
SizedBox(height: 0), // Reduce the gap between GIFs
// Display the second GIF (sad.gif)
Image.asset(
'game_assets/sad.gif',
width: 380,
height: 350,
),
Padding(
padding: const EdgeInsets.only(top: 20.0, bottom: 20.0),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => NextPage()),
);
},
child: Text('Next page'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 120, 149, 145),
onPrimary: Colors.white,
),
),
),
],
),
),
);
}
}
class NextPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Next Page'),
),
body: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Center(
child: Column(
children: [
Text(
"Let's Identify",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
Text(
"Different Human Emotions",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 21,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
// Display the first GIF (fear.gif)
Image.asset(
'game_assets/fear.gif',
width: 380,
height: 320,
),
SizedBox(height: 0), // Reduce the gap between GIFs
// Display the second GIF (anger.gif)
Image.asset(
'game_assets/anger.gif',
width: 380,
height: 350,
),
Padding(
padding: const EdgeInsets.only(top: 20.0, bottom: 20.0),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => FinalPage()),
);
},
child: Text('Next page'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 120, 149, 145),
onPrimary: Colors.white,
),
),
),
],
),
),
);
}
}
class FinalPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Final Page'),
),
body: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Center(
child: Column(
children: [
Text(
"Let's Identify",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
Text(
"Different Human Emotions",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 21,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
// Display the first GIF (disgust.gif)
Image.asset(
'game_assets/disgust.gif',
width: 380,
height: 320,
),
SizedBox(height: 0), // Reduce the gap between GIFs
// Display the second GIF (surprise.gif)
Image.asset(
'game_assets/surprise.gif',
width: 380,
height: 350,
),
Padding(
padding: const EdgeInsets.only(top: 20.0, bottom: 20.0),
child: ElevatedButton(
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => LevelScreen()),
);
},
child: Text('Finish'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 231, 65, 43),
onPrimary: Colors.white,
),
),
),
],
),
),
);
}
}
//main.dart
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game3/emoX.dart';
void main() => runApp(EmoXApp()); // Using the specific name for the app
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game4/Posture_pro.dart';
void main() => runApp(PosturePro());
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/ChatScreen.dart';
import 'package:mobile_application_kids/game1/the_memory_match_game.dart';
import 'package:mobile_application_kids/game2/song_tales.dart';
import 'package:mobile_application_kids/game3/emoX.dart';
import 'package:mobile_application_kids/game4/Posture_pro.dart';
class GamesPage extends StatelessWidget {
final List<Map<String, String>> gameData = [
{'game': 'Game 1', 'description': 'Description for Game 1'},
{'game': 'Game 2', 'description': 'Description for Game 2'},
// add list
];
final String commonImagePath = 'assets/act_photo.png';
@override
......@@ -29,35 +28,123 @@ class GamesPage extends StatelessWidget {
),
),
Expanded(
child: ListView.builder(
itemCount: gameData.length,
itemBuilder: (context, index) {
var game = gameData[index];
return Card(
child: ListView(
children: [
// Game 1 Card/Button
Card(
child: ListTile(
contentPadding: EdgeInsets.all(16),
leading: Container(
width: 50,
height: 50,
child: CircleAvatar(
backgroundImage: AssetImage(commonImagePath),
),
),
title: Text(
'Game 1',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
subtitle: Text('Description for Game 1'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => TheMemoryMatchGame()),
);
},
),
),
// Game 2 Card/Button
Card(
child: ListTile(
contentPadding: EdgeInsets.all(16),
leading: Container(
width: 50,
width: 50,
height: 50,
child: CircleAvatar(
backgroundImage: AssetImage(commonImagePath),
),
),
title: Text(
game['game'] ?? '',
'Game 2',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
subtitle: Text(game['description'] ?? ''),
subtitle: Text('Description for Game 2'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SongTalesApp()),
);
},
),
);
},
),
// Game 3 Card/Button
Card(
child: ListTile(
contentPadding: EdgeInsets.all(16),
leading: Container(
width: 50,
height: 50,
child: CircleAvatar(
backgroundImage: AssetImage(commonImagePath),
),
),
title: Text(
'Game 3',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
subtitle: Text('Description for Game 3'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => EmoXApp()),
);
},
),
),
// Game 4 Card/Button
Card(
child: ListTile(
contentPadding: EdgeInsets.all(16),
leading: Container(
width: 50,
height: 50,
child: CircleAvatar(
backgroundImage: AssetImage(commonImagePath),
),
),
title: Text(
'Game 4',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
subtitle: Text('Description for Game 4'),
onTap: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => PosturePro()),
);
},
),
),
],
),
),
],
),
bottomNavigationBar: BottomNavigationBar(
items: const [
BottomNavigationBarItem(
......@@ -69,7 +156,7 @@ class GamesPage extends StatelessWidget {
label: 'Chat',
),
BottomNavigationBarItem(
icon: Icon(Icons.games),
icon: Icon(Icons.sports_baseball),
label: 'Games',
),
BottomNavigationBarItem(
......@@ -77,37 +164,36 @@ class GamesPage extends StatelessWidget {
label: 'Profile',
),
],
selectedItemColor: Color(0xFF7A1FA0),
unselectedItemColor: Color(0xFFA9ABAD),
selectedLabelStyle: TextStyle(color: Color(0xFF7A1FA0)),
unselectedLabelStyle: TextStyle(color: Color.fromARGB(0, 197, 16, 16)),
selectedItemColor: Colors.blueAccent,
unselectedItemColor: Colors.grey,
currentIndex: 2,
onTap: (index) {
switch (index) {
case 0:
// Navigate to Home
// Replace the code below with your home navigation logic
// Navigator.push(
// // context,
// // MaterialPageRoute(builder: (context) => AddClassroom()),
// context,
// MaterialPageRoute(builder: (context) => ParentHomePage(phoneNo, role)),
// );
break;
case 1:
// Navigate to Chat
// Navigator.push(
// // context,
// // MaterialPageRoute(builder: (context) => ChatScreen()),
// );
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ChatScreen()),
);
break;
case 2:
// Already on Games Page
// Do nothing, we are already on the Games page
break;
case 3:
// Navigate to Profile
// Navigator.push(
// // context,
// // MaterialPageRoute(builder: (context) => TeacherProfile()),
// );
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => ParentProfilePage(uid: uid, phoneNo: phoneNo, role: role),
// ),
// );
break;
}
},
......
......@@ -172,7 +172,8 @@ class _KidsReportPageState extends State<KidsReportPage> {
padding: const EdgeInsets.all(10.0),
child: Text(
'Save',
style: TextStyle(color: const Color.fromARGB(255, 255, 255, 255)),
style: TextStyle(
color: const Color.fromARGB(255, 255, 255, 255)),
),
),
),
......
......@@ -20,7 +20,24 @@ class ReportKidsViewPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Student Report'),
title: Text(' '),
actions: [
Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 16),
child: Text(
'Student Report',
style: TextStyle(
color: Color(0xFF554994),
fontSize: 24,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
height: 0.04,
letterSpacing: -0.96,
),
),
),
],
),
body: StreamBuilder<QuerySnapshot>(
stream: _reportsStream,
......@@ -55,9 +72,9 @@ Widget _buildReportItem(String title, Map<String, dynamic> data) {
data.remove('sId');
return Card(
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 16),
margin: EdgeInsets.symmetric(vertical: 8, horizontal: 14),
child: Padding(
padding: EdgeInsets.all(16),
padding: EdgeInsets.all(8),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
......@@ -80,7 +97,7 @@ Widget _buildReportItem(String title, Map<String, dynamic> data) {
Text(
entry.key,
style: TextStyle(
fontWeight: FontWeight.bold,
// fontWeight: FontWeight.bold,
),
),
Text(entry.value ?? 'Not provided'),
......
......@@ -33,7 +33,7 @@ class KidsReportsPage extends StatelessWidget {
// letterSpacing: -0.96,
// ),
// ),
SizedBox(height: 20), // Add space here
SizedBox(height: 20),
Text(
'Select Kids ',
style: TextStyle(
......
......@@ -192,7 +192,7 @@ class _LoginPage extends State<LoginPage> {
} else {
AwesomeDialog(
context: context,
dialogType: DialogType.info,
dialogType: DialogType.success,
animType: AnimType.rightSlide,
title: ' login Parent',
desc: ' Go to your parent home page',
......
......@@ -186,7 +186,7 @@ class ParentHomePage extends StatelessWidget {
context,
MaterialPageRoute(
builder: (context) =>
pChildrenProfilePage(document, "P"),
pChildrenProfilePage(document, "P", pUser: 'user',),
),
);
},
......@@ -253,7 +253,6 @@ class ParentHomePage extends StatelessWidget {
context,
MaterialPageRoute(builder: (context) => GamesPage()),
);
break;
case 3:
// Navigate to Profile
......
......@@ -2,6 +2,7 @@ import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/ChatScreen.dart';
import 'package:mobile_application_kids/games.dart';
import 'package:mobile_application_kids/p_or_t.dart';
import 'package:mobile_application_kids/parenthome.dart';
......@@ -169,25 +170,46 @@ class _ParentProfilePageState extends State<ParentProfilePage> {
icon: Icon(Icons.chat),
label: 'Chat',
),
BottomNavigationBarItem(
icon: Icon(Icons.sports_baseball),
label: 'Games',
),
BottomNavigationBarItem(
icon: Icon(Icons.person),
label: 'Profile',
),
],
selectedItemColor: Colors.blue,
currentIndex: 2,
selectedItemColor: Colors.blueAccent,
unselectedItemColor: Colors.grey,
currentIndex: 3,
onTap: (index) {
if (index == 0) {
Navigator.push(
context,
switch (index) {
case 0:
// Navigate to Home
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ParentHomePage(phoneNo, role)),
);
}
if (index == 1) {
);
break;
case 1:
// Navigate to Chat
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ChatScreen()),
);
break;
case 2:
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ChatScreen()),
MaterialPageRoute(
builder: (context) => GamesPage(),
),
);
break;
case 3:
// Navigate to Profile
// Do nothing, we are already on the Games page
break;
}
},
),
......
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