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/
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"cloud_firestore","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_auth","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"image_picker_ios","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.9+1/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.5/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/sqflite-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/","native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.4.11/","native_build":true,"dependencies":[]}],"android":[{"name":"cloud_firestore","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_auth","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.17/","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"path_provider_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/","native_build":true,"dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.1/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/sqflite-2.3.2/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.0/","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_android-2.4.11/","native_build":true,"dependencies":[]}],"macos":[{"name":"cloud_firestore","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"file_selector_macos","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.3+3/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"image_picker_macos","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+1/","native_build":false,"dependencies":["file_selector_macos"]},{"name":"path_provider_foundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.5/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/sqflite-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/","native_build":true,"dependencies":[]}],"linux":[{"name":"file_selector_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2+1/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/","native_build":false,"dependencies":["file_selector_linux"]},{"name":"path_provider_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.1/","native_build":true,"dependencies":[]}],"windows":[{"name":"cloud_firestore","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"file_selector_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+1/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"image_picker_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/","native_build":false,"dependencies":["file_selector_windows"]},{"name":"path_provider_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","native_build":true,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.1/","native_build":true,"dependencies":[]}],"web":[{"name":"cloud_firestore_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore_web-3.8.10/","dependencies":["firebase_core_web"]},{"name":"firebase_auth_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth_web-5.8.12/","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core_web-2.10.0/","dependencies":[]},{"name":"firebase_storage_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage_web-3.6.17/","dependencies":["firebase_core_web"]},{"name":"image_picker_for_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_for_web-2.2.0/","dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_web-2.2.1/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.19/","dependencies":[]},{"name":"video_player_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_web-2.0.17/","dependencies":[]}]},"dependencyGraph":[{"name":"cloud_firestore","dependencies":["cloud_firestore_web","firebase_core"]},{"name":"cloud_firestore_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_storage","dependencies":["firebase_core","firebase_storage_web"]},{"name":"firebase_storage_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"rive_common","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]}],"date_created":"2024-03-18 17:43:20.593655","version":"3.10.1"}
\ No newline at end of file
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"cloud_firestore","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_auth","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"image_picker_ios","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_ios-0.8.9+1/","native_build":true,"dependencies":[]},{"name":"package_info_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.5/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/sqflite-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_ios","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_ios-6.2.4/","native_build":true,"dependencies":[]},{"name":"video_player_avfoundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_avfoundation-2.4.11/","native_build":true,"dependencies":[]},{"name":"wakelock_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/","native_build":true,"dependencies":["package_info_plus"]}],"android":[{"name":"cloud_firestore","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_auth","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"flutter_plugin_android_lifecycle","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/flutter_plugin_android_lifecycle-2.0.17/","native_build":true,"dependencies":[]},{"name":"image_picker_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_android-0.8.9+3/","native_build":true,"dependencies":["flutter_plugin_android_lifecycle"]},{"name":"package_info_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/","native_build":true,"dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","native_build":true,"dependencies":[]},{"name":"shared_preferences_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_android-2.2.1/","native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/sqflite-2.3.2/","native_build":true,"dependencies":[]},{"name":"url_launcher_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_android-6.3.0/","native_build":true,"dependencies":[]},{"name":"video_player_android","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_android-2.4.11/","native_build":true,"dependencies":[]},{"name":"wakelock_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/","native_build":true,"dependencies":["package_info_plus"]}],"macos":[{"name":"cloud_firestore","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"file_selector_macos","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_macos-0.9.3+3/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"image_picker_macos","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_macos-0.2.1+1/","native_build":false,"dependencies":["file_selector_macos"]},{"name":"package_info_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":true,"dependencies":[]},{"name":"path_provider_foundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","native_build":true,"dependencies":[]},{"name":"shared_preferences_foundation","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_foundation-2.3.5/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"sqflite","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/sqflite-2.3.2/","shared_darwin_source":true,"native_build":true,"dependencies":[]},{"name":"url_launcher_macos","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_macos-3.1.0/","native_build":true,"dependencies":[]},{"name":"wakelock_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/","native_build":true,"dependencies":["package_info_plus"]}],"linux":[{"name":"file_selector_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_linux-0.9.2+1/","native_build":true,"dependencies":[]},{"name":"image_picker_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_linux-0.2.1+1/","native_build":false,"dependencies":["file_selector_linux"]},{"name":"package_info_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_linux-2.2.1/","native_build":false,"dependencies":[]},{"name":"shared_preferences_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_linux-2.3.2/","native_build":false,"dependencies":["path_provider_linux"]},{"name":"url_launcher_linux","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_linux-3.1.1/","native_build":true,"dependencies":[]},{"name":"wakelock_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/","native_build":false,"dependencies":["package_info_plus"]}],"windows":[{"name":"cloud_firestore","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore-4.13.6/","native_build":true,"dependencies":["firebase_core"]},{"name":"file_selector_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/file_selector_windows-0.9.3+1/","native_build":true,"dependencies":[]},{"name":"firebase_auth","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth-4.15.3/","native_build":true,"dependencies":["firebase_core"]},{"name":"firebase_core","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core-2.24.2/","native_build":true,"dependencies":[]},{"name":"firebase_storage","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage-11.6.0/","native_build":true,"dependencies":["firebase_core"]},{"name":"image_picker_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_windows-0.2.1+1/","native_build":false,"dependencies":["file_selector_windows"]},{"name":"package_info_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","native_build":false,"dependencies":[]},{"name":"path_provider_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/","native_build":false,"dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","native_build":true,"dependencies":[]},{"name":"shared_preferences_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_windows-2.3.2/","native_build":false,"dependencies":["path_provider_windows"]},{"name":"url_launcher_windows","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_windows-3.1.1/","native_build":true,"dependencies":[]},{"name":"wakelock_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/","native_build":false,"dependencies":["package_info_plus"]}],"web":[{"name":"cloud_firestore_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/cloud_firestore_web-3.8.10/","dependencies":["firebase_core_web"]},{"name":"firebase_auth_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_auth_web-5.8.12/","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_core_web-2.10.0/","dependencies":[]},{"name":"firebase_storage_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/firebase_storage_web-3.6.17/","dependencies":["firebase_core_web"]},{"name":"image_picker_for_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/image_picker_for_web-2.2.0/","dependencies":[]},{"name":"package_info_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/package_info_plus-4.2.0/","dependencies":[]},{"name":"rive_common","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/rive_common-0.2.7/","dependencies":[]},{"name":"shared_preferences_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/shared_preferences_web-2.2.1/","dependencies":[]},{"name":"url_launcher_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/url_launcher_web-2.0.19/","dependencies":[]},{"name":"video_player_web","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_web-2.0.17/","dependencies":[]},{"name":"wakelock_plus","path":"/Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/","dependencies":["package_info_plus"]}]},"dependencyGraph":[{"name":"cloud_firestore","dependencies":["cloud_firestore_web","firebase_core"]},{"name":"cloud_firestore_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"file_selector_linux","dependencies":[]},{"name":"file_selector_macos","dependencies":[]},{"name":"file_selector_windows","dependencies":[]},{"name":"firebase_auth","dependencies":["firebase_auth_web","firebase_core"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_storage","dependencies":["firebase_core","firebase_storage_web"]},{"name":"firebase_storage_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"image_picker","dependencies":["image_picker_android","image_picker_for_web","image_picker_ios","image_picker_linux","image_picker_macos","image_picker_windows"]},{"name":"image_picker_android","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"image_picker_for_web","dependencies":[]},{"name":"image_picker_ios","dependencies":[]},{"name":"image_picker_linux","dependencies":["file_selector_linux"]},{"name":"image_picker_macos","dependencies":["file_selector_macos"]},{"name":"image_picker_windows","dependencies":["file_selector_windows"]},{"name":"package_info_plus","dependencies":[]},{"name":"path_provider","dependencies":["path_provider_android","path_provider_foundation","path_provider_linux","path_provider_windows"]},{"name":"path_provider_android","dependencies":[]},{"name":"path_provider_foundation","dependencies":[]},{"name":"path_provider_linux","dependencies":[]},{"name":"path_provider_windows","dependencies":[]},{"name":"rive_common","dependencies":[]},{"name":"shared_preferences","dependencies":["shared_preferences_android","shared_preferences_foundation","shared_preferences_linux","shared_preferences_web","shared_preferences_windows"]},{"name":"shared_preferences_android","dependencies":[]},{"name":"shared_preferences_foundation","dependencies":[]},{"name":"shared_preferences_linux","dependencies":["path_provider_linux"]},{"name":"shared_preferences_web","dependencies":[]},{"name":"shared_preferences_windows","dependencies":["path_provider_windows"]},{"name":"sqflite","dependencies":[]},{"name":"url_launcher","dependencies":["url_launcher_android","url_launcher_ios","url_launcher_linux","url_launcher_macos","url_launcher_web","url_launcher_windows"]},{"name":"url_launcher_android","dependencies":[]},{"name":"url_launcher_ios","dependencies":[]},{"name":"url_launcher_linux","dependencies":[]},{"name":"url_launcher_macos","dependencies":[]},{"name":"url_launcher_web","dependencies":[]},{"name":"url_launcher_windows","dependencies":[]},{"name":"video_player","dependencies":["video_player_android","video_player_avfoundation","video_player_web"]},{"name":"video_player_android","dependencies":[]},{"name":"video_player_avfoundation","dependencies":[]},{"name":"video_player_web","dependencies":[]},{"name":"wakelock_plus","dependencies":["package_info_plus"]}],"date_created":"2024-03-19 04:04:44.960536","version":"3.10.1"}
\ 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;
// 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.
},
),
],
),
),
],
);
}
}
// 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/ChatScreen.dart';
// import 'package:mobile_application_kids/ChildrenVideo.dart';
// import 'package:mobile_application_kids/ReportKids.dart';
// import 'package:mobile_application_kids/TeacherProfile.dart';
// import 'package:mobile_application_kids/teacherhome.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'),
// fit: BoxFit
// .cover,
// )),
// ),
// ),
// ),
// 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'),
// fit: BoxFit
// .cover,
// )),
// ),
// ),
// ),
// 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/ac7.png'),
// fit: BoxFit
// .cover,
// )),
// ),
// ),
// ),
// 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'),
// fit: BoxFit
// .cover,
// )),
// ),
// ),
// ),
// 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/ac6.png'),
// fit: BoxFit
// .cover,
// )),
// ),
// ),
// ),
// ]),
// ],
// ),
// ),
// ),
// bottomNavigationBar: BottomNavigationBar(
// items: const [
// BottomNavigationBarItem(
// icon: Icon(Icons.home),
// label: 'Home',
// ),
// BottomNavigationBarItem(
// icon: Icon(Icons.chat),
// label: 'Chat',
// ),
// BottomNavigationBarItem(
// icon: Icon(Icons.person),
// label: 'Profile',
// ),
// ],
// selectedItemColor: Color.fromARGB(255, 103, 103, 103),
// onTap: (index) {
// // Handle bottom navigation item tap
// switch (index) {
// case 0:
// // Navigate to Home
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => TeacherHomePage()),
// );
// break;
// case 1:
// // Navigate to Chat
// Navigator.push(
// context,
// MaterialPageRoute(builder: (context) => ChatScreen()),
// );
// break;
// case 2:
// // Navigate to Profile
// Navigator.push(
// context,
// MaterialPageRoute(
// builder: (context) => TeacherProfilePage(uid: user?.uid)),
// );
// break;
// }
// },
// ),
// );
// }
// 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');
// }
// }
// }
......@@ -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);
// });
// }
}
// import 'package:awesome_dialog/awesome_dialog.dart';
// import 'package:cloud_firestore/cloud_firestore.dart';
// import 'package:firebase_auth/firebase_auth.dart';
// import 'package:firebase_storage/firebase_storage.dart';
// import 'package:flutter/material.dart';
// import 'package:image_picker/image_picker.dart';
// import 'dart:io';
// class AddStudentPage extends StatefulWidget {
// final String classname;
// const AddStudentPage({required this.classname, Key? key}) : super(key: key);
// @override
// State<AddStudentPage> createState() => _AddStudentState();
// }
// class _AddStudentState extends State<AddStudentPage> {
// final ImagePicker _imagePicker = ImagePicker();
// XFile? _selectedImage;
// String? _selectedSex;
// // Controllers
// final TextEditingController _firstnameController = TextEditingController();
// final TextEditingController _lastnameController = TextEditingController();
// final TextEditingController _birthdayController = TextEditingController();
// final TextEditingController _doctornameController = TextEditingController();
// final TextEditingController _doctorphoneController = TextEditingController();
// final TextEditingController _allergiesController = TextEditingController();
// final TextEditingController _medicineController = TextEditingController();
// final TextEditingController _parentnameController = TextEditingController();
// final TextEditingController _parentphoneController = TextEditingController();
// final TextEditingController _parentemailController = TextEditingController();
// final TextEditingController _addressLine1Controller = TextEditingController();
// final TextEditingController _addressLine2Controller = TextEditingController();
// final TextEditingController _cityController = TextEditingController();
// final TextEditingController _zipController = TextEditingController();
// final TextEditingController _countryController = TextEditingController();
// final TextEditingController _stateController = TextEditingController();
// bool _specialNeedsYes = false;
// bool _specialNeedsNo = false;
// @override
// Widget build(BuildContext context) {
// return Scaffold(
// appBar: AppBar(
// leading: IconButton(
// icon: Icon(Icons.arrow_back),
// onPressed: () => Navigator.pop(context),
// ),
// title: Text('Add Kid'),
// centerTitle: true,
// ),
// body: SingleChildScrollView(
// child: SafeArea(
// child: Padding(
// padding: const EdgeInsets.all(16.0),
// child: Form(
// child: Column(
// children: [
// _buildImagePicker(),
// _buildSectionTitle('Bio'),
// _buildTextField(_firstnameController, 'First Name', Icons.person),
// _buildTextField(_lastnameController, 'Last Name', Icons.person),
// _buildTextField(_birthdayController, 'Birthday', Icons.cake),
// _buildDropdownButton(),
// _buildSectionTitle('Medicine'),
// _buildTextField(_doctornameController, 'Doctor Name', Icons.person),
// _buildTextField(_doctorphoneController, 'Doctor Phone Number', Icons.phone),
// _buildTextField(_allergiesController, 'Allergies', Icons.coronavirus_sharp),
// _buildTextField(_medicineController, 'Medicine', Icons.medication_outlined),
// _buildSpecialNeedsSection(),
// _buildSectionTitle('Contact'),
// _buildTextField(_parentnameController, 'Parent Name', Icons.person),
// _buildTextField(_parentphoneController, 'Parent Phone Number', Icons.phone),
// _buildTextField(_parentemailController, 'Parent Email', Icons.email),
// _buildSectionTitle('Address'),
// _buildTextField(_addressLine1Controller, 'Address Line 1', Icons.location_on_outlined),
// _buildTextField(_addressLine2Controller, 'Address Line 2', Icons.location_on_outlined),
// _buildTextField(_cityController, 'City', Icons.location_city_sharp),
// _buildTextField(_zipController, 'Zip/Postal Code', Icons.location_searching),
// _buildTextField(_countryController, 'Country', Icons.location_city_rounded),
// _buildTextField(_stateController, 'State/Region', Icons.location_city_sharp),
// _buildActionButtons(),
// ],
// ),
// ),
// ),
// ),
// ),
// );
// }
// Widget _buildImagePicker() {
// return GestureDetector(
// onTap: () async {
// XFile? image = await _imagePicker.pickImage(source: ImageSource.gallery, imageQuality: 50);
// setState(() => _selectedImage = image);
// },
// child: CircleAvatar(
// radius: 50.0,
// backgroundImage: _selectedImage != null ? FileImage(File(_selectedImage!.path)) : AssetImage('assets/classlogo.png') as ImageProvider,
// ),
// );
// }
// Widget _buildTextField(TextEditingController controller, String hintText, IconData icon) {
// return Padding(
// padding: const EdgeInsets.only(top: 20),
// child: TextField(
// controller: controller,
// decoration: InputDecoration(
// hintText: hintText,
// filled: true,
// fillColor: Color.fromARGB(107, 196, 196, 196),
// border: OutlineInputBorder(borderRadius: BorderRadius.circular(10.0), borderSide: BorderSide.none),
// suffixIcon: Icon(icon, size: 23.0, color: Color.fromARGB(132, 12, 12, 12)),
// ),
// ),
// );
// }
// Widget _buildDropdownButton() {
// return Padding(
// padding: const EdgeInsets.only(top: 20),
// child: DropdownButtonFormField<String>(
// value: _selectedSex,
// onChanged: (newValue) => setState(() => _selectedSex = newValue),
// items: <String>['Select', 'Male', 'Female'].map((String value) {
// return DropdownMenuItem<String>(
// value: value,
// child: Text(value),
// );
// }).toList(),
// decoration: InputDecoration(
// 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)),
// hintText: 'Select Gender',
// ),
// ),
// );
// }
// Widget _buildSpecialNeedsSection() {
// return Padding(
// padding: const EdgeInsets.only(top: 20),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.spaceBetween,
// children: [
// Expanded(child: Text('Special Needs Child', style: TextStyle(fontSize: 16.0, fontWeight: FontWeight.bold))),
// Text('Yes'),
// Checkbox(value: _specialNeedsYes, onChanged: (bool? value) => setState(() => _specialNeedsYes = value ?? false)),
// Text('No'),
// Checkbox(value: _specialNeedsNo, onChanged: (bool? value) => setState(() => _specialNeedsNo = value ?? false)),
// ],
// ),
// );
// }
// Widget _buildSectionTitle(String title) {
// return Padding(
// padding: const EdgeInsets.only(top: 30, bottom: 10),
// child: Row(
// children: [
// Expanded(
// child: Text(
// title,
// style: const TextStyle(fontSize: 18, fontWeight: FontWeight.bold, color: Color(0xFF22215B)),
// ),
// ),
// ],
// ),
// );
// }
// Widget _buildActionButtons() {
// return Padding(
// padding: const EdgeInsets.symmetric(vertical: 30),
// child: Row(
// mainAxisAlignment: MainAxisAlignment.center,
// children: [
// _buildActionButton('Save', Colors.green, _handleSave),
// SizedBox(width: 20),
// _buildActionButton('Cancel', Colors.grey.shade200, () => Navigator.pop(context)),
// ],
// ),
// );
// }
// Widget _buildActionButton(String title, Color color, VoidCallback onPressed) {
// return TextButton(
// onPressed: onPressed,
// style: TextButton.styleFrom(backgroundColor: color, padding: EdgeInsets.symmetric(horizontal: 30)),
// child: Text(
// title,
// style: TextStyle(color: Colors.white, fontSize: 14, fontFamily: 'Poppins', fontWeight: FontWeight.w600),
// ),
// );
// }
// Future<void> _handleSave() async {
// if (_selectedImage == null) {
// _showDialog('Error', 'Please select an image for the student');
// return;
// }
// try {
// // Upload image to Firebase Storage
// String imageName = DateTime.now().millisecondsSinceEpoch.toString();
// Reference storageRef = FirebaseStorage.instance.ref().child('student_images/$imageName');
// UploadTask uploadTask = storageRef.putFile(File(_selectedImage!.path));
// String imageUrl = await (await uploadTask).ref.getDownloadURL();
// // Save student details to Firestore
// FirebaseFirestore.instance.collection('students').add({
// 'Firstname': _firstnameController.text.trim(),
// 'Lastname': _lastnameController.text.trim(),
// 'Sex': _selectedSex,
// 'Birthday': _birthdayController.text.trim(),
// 'Doctorname': _doctornameController.text.trim(),
// 'Doctorphone': _doctorphoneController.text.trim(),
// 'Allergies': _allergiesController.text.trim(),
// 'Medicine': _medicineController.text.trim(),
// 'Parentname': _parentnameController.text.trim(),
// 'Parentphone': _parentphoneController.text.trim(),
// 'Parentemail': _parentemailController.text.trim(),
// 'AddressLine1': _addressLine1Controller.text.trim(),
// 'AddressLine2': _addressLine2Controller.text.trim(),
// 'City': _cityController.text.trim(),
// 'Zip': _zipController.text.trim(),
// 'Country': _countryController.text.trim(),
// 'State': _stateController.text.trim(),
// 'Image': imageUrl,
// 'ClassName': widget.classname,
// 'SpecialNeeds': _specialNeedsYes ? 'Yes' : 'No',
// 'UserId': FirebaseAuth.instance.currentUser?.uid ?? '',
// 'Timestamp': FieldValue.serverTimestamp(),
// });
// _showDialog('Success', 'Student details saved successfully', success: true);
// } catch (e) {
// _showDialog('Error', 'Failed to save student details');
// }
// }
// void _showDialog(String title, String desc, {bool success = false}) {
// AwesomeDialog(
// context: context,
// dialogType: success ? DialogType.success : DialogType.error,
// animType: AnimType.rightSlide,
// title: title,
// desc: desc,
// btnOkOnPress: () {},
// ).show();
// }
// }
......@@ -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
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:video_player/video_player.dart';
import 'package:chewie/chewie.dart';
import 'package:mobile_application_kids/games.dart';
void main() {
runApp(SongTalesApp());
}
class SongTalesApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: LevelScreen(),
);
}
}
class LevelButton extends StatelessWidget {
final String imagePath;
final String?
label; // Making label parameter optional by adding '?' after String
final VoidCallback onPressed;
const LevelButton({
required this.imagePath,
this.label, // Making label parameter optional
required this.onPressed,
});
@override
Widget build(BuildContext context) {
return ElevatedButton(
onPressed: onPressed,
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
elevation: 0,
padding: EdgeInsets.zero,
),
child: Column(
children: [
Image.asset(
imagePath,
width: 400,
height: 150,
),
SizedBox(height: 8),
if (label != null) // Only show label if it's not null
Text(
label!,
style: TextStyle(fontSize: 16, fontWeight: FontWeight.bold),
),
],
),
);
}
}
class LevelScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Song Tales'),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Expanded(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LevelButton(
imagePath: 'game_assets/slevel1_btn.png',
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Level1VideoScreen(),
),
);
},
),
SizedBox(height: 10),
LevelButton(
imagePath: 'game_assets/slevel2_btn.png',
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Level2VideoScreen(),
),
);
},
),
SizedBox(height: 10),
LevelButton(
imagePath: 'game_assets/slevel3_btn.png',
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Level3VideoScreen(),
),
);
},
),
],
),
),
),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => GamesPage(),
),
);
},
child: Text('Quit Game'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 231, 65, 43),
onPrimary: Colors.white,
),
),
SizedBox(height: 40),
],
),
);
}
}
class Level1VideoScreen extends StatefulWidget {
@override
_Level1VideoScreenState createState() => _Level1VideoScreenState();
}
class _Level1VideoScreenState extends State<Level1VideoScreen> {
late VideoPlayerController _controller;
late ChewieController _chewieController;
int correctAnswersCount = 0;
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
_controller = VideoPlayerController.asset('game_assets/Level1_song.mp4')
..initialize().then((_) {
setState(() {});
_controller.play();
});
_chewieController = ChewieController(
videoPlayerController: _controller,
autoPlay: true,
looping: false,
allowMuting: false,
allowPlaybackSpeedChanging: true,
allowFullScreen: false,
showControlsOnInitialize: false,
customControls: MaterialControls(),
// Enforcing landscape mode
aspectRatio: 16 / 9,
// Setting the orientation to landscape
deviceOrientationsAfterFullScreen: [
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: Center(
child: _controller.value.isInitialized
? Chewie(
controller: _chewieController,
)
: CircularProgressIndicator(),
),
),
ElevatedButton(
onPressed: () {
_controller.pause();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Level1QuestionScreen(
onCorrectAnswer: () {
correctAnswersCount++;
if (correctAnswersCount == 4) {
Navigator.pop(context); // Pop the QuestionScreen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ResultScreen(),
),
);
}
},
),
),
);
},
child: Text('Answer Question'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 48, 173, 26),
onPrimary: Colors.white,
),
),
],
),
);
}
@override
void dispose() {
_controller.pause(); // Pause the video before disposing
_controller.dispose();
_chewieController.dispose();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]); // Unlock orientation
super.dispose();
}
}
class Level1QuestionScreen extends StatefulWidget {
final VoidCallback onCorrectAnswer;
const Level1QuestionScreen({required this.onCorrectAnswer});
@override
_Level1QuestionScreenState createState() => _Level1QuestionScreenState();
}
class _Level1QuestionScreenState extends State<Level1QuestionScreen> {
late List<String> questions;
late Map<String, List<String>> questionImageMapping;
int currentQuestionIndex = 0;
late List<String> shuffledImages; // Add shuffled images list
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
questions = [
'Select the monkey',
'Select the giraffe',
'Select the lion',
'Select the elephant'
];
questionImageMapping = {
'Select the monkey': [
'monkey.png',
'giraffe.png',
'elephant.png',
'gorilla.png',
'koala.png',
'lion.png'
],
'Select the giraffe': [
'giraffe.png',
'lion.png',
'elephant.png',
'koala.png',
'gorilla.png',
'monkey.png'
],
'Select the lion': [
'lion.png',
'elephant.png',
'giraffe.png',
'koala.png',
'gorilla.png',
'monkey.png'
],
'Select the elephant': [
'elephant.png',
'monkey.png',
'gorilla.png',
'giraffe.png',
'koala.png',
'lion.png'
],
};
currentQuestionIndex = 0;
shuffledImages =
List.from(questionImageMapping[questions[currentQuestionIndex]]!)
..shuffle(); // Shuffle images for the first question
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Question Screen'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context); // Navigate back
},
),
),
body: OrientationBuilder(
builder: (context, orientation) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
return orientation == Orientation.landscape
? _buildLandscapeContent()
: _buildPortraitContent();
},
),
);
}
Widget _buildLandscapeContent() {
return Column(
children: [
Padding(
padding: const EdgeInsets.all(0.0),
child: Text(
questions[currentQuestionIndex],
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
),
Expanded(
child: GridView.count(
crossAxisCount: 3,
padding: EdgeInsets.all(20.0),
mainAxisSpacing: 20.0,
crossAxisSpacing: 2.0,
childAspectRatio: 2.5,
children: shuffledImages.map((imageName) {
return AnimalImage(
imageName: imageName,
correctAnswer: imageName ==
questionImageMapping[questions[currentQuestionIndex]]![0],
nextQuestion: moveToNextQuestion,
onCorrectAnswer: widget.onCorrectAnswer,
);
}).toList(),
),
),
],
);
}
Widget _buildPortraitContent() {
return Center(
child: Text(
'Please rotate your device to landscape mode.',
style: TextStyle(fontSize: 24.0),
),
);
}
void moveToNextQuestion() {
setState(() {
if (currentQuestionIndex < questions.length - 1) {
currentQuestionIndex++;
shuffledImages =
List.from(questionImageMapping[questions[currentQuestionIndex]]!)
..shuffle(); // Shuffle images for the next question
} else {
currentQuestionIndex = 0;
}
});
}
@override
void dispose() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
super.dispose();
}
}
class Level2VideoScreen extends StatefulWidget {
@override
_Level2VideoScreenState createState() => _Level2VideoScreenState();
}
class _Level2VideoScreenState extends State<Level2VideoScreen> {
late VideoPlayerController _controller;
late ChewieController _chewieController;
int correctAnswersCount = 0;
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
_controller = VideoPlayerController.asset('game_assets/Level2_song.mp4')
..initialize().then((_) {
setState(() {});
_controller.play();
});
_chewieController = ChewieController(
videoPlayerController: _controller,
autoPlay: true,
looping: false,
allowMuting: false,
allowPlaybackSpeedChanging: true,
allowFullScreen: false,
showControlsOnInitialize: false,
customControls: MaterialControls(),
// Enforcing landscape mode
aspectRatio: 16 / 9,
// Setting the orientation to landscape
deviceOrientationsAfterFullScreen: [
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: Center(
child: _controller.value.isInitialized
? Chewie(
controller: _chewieController,
)
: CircularProgressIndicator(),
),
),
ElevatedButton(
onPressed: () {
_controller.pause();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Level2QuestionScreen(
onCorrectAnswer: () {
correctAnswersCount++;
if (correctAnswersCount == 4) {
Navigator.pop(context); // Pop the QuestionScreen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ResultScreen(),
),
);
}
},
),
),
);
},
child: Text('Answer Question'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 48, 173, 26),
onPrimary: Colors.white,
),
),
],
),
);
}
@override
void dispose() {
_controller.pause(); // Pause the video before disposing
_controller.dispose();
_chewieController.dispose();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]); // Unlock orientation
super.dispose();
}
}
class Level2QuestionScreen extends StatefulWidget {
final VoidCallback onCorrectAnswer;
const Level2QuestionScreen({required this.onCorrectAnswer});
@override
_Level2QuestionScreenState createState() => _Level2QuestionScreenState();
}
class _Level2QuestionScreenState extends State<Level2QuestionScreen> {
late List<String> questions;
late Map<String, List<String>> questionImageMapping;
int currentQuestionIndex = 0;
late List<String> shuffledImages; // Add shuffled images list
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
questions = [
'Select the books',
'Select the eraser',
'Select the pen',
'Select the glue'
];
questionImageMapping = {
'Select the books': [
'books.png',
'eraser.png',
'pen.png',
'glue.png',
'scissors.png',
'highlighter.png'
],
'Select the eraser': [
'eraser.png',
'pen.png',
'glue.png',
'scissors.png',
'highlighter.png',
'books.png'
],
'Select the pen': [
'pen.png',
'glue.png',
'scissors.png',
'highlighter.png',
'books.png',
'eraser.png'
],
'Select the glue': [
'glue.png',
'scissors.png',
'highlighter.png',
'books.png',
'eraser.png',
'pen.png'
],
};
currentQuestionIndex = 0;
shuffledImages =
List.from(questionImageMapping[questions[currentQuestionIndex]]!)
..shuffle(); // Shuffle images for the first question
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Question Screen'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context); // Navigate back
},
),
),
body: OrientationBuilder(
builder: (context, orientation) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
return orientation == Orientation.landscape
? _buildLandscapeContent()
: _buildPortraitContent();
},
),
);
}
Widget _buildLandscapeContent() {
return Column(
children: [
Padding(
padding: const EdgeInsets.all(0.0),
child: Text(
questions[currentQuestionIndex],
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
),
Expanded(
child: GridView.count(
crossAxisCount: 3,
padding: EdgeInsets.all(20.0),
mainAxisSpacing: 20.0,
crossAxisSpacing: 2.0,
childAspectRatio: 2.5,
children: shuffledImages.map((imageName) {
return AnimalImage(
imageName: imageName,
correctAnswer: imageName ==
questionImageMapping[questions[currentQuestionIndex]]![0],
nextQuestion: moveToNextQuestion,
onCorrectAnswer: widget.onCorrectAnswer,
);
}).toList(),
),
),
],
);
}
Widget _buildPortraitContent() {
return Center(
child: Text(
'Please rotate your device to landscape mode.',
style: TextStyle(fontSize: 24.0),
),
);
}
void moveToNextQuestion() {
setState(() {
if (currentQuestionIndex < questions.length - 1) {
currentQuestionIndex++;
shuffledImages =
List.from(questionImageMapping[questions[currentQuestionIndex]]!)
..shuffle(); // Shuffle images for the next question
} else {
currentQuestionIndex = 0;
}
});
}
@override
void dispose() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
super.dispose();
}
}
class Level3VideoScreen extends StatefulWidget {
@override
_Level3VideoScreenState createState() => _Level3VideoScreenState();
}
class _Level3VideoScreenState extends State<Level3VideoScreen> {
late VideoPlayerController _controller;
late ChewieController _chewieController;
int correctAnswersCount = 0;
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
_controller = VideoPlayerController.asset('game_assets/Level3_song.mp4')
..initialize().then((_) {
setState(() {});
_controller.play();
});
_chewieController = ChewieController(
videoPlayerController: _controller,
autoPlay: true,
looping: false,
allowMuting: false,
allowPlaybackSpeedChanging: true,
allowFullScreen: false,
showControlsOnInitialize: false,
customControls: MaterialControls(),
// Enforcing landscape mode
aspectRatio: 16 / 9,
// Setting the orientation to landscape
deviceOrientationsAfterFullScreen: [
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: Center(
child: _controller.value.isInitialized
? Chewie(
controller: _chewieController,
)
: CircularProgressIndicator(),
),
),
ElevatedButton(
onPressed: () {
_controller.pause();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Level3QuestionScreen(
onCorrectAnswer: () {
correctAnswersCount++;
if (correctAnswersCount == 4) {
Navigator.pop(context); // Pop the QuestionScreen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ResultScreen(),
),
);
}
},
),
),
);
},
child: Text('Answer Question'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 48, 173, 26),
onPrimary: Colors.white,
),
),
],
),
);
}
@override
void dispose() {
_controller.pause(); // Pause the video before disposing
_controller.dispose();
_chewieController.dispose();
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]); // Unlock orientation
super.dispose();
}
}
class Level3QuestionScreen extends StatefulWidget {
final VoidCallback onCorrectAnswer;
const Level3QuestionScreen({required this.onCorrectAnswer});
@override
_Level3QuestionScreenState createState() => _Level3QuestionScreenState();
}
class _Level3QuestionScreenState extends State<Level3QuestionScreen> {
late Map<String, List<String>> questionImageMap;
late List<String> questions;
int currentQuestionIndex = 0;
late List<String> shuffledImages; // Add shuffled images list
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
questionImageMap = {
'Select the heart': [
'heart.png',
'square.png',
'diamond.png',
'circle.png',
'star.png',
'triangle.png'
],
'Select the Square': [
'square.png',
'diamond.png',
'triangle.png',
'heart.png',
'star.png',
'circle.png'
],
'Select the Circle': [
'circle.png',
'heart.png',
'triangle.png',
'square.png',
'star.png',
'diamond.png'
],
'Select the Diamond': [
'diamond.png',
'triangle.png',
'square.png',
'star.png',
'heart.png',
'circle.png'
],
};
questions = questionImageMap.keys.toList();
currentQuestionIndex = 0;
shuffledImages =
List.from(questionImageMap[questions[currentQuestionIndex]]!)
..shuffle(); // Shuffle images for the first question
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Question Screen'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pop(context); // Navigate back
},
),
),
body: OrientationBuilder(
builder: (context, orientation) {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
return orientation == Orientation.landscape
? _buildLandscapeContent()
: _buildPortraitContent();
},
),
);
}
Widget _buildLandscapeContent() {
return Column(
children: [
Padding(
padding: const EdgeInsets.all(0.0),
child: Text(
questions[currentQuestionIndex],
style: TextStyle(
fontSize: 25.0,
fontWeight: FontWeight.bold,
),
),
),
Expanded(
child: GridView.count(
crossAxisCount: 3,
padding: EdgeInsets.all(20.0),
mainAxisSpacing: 20.0,
crossAxisSpacing: 2.0,
childAspectRatio: 2.5,
children: shuffledImages.map((imageName) {
return AnimalImage(
imageName: imageName,
correctAnswer: imageName ==
questionImageMap[questions[currentQuestionIndex]]![0],
nextQuestion: moveToNextQuestion,
onCorrectAnswer: widget.onCorrectAnswer,
);
}).toList(),
),
),
],
);
}
Widget _buildPortraitContent() {
return Center(
child: Text(
'Please rotate your device to landscape mode.',
style: TextStyle(fontSize: 24.0),
),
);
}
void moveToNextQuestion() {
setState(() {
if (currentQuestionIndex < questions.length - 1) {
currentQuestionIndex++;
shuffledImages =
List.from(questionImageMap[questions[currentQuestionIndex]]!)
..shuffle(); // Shuffle images for the next question
} else {
currentQuestionIndex = 0;
}
});
}
@override
void dispose() {
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
super.dispose();
}
}
class AnimalImage extends StatelessWidget {
final String imageName;
final bool correctAnswer;
final Function nextQuestion;
final VoidCallback onCorrectAnswer;
const AnimalImage({
Key? key,
required this.imageName,
required this.correctAnswer,
required this.nextQuestion,
required this.onCorrectAnswer,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
showDialog(
context: context,
builder: (BuildContext context) {
return AlertDialog(
title: Text('Result'),
content: Text(
correctAnswer ? 'You are correct!' : 'Try again.',
),
actions: <Widget>[
TextButton(
onPressed: () {
Navigator.of(context).pop();
if (correctAnswer) {
nextQuestion();
onCorrectAnswer(); // Notify parent about correct answer
}
},
child: Text('OK'),
),
],
);
},
);
},
child: Container(
margin: EdgeInsets.all(8.0),
child: Image.asset(
'game_assets/$imageName',
width: 80.0,
height: 80.0,
),
),
);
}
}
class ResultScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Result Screen'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.popUntil(
context,
ModalRoute.withName(Navigator.defaultRouteName),
);
},
),
),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Center(
child: Padding(
padding:
EdgeInsets.only(top: 0.0), // Adjust the top padding as needed
child: Image.asset(
'game_assets/result.gif',
width: 500, // Adjust the width as needed
height: 250, // Adjust the height as needed
),
),
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:video_player/video_player.dart';
import 'package:chewie/chewie.dart';
import 'level2.dart';
import 'level3.dart';
import 'package:mobile_application_kids/games.dart';
void main() {
runApp(EmoXApp());
}
class EmoXApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: "Emotion Matching Game",
home: LevelScreen(),
);
}
}
class LevelScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('EmoX Game'),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Level1VideoScreen()),
);
},
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
elevation: 0,
),
child: Image.asset(
'game_assets/btn_level1.png',
width: 350,
height: 160,
),
),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Level2VideoScreen()),
);
},
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
elevation: 0,
),
child: Image.asset(
'game_assets/btn_level2.png',
width: 350,
height: 160,
),
),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => Level3()),
);
},
style: ElevatedButton.styleFrom(
primary: Colors.transparent,
elevation: 0,
),
child: Image.asset(
'game_assets/btn_level3.png',
width: 350,
height: 160,
),
),
SizedBox(height: 60),
ElevatedButton(
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => GamesPage()),
);
},
child: Text('Quit Game'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 231, 65, 43),
onPrimary: Colors.white,
),
),
SizedBox(height: 20),
],
),
),
);
}
}
class Level1VideoScreen extends StatefulWidget {
@override
_Level1VideoScreenState createState() => _Level1VideoScreenState();
}
class _Level1VideoScreenState extends State<Level1VideoScreen> {
late VideoPlayerController _controller;
late ChewieController _chewieController;
int correctAnswersCount = 0;
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
_controller = VideoPlayerController.asset('game_assets/EmoX_level1.mp4')
..initialize().then((_) {
setState(() {});
_controller.play();
});
_chewieController = ChewieController(
videoPlayerController: _controller,
autoPlay: true,
looping: false,
allowMuting: false,
allowPlaybackSpeedChanging: true,
allowFullScreen: false,
showControlsOnInitialize: false,
customControls: MaterialControls(),
// Enforcing landscape mode
aspectRatio: 16 / 9,
// Setting the orientation to landscape
deviceOrientationsAfterFullScreen: [
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: Center(
child: _controller.value.isInitialized
? Chewie(
controller: _chewieController,
)
: CircularProgressIndicator(),
),
),
ElevatedButton(
onPressed: () {
_controller.pause();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => HomePage(level: 1),
),
);
},
child: Text('Play'),
),
],
),
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
_chewieController.dispose();
}
}
class Level2VideoScreen extends StatefulWidget {
@override
_Level2VideoScreenState createState() => _Level2VideoScreenState();
}
class _Level2VideoScreenState extends State<Level2VideoScreen> {
late VideoPlayerController _controller;
late ChewieController _chewieController;
int correctAnswersCount = 0;
@override
void initState() {
super.initState();
SystemChrome.setPreferredOrientations([
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
]); // Lock orientation to landscape
_controller = VideoPlayerController.asset('game_assets/EmoX_level2.mp4')
..initialize().then((_) {
setState(() {});
_controller.play();
});
_chewieController = ChewieController(
videoPlayerController: _controller,
autoPlay: true,
looping: false,
allowMuting: false,
allowPlaybackSpeedChanging: true,
allowFullScreen: false,
showControlsOnInitialize: false,
customControls: MaterialControls(),
// Enforcing landscape mode
aspectRatio: 16 / 9,
// Setting the orientation to landscape
deviceOrientationsAfterFullScreen: [
DeviceOrientation.landscapeLeft,
DeviceOrientation.landscapeRight,
],
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: Center(
child: _controller.value.isInitialized
? Chewie(
controller: _chewieController,
)
: CircularProgressIndicator(),
),
),
ElevatedButton(
onPressed: () {
_controller.pause();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => EmotionGame(),
),
);
},
child: Text('Play'),
),
],
),
);
}
@override
void dispose() {
super.dispose();
_controller.dispose();
_chewieController.dispose();
}
}
class HomePage extends StatefulWidget {
final int level;
HomePage({required this.level});
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
late List<ItemModel> items;
late List<ItemModel> items2;
late int score;
late bool gameOver;
@override
void initState() {
super.initState();
initGame();
// Set preferred orientations to portrait mode
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
}
initGame() {
gameOver = false;
score = 0;
items = [
ItemModel(
name: "Happy",
value: "happy",
imagePath: "game_assets/happy.png",
),
ItemModel(
name: "Sad",
value: "sad",
imagePath: "game_assets/sad.png",
),
ItemModel(
name: "Angry",
value: "angry",
imagePath: "game_assets/angry.png",
),
ItemModel(
name: "Sleepy",
value: "sleepy",
imagePath: "game_assets/sleepy.png",
),
ItemModel(
name: "Surprised",
value: "surprised",
imagePath: "game_assets/surprised.png",
),
];
items2 = List<ItemModel>.from(items);
items.shuffle();
items2.shuffle();
}
@override
Widget build(BuildContext context) {
if (items.length == 0) gameOver = true;
return Scaffold(
backgroundColor: const Color.fromARGB(255, 233, 218, 176),
appBar: AppBar(
centerTitle: true,
title: Text('Mood Matching Game'),
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
child: Column(
children: <Widget>[
Text.rich(TextSpan(children: [
TextSpan(text: "Score: "),
TextSpan(
text: "$score",
style: TextStyle(
color: Colors.green,
fontWeight: FontWeight.bold,
fontSize: 30.0,
))
])),
if (!gameOver)
Row(
children: <Widget>[
Column(
children: items.map((item) {
return Container(
margin: const EdgeInsets.all(8.0),
child: Draggable<ItemModel>(
data: item,
childWhenDragging: Image.asset(
item.imagePath,
width: 90.0,
height: 90.0,
),
feedback: Image.asset(
item.imagePath,
width: 90.0,
height: 90.0,
),
child: Image.asset(
item.imagePath,
width: 90.0,
height: 90.0,
),
),
);
}).toList()),
Spacer(),
Column(
children: items2.map((item) {
return DragTarget<ItemModel>(
onAccept: (receivedItem) {
if (item.value == receivedItem.value) {
setState(() {
items.remove(receivedItem);
items2.remove(item);
score += 10;
item.accepting = false;
});
} else {
setState(() {
score -= 5;
item.accepting = false;
});
}
},
onLeave: (receivedItem) {
setState(() {
item.accepting = false;
});
},
onWillAccept: (receivedItem) {
setState(() {
item.accepting = true;
});
return true;
},
builder: (context, acceptedItems, rejectedItem) =>
Container(
color: item.accepting ? Colors.red : Colors.teal,
height: 50,
width: 100,
alignment: Alignment.center,
margin: const EdgeInsets.all(28.0),
child: Text(
item.name,
style: TextStyle(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18.0,
),
),
),
);
}).toList()),
],
),
if (gameOver)
Text(
"Game Over!",
style: TextStyle(
color: const Color.fromARGB(255, 164, 70, 63),
fontWeight: FontWeight.bold,
fontSize: 24.0,
),
),
if (gameOver)
SizedBox(
width: double.infinity,
child: Container(
margin:
EdgeInsets.only(top: 40.0), // Adjust top margin as needed
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
ElevatedButton(
onPressed: () {
initGame();
setState(() {});
},
child: Text("New Game"),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 22, 167, 42),
onPrimary: Colors.white,
),
),
SizedBox(
height: 10), // Add space between buttons if needed
ElevatedButton(
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => LevelScreen(),
),
);
},
child: Text("Quit Game"),
style: ElevatedButton.styleFrom(
primary: Colors.red,
onPrimary: Colors.white,
),
),
],
),
),
),
],
),
),
);
}
}
class ItemModel {
final String name;
final String value;
final String imagePath;
bool accepting;
ItemModel(
{required this.name,
required this.value,
required this.imagePath,
this.accepting = false});
}
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
import 'package:flutter/material.dart';
import 'package:video_player/video_player.dart';
import 'package:chewie/chewie.dart';
import 'package:mobile_application_kids/games.dart';
void main() {
runApp(PosturePro());
}
class PosturePro extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: LevelScreen(),
);
}
}
class LevelScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Select Level'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: Center(
child: Text(
"Let's get started!",
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold),
),
),
),
Expanded(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
LevelButton(
imagePath: 'game_assets/level1_button.png',
level: 1,
),
SizedBox(height: 10), // Adjusted height between buttons
LevelButton(
imagePath: 'game_assets/level2_button.png',
level: 2,
),
SizedBox(height: 10), // Adjusted height between buttons
LevelButton(
imagePath: 'game_assets/level3_button.png',
level: 3,
),
],
),
),
),
SizedBox(height: 20),
// Add some spacing between the buttons and the quit button
ElevatedButton(
onPressed: () {
// Navigate back to the GamesSelectionScreen when the quit button is pressed
Navigator.push(
context,
MaterialPageRoute(builder: (context) => GamesPage()),
);
},
child: Text('Quit Game'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 231, 65, 43),
onPrimary: Colors.white,
),
),
SizedBox(height: 40),
],
),
);
}
}
class LevelButton extends StatelessWidget {
final String imagePath;
final int level;
const LevelButton({
required this.imagePath,
required this.level,
});
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: () {
// Navigate to the selected level screen
Navigator.push(
context,
MaterialPageRoute(builder: (context) => getLevelScreen(level)),
);
},
child: Image.asset(
imagePath,
width: 500,
height: 160,
// You may adjust the width and height as needed
),
);
}
Widget getLevelScreen(int level) {
switch (level) {
case 1:
return Level1Screen(level: level);
case 2:
return Level2Screen(level: level);
case 3:
return Level3Screen(
level: level); // Changed to Level3Screen for level 3
default:
return Container(); // Return empty container for unknown level
}
}
}
class Level1Screen extends StatelessWidget {
final int level;
const Level1Screen({required this.level});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Level $level'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(20.0),
child: Text(
'Exercises List',
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 16.0),
child: ListView(
children: [
Padding(
padding: const EdgeInsets.only(
bottom: 20.0), // Adjust the bottom padding as needed
child: Image.asset('game_assets/Exercise_list.png'),
),
],
),
),
),
ElevatedButton(
onPressed: () {
// Navigate to the exercise screen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => ExerciseScreen(level: level)),
);
},
child: Text('Start'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 43, 159, 231),
onPrimary: Colors.white,
),
),
SizedBox(height: 50),
],
),
);
}
}
class ExerciseScreen extends StatefulWidget {
final int level;
const ExerciseScreen({required this.level});
@override
_ExerciseScreenState createState() => _ExerciseScreenState();
}
class _ExerciseScreenState extends State<ExerciseScreen> {
late VideoPlayerController _videoPlayerController;
late ChewieController _chewieController;
@override
void initState() {
super.initState();
_videoPlayerController =
VideoPlayerController.asset('game_assets/level1_vid.mp4');
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController,
autoPlay: true,
looping: true,
allowFullScreen: false,
allowMuting: true,
aspectRatio: 16 / 11,
);
}
@override
void dispose() {
_videoPlayerController.pause();
_videoPlayerController.dispose();
_chewieController.dispose();
super.dispose();
}
void pauseVideo() {
if (_videoPlayerController.value.isPlaying) {
_videoPlayerController.pause();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Level ${widget.level} - Exercises'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AspectRatio(
aspectRatio: 16 / 11,
child: Chewie(
controller: _chewieController,
),
),
SizedBox(height: 20),
Image.asset('game_assets/ex1_det.png'),
SizedBox(height: 30),
ElevatedButton(
onPressed: () {
pauseVideo();
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ResultScreen()),
);
},
child: Text('Finish Exercise'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 48, 173, 26),
onPrimary: Colors.white,
),
),
],
),
);
}
}
class ResultScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Exercise Result'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => LevelScreen()),
);
},
),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 0),
Image.asset(
'game_assets/result1.png',
height: 650,
width: 500, // Adjust the height of the image as needed
),
SizedBox(height: 20),
],
),
);
}
}
class Level2Screen extends StatelessWidget {
final int level;
const Level2Screen({required this.level});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Level $level'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(20.0),
child: Text(
'Behavior List',
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: ListView(
children: [
Image.asset(
'game_assets/Behavior_list.png'), // Use Behavior_list.png for Level 2
],
),
),
),
ElevatedButton(
onPressed: () {
// Navigate to the exercise screen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Level2VideoScreen(level: level)),
);
},
child: Text('Start'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 43, 159, 231),
onPrimary: Colors.white,
),
),
SizedBox(height: 50),
],
),
);
}
}
class Level2VideoScreen extends StatefulWidget {
final int level;
const Level2VideoScreen({required this.level});
@override
_Level2VideoScreenState createState() => _Level2VideoScreenState();
}
class _Level2VideoScreenState extends State<Level2VideoScreen> {
late VideoPlayerController _videoPlayerController;
late ChewieController _chewieController;
@override
void initState() {
super.initState();
_videoPlayerController =
VideoPlayerController.asset('game_assets/level2_vid.mp4');
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController,
autoPlay: true,
looping: true,
allowFullScreen: false,
allowMuting: true,
aspectRatio: 16 / 11,
);
}
@override
void dispose() {
_videoPlayerController.pause();
_videoPlayerController.dispose();
_chewieController.dispose();
super.dispose();
}
void pauseVideo() {
if (_videoPlayerController.value.isPlaying) {
_videoPlayerController.pause();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Level ${widget.level} Video'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AspectRatio(
aspectRatio: 16 / 11,
child: Chewie(
controller: _chewieController,
),
),
SizedBox(height: 20),
Image.asset('game_assets/ex2_det.png'),
SizedBox(height: 40),
ElevatedButton(
onPressed: () {
pauseVideo();
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ResultScreen()),
);
},
child: Text('End Watching'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 48, 173, 26),
onPrimary: Colors.white,
),
),
],
),
);
}
}
class Level3Screen extends StatelessWidget {
final int level;
const Level3Screen({required this.level});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Level $level'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: EdgeInsets.all(16.0),
child: Text(
'Activity List', // Change to Activity List for Level 3
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold),
),
),
Expanded(
child: Padding(
padding: const EdgeInsets.symmetric(horizontal: 20.0),
child: ListView(
children: [
Image.asset(
'game_assets/Activity_list.png'), // Use Activity_list.png for Level 3
],
),
),
),
ElevatedButton(
onPressed: () {
// Navigate to the exercise screen
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => Level3VideoScreen(level: level)),
);
},
child: Text('Start'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 43, 159, 231),
onPrimary: Colors.white,
),
),
SizedBox(height: 50),
],
),
);
}
}
class Level3VideoScreen extends StatefulWidget {
final int level;
const Level3VideoScreen({required this.level});
@override
_Level3VideoScreenState createState() => _Level3VideoScreenState();
}
class _Level3VideoScreenState extends State<Level3VideoScreen> {
late VideoPlayerController _videoPlayerController;
late ChewieController _chewieController;
@override
void initState() {
super.initState();
_videoPlayerController =
VideoPlayerController.asset('game_assets/level3_vid.mp4');
_chewieController = ChewieController(
videoPlayerController: _videoPlayerController,
autoPlay: true,
looping: true,
allowFullScreen: false,
allowMuting: true,
aspectRatio: 16 / 11,
);
}
@override
void dispose() {
_videoPlayerController.pause();
_videoPlayerController.dispose();
_chewieController.dispose();
super.dispose();
}
void pauseVideo() {
if (_videoPlayerController.value.isPlaying) {
_videoPlayerController.pause();
}
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Level ${widget.level} Video'),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
AspectRatio(
aspectRatio: 16 / 11,
child: Chewie(
controller: _chewieController,
),
),
SizedBox(height: 20),
Image.asset('game_assets/ex3_det.png'),
SizedBox(height: 20),
ElevatedButton(
onPressed: () {
pauseVideo();
Navigator.push(
context,
MaterialPageRoute(builder: (context) => ResultScreen()),
);
},
child: Text('End Watching'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 48, 173, 26),
onPrimary: Colors.white,
),
),
],
),
);
}
}
class Level3ResultScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Exercise Result'),
leading: IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => LevelScreen()),
);
},
),
),
body: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
SizedBox(height: 0),
Image.asset(
'game_assets/result3.png', // Change to result3.png for Level 3
height: 650,
width: 500, // Adjust the height of the image as needed
),
SizedBox(height: 20),
],
),
);
}
}
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;
}
},
),
......
......@@ -32,7 +32,23 @@ class _ParentSignupPageState extends State<ParentSignupPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Parent Signup'),
title: Text(' '),
actions: [
Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 16),
child: Text('Parent Register',
style: TextStyle(
color: Color(0xFF554994),
fontSize: 24,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
height: 0.04,
letterSpacing: -0.96,
),
),
),
],
),
body: SingleChildScrollView(
child: Column(
......@@ -73,15 +89,39 @@ class _ParentSignupPageState extends State<ParentSignupPage> {
obscureText: true,
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Logic to navigate to the next page with additional information
Center(
child: ElevatedButton(
onPressed: () {
// Logic to navigate to the next page with additional information
signUp(emailController.text, passwordController.text, 'parent', context);
},
style: ElevatedButton.styleFrom(
primary: Colors.blueAccent, // Note: 'const' was removed for consistency
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
),
child: Padding(
padding: EdgeInsets.all(12.0), // Note: 'const' was removed for consistency
child: Text(
'Finish',
style: TextStyle(
color: Color.fromARGB(255, 255, 255, 255), // Note: 'const' was removed for consistency
),
),
),
),
)
signUp(emailController.text, passwordController.text,
'parent', context);
},
child: Text('Finish'),
),
// ElevatedButton(
// onPressed: () {
// // Logic to navigate to the next page with additional information
// signUp(emailController.text, passwordController.text,
// 'parent', context);
// },
// child: Text('Finish'),
// ),
],
),
),
......
......@@ -148,6 +148,7 @@ class TeacherHomePage extends StatelessWidget {
itemBuilder: (context, index) {
var document = snapshot.data!.docs[index];
var className = document['className'];
print(document);
return Padding(
padding: const EdgeInsets.only(
......@@ -173,7 +174,7 @@ class TeacherHomePage extends StatelessWidget {
Row(
children: [
Text(
'Class $index',
'Class ${index + 1}',
style: poppinsTextStyle.copyWith(
fontSize: 14.0),
),
......
......@@ -30,7 +30,23 @@ class _TeacherSignupPageState extends State<TeacherSignupPage> {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Teacher Signup'),
title: Text(' '),
actions: [
Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 16),
child: Text('Teacher Register',
style: TextStyle(
color: Color(0xFF554994),
fontSize: 24,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
height: 0.04,
letterSpacing: -0.96,
),
),
),
],
),
body: SingleChildScrollView(
child: Column(
......@@ -71,7 +87,8 @@ class _TeacherSignupPageState extends State<TeacherSignupPage> {
obscureText: true,
),
const SizedBox(height: 20),
ElevatedButton(
Center(
child:ElevatedButton(
onPressed: () {
// Logic to navigate to the next page with additional information
Navigator.push(
......@@ -87,8 +104,22 @@ class _TeacherSignupPageState extends State<TeacherSignupPage> {
),
);
},
child: Text('Next'),
),
style: ElevatedButton.styleFrom(
primary: Colors.blueAccent, // Green background color
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), // Rounded corners
),
padding: EdgeInsets.all(12.0), // Padding inside the button
minimumSize: Size(140, 50), // Set the minimum width and height of the button
),
child: Text(
'Next',
style: TextStyle(
color: Color.fromARGB(255, 255, 255, 255), // White text color
),
),
),),
],
),
),
......@@ -157,7 +188,23 @@ class AdditionalInfoPage extends StatelessWidget {
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Additional Information'),
title: Text(' '),
actions: [
Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 16),
child: Text('Additional Information',
style: TextStyle(
color: Color(0xFF554994),
fontSize: 24,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
height: 0.04,
letterSpacing: -0.96,
),
),
),
],
),
body: SingleChildScrollView(
padding: const EdgeInsets.all(16.0),
......@@ -200,20 +247,40 @@ class AdditionalInfoPage extends StatelessWidget {
// },
// ),
Text(
'By checking the box you agree to our Terms and Conditions.',
'By finishing the form you agree to our Terms and Conditions.',
style: TextStyle(fontSize: 12),
),
],
),
const SizedBox(height: 20),
ElevatedButton(
onPressed: () {
// Logic to finish the teacher registration
signUp(emailController.text, passwordController.text, rool,
context);
},
child: Text('Finish'),
),
const SizedBox(height: 12),
Align(
alignment: Alignment.center, // Align the button to the right
child: Container(
height: 48.0, // Reduced height
child: ElevatedButton(
onPressed: () {
// Logic to finish the teacher registration
signUp(emailController.text, passwordController.text, rool, context);
},
style: ElevatedButton.styleFrom(
primary: Colors.blueAccent, // Green background color
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0), // Rounded corners
),
padding: EdgeInsets.symmetric(horizontal: 10.0), // Reduced padding
minimumSize: Size(140, 50), // Set the minimum width and height of the button
),
child: Text(
'Finish',
style: TextStyle(
color: Color.fromARGB(255, 255, 255, 255), // White text color
fontSize: 14, // Reduced font size to accommodate the reduced button height
),
),
),
),
)
],
),
),
......
......@@ -10,11 +10,13 @@ import file_selector_macos
import firebase_auth
import firebase_core
import firebase_storage
import package_info_plus
import path_provider_foundation
import rive_common
import shared_preferences_foundation
import sqflite
import url_launcher_macos
import wakelock_plus
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
......@@ -22,9 +24,11 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
}
......@@ -9,6 +9,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.16"
args:
dependency: transitive
description:
name: args
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
url: "https://pub.dev"
source: hosted
version: "2.4.2"
async:
dependency: transitive
description:
......@@ -57,6 +65,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.1.1"
carousel_slider:
dependency: "direct main"
description:
name: carousel_slider
sha256: "9c695cc963bf1d04a47bd6021f68befce8970bcd61d24938e1fb0918cf5d9c42"
url: "https://pub.dev"
source: hosted
version: "4.2.1"
characters:
dependency: transitive
description:
......@@ -81,6 +97,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.12.0"
chewie:
dependency: "direct main"
description:
name: chewie
sha256: "8bc4ac4cf3f316e50a25958c0f5eb9bb12cf7e8308bb1d74a43b230da2cfc144"
url: "https://pub.dev"
source: hosted
version: "1.7.5"
clock:
dependency: transitive
description:
......@@ -121,6 +145,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.17.1"
confetti:
dependency: "direct main"
description:
name: confetti
sha256: "979aafde2428c53947892c95eb244466c109c129b7eee9011f0a66caaca52267"
url: "https://pub.dev"
source: hosted
version: "0.7.0"
cross_file:
dependency: transitive
description:
......@@ -153,6 +185,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.6"
dbus:
dependency: transitive
description:
name: dbus
sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
fake_async:
dependency: transitive
description:
......@@ -417,7 +457,7 @@ packages:
source: hosted
version: "0.2.1+1"
intl:
dependency: transitive
dependency: "direct main"
description:
name: intl
sha256: "910f85bce16fb5c6f614e117efa303e85a1731bb0081edf3604a2ae6e9a3cc91"
......@@ -480,6 +520,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
nested:
dependency: transitive
description:
name: nested
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
octo_image:
dependency: transitive
description:
......@@ -488,6 +536,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.0"
package_info_plus:
dependency: transitive
description:
name: package_info_plus
sha256: "7e76fad405b3e4016cd39d08f455a4eb5199723cf594cd1b8916d47140d93017"
url: "https://pub.dev"
source: hosted
version: "4.2.0"
package_info_plus_platform_interface:
dependency: transitive
description:
name: package_info_plus_platform_interface
sha256: "9bc8ba46813a4cc42c66ab781470711781940780fd8beddd0c3da62506d3a6c6"
url: "https://pub.dev"
source: hosted
version: "2.0.1"
path:
dependency: transitive
description:
......@@ -544,6 +608,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.2.1"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
url: "https://pub.dev"
source: hosted
version: "5.4.0"
pie_chart:
dependency: "direct main"
description:
......@@ -568,6 +640,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.1.7"
provider:
dependency: transitive
description:
name: provider
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
url: "https://pub.dev"
source: hosted
version: "6.1.2"
rive:
dependency: transitive
description:
......@@ -877,6 +957,22 @@ packages:
url: "https://pub.dev"
source: hosted
version: "2.0.17"
wakelock_plus:
dependency: transitive
description:
name: wakelock_plus
sha256: f268ca2116db22e57577fb99d52515a24bdc1d570f12ac18bb762361d43b043d
url: "https://pub.dev"
source: hosted
version: "1.1.4"
wakelock_plus_platform_interface:
dependency: transitive
description:
name: wakelock_plus_platform_interface
sha256: "40fabed5da06caff0796dc638e1f07ee395fb18801fbff3255a2372db2d80385"
url: "https://pub.dev"
source: hosted
version: "1.1.0"
win32:
dependency: transitive
description:
......@@ -893,6 +989,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.4"
xml:
dependency: transitive
description:
name: xml
sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84"
url: "https://pub.dev"
source: hosted
version: "6.3.0"
sdks:
dart: ">=3.0.1 <4.0.0"
flutter: ">=3.10.0"
......@@ -47,7 +47,12 @@ dependencies:
url_launcher: ^6.1.14
cached_network_image: ^3.3.1
charts_flutter: ^0.12.0
table_calendar: ^3.0.8
table_calendar: ^3.0.3
carousel_slider: ^4.0.0
intl: ^0.17.0
confetti: ^0.7.0
chewie: ^1.0.0
dev_dependencies:
......@@ -98,7 +103,80 @@ flutter:
- lib/assets/ac5.png
- lib/assets/banner.png
- lib/assets/ac6.png
- lib/assets/ac7.png
- lib/assets/ac7.png
- lib/assets/parentprofile.JPG
- lib/assets/parentprof.PNG
- lib/assets/teacherprof.png
- lib/assets/I.png
- lib/assets/i2.png
- lib/assets/act_photo.png
- game_assets/monkey.png
- game_assets/elephant.png
- game_assets/giraffe.png
- game_assets/gorilla.png
- game_assets/lion.png
- game_assets/koala.png
- game_assets/Level1_song.mp4
- game_assets/Level2_song.mp4
- game_assets/pen.png
- game_assets/pencil.png
- game_assets/scissors.png
- game_assets/books.png
- game_assets/eraser.png
- game_assets/glue.png
- game_assets/highlighter.png
- game_assets/Level3_song.mp4
- game_assets/star.png
- game_assets/circle.png
- game_assets/square.png
- game_assets/diamond.png
- game_assets/triangle.png
- game_assets/heart.png
- game_assets/angry.png
- game_assets/sad.png
- game_assets/happy.png
- game_assets/sleepy.png
- game_assets/surprised.png
- game_assets/EmoX_level1.mp4
- game_assets/EmoX_level2.mp4
- game_assets/gangry.png
- game_assets/gsad.png
- game_assets/ghappy.png
- game_assets/gsurprised.png
- game_assets/gconfused.png
- game_assets/grey.png
- game_assets/human_without_face.png
- game_assets/sad.gif
- game_assets/laugh.gif
- game_assets/fear.gif
- game_assets/anger.gif
- game_assets/result.gif
- game_assets/disgust.gif
- game_assets/surprise.gif
- game_assets/level1_vid.mp4
- game_assets/level2_vid.mp4
- game_assets/level3_vid.mp4
- game_assets/level1_button.png
- game_assets/level2_button.png
- game_assets/level3_button.png
- game_assets/Exercise_list.png
- game_assets/ex1_det.png
- game_assets/result1.png
- game_assets/Behavior_list.png
- game_assets/Activity_list.png
- game_assets/ex2_det.png
- game_assets/ex3_det.png
- game_assets/slevel1_btn.png
- game_assets/slevel2_btn.png
- game_assets/slevel3_btn.png
- game_assets/btn_level1.png
- game_assets/btn_level2.png
- game_assets/btn_level3.png
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment