Commit 977c086c authored by Uditha Prabhasha 's avatar Uditha Prabhasha

upd

parent 69997cca
...@@ -11,10 +11,12 @@ import 'package:firebase_auth_web/firebase_auth_web.dart'; ...@@ -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_core_web/firebase_core_web.dart';
import 'package:firebase_storage_web/firebase_storage_web.dart'; import 'package:firebase_storage_web/firebase_storage_web.dart';
import 'package:image_picker_for_web/image_picker_for_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:rive_common/rive_web.dart';
import 'package:shared_preferences_web/shared_preferences_web.dart'; import 'package:shared_preferences_web/shared_preferences_web.dart';
import 'package:url_launcher_web/url_launcher_web.dart'; import 'package:url_launcher_web/url_launcher_web.dart';
import 'package:video_player_web/video_player_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'; import 'package:flutter_web_plugins/flutter_web_plugins.dart';
void registerPlugins([final Registrar? pluginRegistrar]) { void registerPlugins([final Registrar? pluginRegistrar]) {
...@@ -24,9 +26,11 @@ void registerPlugins([final Registrar? pluginRegistrar]) { ...@@ -24,9 +26,11 @@ void registerPlugins([final Registrar? pluginRegistrar]) {
FirebaseCoreWeb.registerWith(registrar); FirebaseCoreWeb.registerWith(registrar);
FirebaseStorageWeb.registerWith(registrar); FirebaseStorageWeb.registerWith(registrar);
ImagePickerPlugin.registerWith(registrar); ImagePickerPlugin.registerWith(registrar);
PackageInfoPlusWebPlugin.registerWith(registrar);
RivePlugin.registerWith(registrar); RivePlugin.registerWith(registrar);
SharedPreferencesPlugin.registerWith(registrar); SharedPreferencesPlugin.registerWith(registrar);
UrlLauncherPlugin.registerWith(registrar); UrlLauncherPlugin.registerWith(registrar);
VideoPlayerPlugin.registerWith(registrar); VideoPlayerPlugin.registerWith(registrar);
WakelockPlusWebPlugin.registerWith(registrar);
registrar.registerMessageHandler(); registrar.registerMessageHandler();
} }
...@@ -7,6 +7,12 @@ ...@@ -7,6 +7,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "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", "name": "async",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/async-2.11.0", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/async-2.11.0",
...@@ -67,6 +73,12 @@ ...@@ -67,6 +73,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "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", "name": "clock",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/clock-1.1.1", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/clock-1.1.1",
...@@ -97,6 +109,12 @@ ...@@ -97,6 +109,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "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", "name": "cross_file",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cross_file-0.3.3+7", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cross_file-0.3.3+7",
...@@ -121,6 +139,12 @@ ...@@ -121,6 +139,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.19" "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", "name": "fake_async",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/fake_async-1.3.1", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/fake_async-1.3.1",
...@@ -373,12 +397,30 @@ ...@@ -373,12 +397,30 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.18" "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", "name": "octo_image",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/octo_image-2.0.0", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/octo_image-2.0.0",
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.12" "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", "name": "path",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path-1.8.3", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path-1.8.3",
...@@ -421,6 +463,12 @@ ...@@ -421,6 +463,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.19" "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", "name": "pie_chart",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/pie_chart-5.4.0", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/pie_chart-5.4.0",
...@@ -439,6 +487,12 @@ ...@@ -439,6 +487,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "3.0" "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", "name": "rive",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/rive-0.11.17", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/rive-0.11.17",
...@@ -673,6 +727,18 @@ ...@@ -673,6 +727,18 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "2.19" "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", "name": "win32",
"rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/win32-5.0.9", "rootUri": "file:///Users/avishkanew/.pub-cache/hosted/pub.dev/win32-5.0.9",
...@@ -685,6 +751,12 @@ ...@@ -685,6 +751,12 @@
"packageUri": "lib/", "packageUri": "lib/",
"languageVersion": "3.0" "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", "name": "mobile_application_kids",
"rootUri": "../", "rootUri": "../",
...@@ -692,7 +764,7 @@ ...@@ -692,7 +764,7 @@
"languageVersion": "3.0" "languageVersion": "3.0"
} }
], ],
"generated": "2024-03-18T20:49:16.239934Z", "generated": "2024-03-18T22:34:44.866484Z",
"generator": "pub", "generator": "pub",
"generatorVersion": "3.0.1" "generatorVersion": "3.0.1"
} }
...@@ -18,6 +18,10 @@ _flutterfire_internals ...@@ -18,6 +18,10 @@ _flutterfire_internals
2.18 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/_flutterfire_internals-1.3.16/lib/ 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 async
2.18 2.18
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/async-2.11.0/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/async-2.11.0/
...@@ -58,6 +62,10 @@ charts_flutter ...@@ -58,6 +62,10 @@ charts_flutter
2.12 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/charts_flutter-0.12.0/lib/ 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 clock
2.12 2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/clock-1.1.1/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/clock-1.1.1/
...@@ -78,6 +86,10 @@ collection ...@@ -78,6 +86,10 @@ collection
2.18 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/collection-1.17.1/lib/ 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 cross_file
3.0 3.0
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cross_file-0.3.3+7/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cross_file-0.3.3+7/
...@@ -94,6 +106,10 @@ cupertino_icons ...@@ -94,6 +106,10 @@ cupertino_icons
2.19 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/cupertino_icons-1.0.6/lib/ 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 fake_async
2.12 2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/fake_async-1.3.1/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/fake_async-1.3.1/
...@@ -250,10 +266,22 @@ mime ...@@ -250,10 +266,22 @@ mime
2.18 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/mime-1.0.4/lib/ 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 octo_image
2.12 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/octo_image-2.0.0/lib/ 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 path
2.12 2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path-1.8.3/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path-1.8.3/
...@@ -282,6 +310,10 @@ path_provider_windows ...@@ -282,6 +310,10 @@ path_provider_windows
2.19 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_windows-2.2.1/lib/ 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 pie_chart
2.12 2.12
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/pie_chart-5.4.0/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/pie_chart-5.4.0/
...@@ -294,6 +326,10 @@ plugin_platform_interface ...@@ -294,6 +326,10 @@ plugin_platform_interface
3.0 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/plugin_platform_interface-2.1.7/lib/ 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 rive
2.14 2.14
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/rive-0.11.17/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/rive-0.11.17/
...@@ -446,6 +482,14 @@ video_player_web ...@@ -446,6 +482,14 @@ video_player_web
2.19 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_web-2.0.17/lib/ 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 win32
3.0 3.0
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/win32-5.0.9/ file:///Users/avishkanew/.pub-cache/hosted/pub.dev/win32-5.0.9/
...@@ -454,6 +498,10 @@ xdg_directories ...@@ -454,6 +498,10 @@ xdg_directories
3.0 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/
file:///Users/avishkanew/.pub-cache/hosted/pub.dev/xdg_directories-1.0.4/lib/ 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 mobile_application_kids
3.0 3.0
file:///Users/avishkanew/Documents/Jema678/monitoring-and-recommendations-for-early-childhood-development/ 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. ...@@ -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_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_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/ 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=/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_android=/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_android-2.2.2/
path_provider_foundation=/Users/avishkanew/.pub-cache/hosted/pub.dev/path_provider_foundation-2.3.2/ path_provider_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/ ...@@ -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_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_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/ video_player_web=/Users/avishkanew/.pub-cache/hosted/pub.dev/video_player_web-2.0.17/
wakelock_plus=/Users/avishkanew/.pub-cache/hosted/pub.dev/wakelock_plus-1.1.4/
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/the_memory_match_game.dart';
void main() {
runApp(
const TheMemoryMatchGame(),
);
}
import 'package:flutter/material.dart';
enum CardState { hidden, visible, guessed }
class CardItem {
CardItem({
required this.value,
required this.icon,
required this.color,
this.state = CardState.hidden,
});
final int value;
final IconData icon;
final Color color;
CardState state;
}
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/models/card_item.dart';
import 'package:mobile_application_kids/game1/utils/icons.dart';
class Game {
Game(this.gridSize) {
generateCards();
}
final int gridSize;
List<CardItem> cards = [];
bool isGameOver = false;
Set<IconData> icons = {};
void generateCards() {
generateIcons();
cards = [];
final List<Color> cardColors = Colors.primaries.toList();
for (int i = 0; i < (gridSize * gridSize / 2); i++) {
final cardValue = i + 1;
final IconData icon = icons.elementAt(i);
final Color cardColor = cardColors[i % cardColors.length];
final List<CardItem> newCards =
_createCardItems(icon, cardColor, cardValue);
cards.addAll(newCards);
}
cards.shuffle(Random());
}
void generateIcons() {
icons = <IconData>{};
for (int j = 0; j < (gridSize * gridSize / 2); j++) {
final IconData icon = _getRandomCardIcon();
icons.add(icon);
icons.add(icon); // Add the icon twice to ensure pairs are generated.
}
}
void resetGame() {
generateCards();
isGameOver = false;
}
void onCardPressed(int index) {
cards[index].state = CardState.visible;
final List<int> visibleCardIndexes = _getVisibleCardIndexes();
if (visibleCardIndexes.length == 2) {
final CardItem card1 = cards[visibleCardIndexes[0]];
final CardItem card2 = cards[visibleCardIndexes[1]];
if (card1.value == card2.value) {
card1.state = CardState.guessed;
card2.state = CardState.guessed;
isGameOver = _isGameOver();
} else {
Future.delayed(const Duration(milliseconds: 1000), () {
card1.state = CardState.hidden;
card2.state = CardState.hidden;
});
}
}
}
List<CardItem> _createCardItems(
IconData icon, Color cardColor, int cardValue) {
return List.generate(
2,
(index) => CardItem(
value: cardValue,
icon: icon,
color: cardColor,
),
);
}
IconData _getRandomCardIcon() {
final Random random = Random();
IconData icon;
do {
icon = cardIcons[random.nextInt(cardIcons.length)];
} while (icons.contains(icon));
return icon;
}
List<int> _getVisibleCardIndexes() {
return cards
.asMap()
.entries
.where((entry) => entry.value.state == CardState.visible)
.map((entry) => entry.key)
.toList();
}
bool _isGameOver() {
return cards.every((card) => card.state == CardState.guessed);
}
}
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/pages/startup_page.dart';
class TheMemoryMatchGame extends StatelessWidget {
const TheMemoryMatchGame({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
home: const StartUpPage(),
title: 'Memory Match',
theme: ThemeData.dark(),
debugShowCheckedModeBanner: false,
);
}
}
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/widgets/web/game_board.dart';
import 'package:mobile_application_kids/game1/ui/widgets/mobile/game_board_mobile.dart';
class MemoryMatchPage extends StatelessWidget {
const MemoryMatchPage({
required this.gameLevel,
super.key,
});
final int gameLevel;
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: LayoutBuilder(
builder: ((context, constraints) {
if (constraints.maxWidth > 720) {
return GameBoard(
gameLevel: gameLevel,
);
} else {
return GameBoardMobile(
gameLevel: gameLevel,
);
}
}),
),
),
);
}
}
//startup_page.dart
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_options.dart';
import 'package:mobile_application_kids/game1/utils/constants.dart';
import 'package:mobile_application_kids/games.dart';
class StartUpPage extends StatelessWidget {
const StartUpPage({Key? key}) : super(key: key); // Fix super key
@override
Widget build(BuildContext context) {
return Scaffold(
body: SafeArea(
child: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
gameTitle,
style: TextStyle(fontSize: 24, color: Colors.white),
),
GameOptions(),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => GamesPage()),
);
},
child: Text('Quit'), // Add quit button
),
],
),
),
),
);
}
}
import 'package:flutter/material.dart';
class GameButton extends StatelessWidget {
const GameButton({
required this.title,
required this.onPressed,
required this.color,
this.height = 40,
this.width = double.infinity,
this.fontSize = 18,
Key? key,
}) : super(key: key);
final String title;
final VoidCallback onPressed;
final Color color;
final double height;
final double width;
final double fontSize;
@override
Widget build(BuildContext context) {
return SizedBox(
height: height,
width: width,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
backgroundColor: color,
textStyle: TextStyle(fontSize: fontSize),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.all(
Radius.circular(height / 2),
),
),
),
onPressed: onPressed,
child: Text(title),
),
);
}
}
import 'package:confetti/confetti.dart';
import 'package:flutter/material.dart';
class GameConfetti extends StatefulWidget {
const GameConfetti({
super.key,
});
@override
State<GameConfetti> createState() => _GameConfettiState();
}
class _GameConfettiState extends State<GameConfetti> {
final controllerCenter =
ConfettiController(duration: const Duration(seconds: 10));
@override
void initState() {
super.initState();
controllerCenter.play();
}
@override
void dispose() {
controllerCenter.dispose();
super.dispose();
}
@override
Widget build(BuildContext context) {
return Align(
alignment: Alignment.topCenter,
child: ConfettiWidget(
confettiController: controllerCenter,
blastDirectionality: BlastDirectionality.explosive,
shouldLoop: false,
gravity: 0.5,
emissionFrequency: 0.05,
numberOfParticles: 20,
colors: const [
Colors.green,
Colors.blue,
Colors.pink,
Colors.orange,
Colors.purple
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/pages/startup_page.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_button.dart';
import 'package:mobile_application_kids/game1/utils/constants.dart';
class GameControlsBottomSheet extends StatelessWidget {
const GameControlsBottomSheet({
Key? key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(20),
child: Column(
mainAxisSize: MainAxisSize.min,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Center(
child: Text(
'PAUSE',
style: TextStyle(fontSize: 24, color: Colors.white),
),
),
const SizedBox(height: 10),
GameButton(
onPressed: () => Navigator.of(context).pop(false),
title: 'CONTINUE',
color: continueButtonColor,
width: 200,
),
const SizedBox(height: 10),
GameButton(
onPressed: () => Navigator.of(context).pop(true),
title: 'RESTART',
color: restartButtonColor,
width: 200,
),
const SizedBox(height: 10),
GameButton(
onPressed: () {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(
builder: (BuildContext context) {
return const StartUpPage();
},
),
(Route<dynamic> route) => false,
);
},
title: 'QUIT',
color: quitButtonColor,
width: 200,
),
const SizedBox(height: 20),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/pages/memory_match_page.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_button.dart';
import 'package:mobile_application_kids/game1/utils/constants.dart';
class GameOptions extends StatelessWidget {
const GameOptions({
super.key,
});
static Route<dynamic> _routeBuilder(BuildContext context, int gameLevel) {
return MaterialPageRoute(
builder: (_) {
return MemoryMatchPage(gameLevel: gameLevel);
},
);
}
@override
Widget build(BuildContext context) {
return Column(
children: gameLevels.map((level) {
return Padding(
padding: const EdgeInsets.all(10.0),
child: GameButton(
onPressed: () => Navigator.of(context).pushAndRemoveUntil(
_routeBuilder(context, level['level']),
(Route<dynamic> route) => false),
title: level['title'],
color: level['color']![700]!,
width: 250,
),
);
}).toList(),
);
}
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/models/card_item.dart';
class MemoryCard extends StatelessWidget {
const MemoryCard({
required this.card,
required this.index,
required this.onCardPressed,
super.key,
});
final CardItem card;
final int index;
final ValueChanged<int> onCardPressed;
void _handleCardTap() {
if (card.state == CardState.hidden) {
Timer(const Duration(milliseconds: 100), () {
onCardPressed(index);
});
}
}
@override
Widget build(BuildContext context) {
return InkWell(
onTap: _handleCardTap,
child: Card(
elevation: 8,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
color:
card.state == CardState.visible || card.state == CardState.guessed
? card.color
: Colors.grey,
child: Center(
child: card.state == CardState.hidden
? null
: SizedBox.expand(
child: FittedBox(
child: Icon(
card.icon,
color: Colors.white,
),
),
),
),
),
);
}
}
import 'package:flutter/material.dart';
class GameBestTimeMobile extends StatelessWidget {
const GameBestTimeMobile({
required this.bestTime,
super.key,
});
final int bestTime;
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.symmetric(
vertical: 50,
horizontal: 60,
),
elevation: 8,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
color: Colors.greenAccent[700],
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
const Expanded(
flex: 1,
child: Icon(
Icons.celebration,
size: 40,
),
),
Expanded(
flex: 2,
child: Text(
textAlign: TextAlign.center,
Duration(seconds: bestTime)
.toString()
.split('.')
.first
.padLeft(8, "0"),
style: const TextStyle(
fontSize: 28.0,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
);
}
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:mobile_application_kids/game1/models/game.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_confetti.dart';
import 'package:mobile_application_kids/game1/ui/widgets/memory_card.dart';
import 'package:mobile_application_kids/game1/ui/widgets/mobile/game_best_time_mobile.dart';
import 'package:mobile_application_kids/game1/ui/widgets/mobile/game_timer_mobile.dart';
import 'package:mobile_application_kids/game1/ui/widgets/restart_game.dart';
class GameBoardMobile extends StatefulWidget {
const GameBoardMobile({
required this.gameLevel,
super.key,
});
final int gameLevel;
@override
State<GameBoardMobile> createState() => _GameBoardMobileState();
}
class _GameBoardMobileState extends State<GameBoardMobile> {
late Timer timer;
late Game game;
late Duration duration;
int bestTime = 0;
bool showConfetti = false;
@override
void initState() {
super.initState();
game = Game(widget.gameLevel);
duration = const Duration();
startTimer();
getBestTime();
}
void getBestTime() async {
SharedPreferences gameSP = await SharedPreferences.getInstance();
if (gameSP.getInt('${widget.gameLevel.toString()}BestTime') != null) {
bestTime = gameSP.getInt('${widget.gameLevel.toString()}BestTime')!;
}
setState(() {});
}
startTimer() {
timer = Timer.periodic(const Duration(seconds: 1), (_) async {
setState(() {
final seconds = duration.inSeconds + 1;
duration = Duration(seconds: seconds);
});
if (game.isGameOver) {
timer.cancel();
SharedPreferences gameSP = await SharedPreferences.getInstance();
if (gameSP.getInt('${widget.gameLevel.toString()}BestTime') == null ||
gameSP.getInt('${widget.gameLevel.toString()}BestTime')! >
duration.inSeconds) {
gameSP.setInt(
'${widget.gameLevel.toString()}BestTime', duration.inSeconds);
setState(() {
showConfetti = true;
bestTime = duration.inSeconds;
});
}
}
});
}
pauseTimer() {
timer.cancel();
}
void _resetGame() {
game.resetGame();
setState(() {
timer.cancel();
duration = const Duration();
startTimer();
});
}
@override
Widget build(BuildContext context) {
final aspectRatio = MediaQuery.of(context).size.aspectRatio;
return SafeArea(
child: Stack(
children: [
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const SizedBox(
height: 20,
),
RestartGame(
isGameOver: game.isGameOver,
pauseGame: () => pauseTimer(),
restartGame: () => _resetGame(),
continueGame: () => startTimer(),
color: Colors.amberAccent[700]!,
),
GameTimerMobile(
time: duration,
),
Expanded(
child: GridView.count(
crossAxisCount: game.gridSize,
childAspectRatio: aspectRatio * 2,
children: List.generate(game.cards.length, (index) {
return MemoryCard(
index: index,
card: game.cards[index],
onCardPressed: game.onCardPressed,
);
}),
),
),
GameBestTimeMobile(
bestTime: bestTime,
),
],
),
showConfetti ? const GameConfetti() : const SizedBox(),
],
),
);
}
}
import 'package:flutter/material.dart';
class GameTimerMobile extends StatelessWidget {
const GameTimerMobile({
required this.time,
super.key,
});
final Duration time;
@override
Widget build(BuildContext context) {
return Card(
margin: const EdgeInsets.symmetric(
vertical: 20,
horizontal: 60,
),
elevation: 8,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(15),
),
color: Colors.red[700],
child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
const Expanded(
flex: 1,
child: Icon(
Icons.timer,
size: 40,
),
),
Expanded(
flex: 2,
child: Text(
textAlign: TextAlign.center,
time.toString().split('.').first.padLeft(8, "0"),
style: const TextStyle(
fontSize: 28.0,
fontWeight: FontWeight.bold,
),
),
),
],
),
),
);
}
}
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game1/ui/pages/startup_page.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_controls_bottomsheet.dart';
class RestartGame extends StatelessWidget {
const RestartGame({
required this.isGameOver,
required this.pauseGame,
required this.restartGame,
required this.continueGame,
this.color = Colors.white,
super.key,
});
final VoidCallback pauseGame;
final VoidCallback restartGame;
final VoidCallback continueGame;
final bool isGameOver;
final Color color;
Future<void> showGameControls(BuildContext context) async {
pauseGame();
var value = await showModalBottomSheet<bool>(
isScrollControlled: true,
elevation: 5,
context: context,
builder: (sheetContext) {
return const GameControlsBottomSheet();
},
);
value ??= false;
if (value) {
restartGame();
} else {
continueGame();
}
}
void navigateback(BuildContext context) {
Navigator.of(context).pushAndRemoveUntil(
MaterialPageRoute(builder: (BuildContext context) {
return const StartUpPage();
}), (Route<dynamic> route) => false);
}
@override
Widget build(BuildContext context) {
return IconButton(
color: color,
icon: (isGameOver)
? const Icon(Icons.replay_circle_filled)
: const Icon(Icons.pause_circle_filled),
iconSize: 40,
onPressed: () =>
isGameOver ? navigateback(context) : showGameControls(context),
);
}
}
import 'package:flutter/material.dart';
class GameBestTime extends StatelessWidget {
const GameBestTime({
required this.bestTime,
super.key,
});
final int bestTime;
@override
Widget build(BuildContext context) {
return Text(
'Best: ${Duration(seconds: bestTime).toString().split('.').first.padLeft(8, "0")}',
textAlign: TextAlign.center,
style: const TextStyle(fontSize: 24.0, fontWeight: FontWeight.bold),
);
}
}
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart';
import 'package:mobile_application_kids/game1/models/game.dart';
import 'package:mobile_application_kids/game1/ui/widgets/game_confetti.dart';
import 'package:mobile_application_kids/game1/ui/widgets/memory_card.dart';
import 'package:mobile_application_kids/game1/ui/widgets/restart_game.dart';
import 'package:mobile_application_kids/game1/ui/widgets/web/game_best_time.dart';
import 'package:mobile_application_kids/game1/ui/widgets/web/game_timer.dart';
class GameBoard extends StatefulWidget {
const GameBoard({
required this.gameLevel,
super.key,
});
final int gameLevel;
@override
State<GameBoard> createState() => _GameBoardState();
}
class _GameBoardState extends State<GameBoard> {
late Timer timer;
late Game game;
late Duration duration;
int bestTime = 0;
bool showConfetti = false;
@override
void initState() {
super.initState();
game = Game(widget.gameLevel);
duration = const Duration();
startTimer();
getBestTime();
}
void getBestTime() async {
SharedPreferences gameSP = await SharedPreferences.getInstance();
if (gameSP.getInt('${widget.gameLevel.toString()}BestTime') != null) {
bestTime = gameSP.getInt('${widget.gameLevel.toString()}BestTime')!;
}
setState(() {});
}
startTimer() {
timer = Timer.periodic(const Duration(seconds: 1), (_) async {
setState(() {
final seconds = duration.inSeconds + 1;
duration = Duration(seconds: seconds);
});
if (game.isGameOver) {
timer.cancel();
SharedPreferences gameSP = await SharedPreferences.getInstance();
if (gameSP.getInt('${widget.gameLevel.toString()}BestTime') == null ||
gameSP.getInt('${widget.gameLevel.toString()}BestTime')! >
duration.inSeconds) {
gameSP.setInt(
'${widget.gameLevel.toString()}BestTime', duration.inSeconds);
setState(() {
showConfetti = true;
bestTime = duration.inSeconds;
});
}
}
});
}
pauseTimer() {
timer.cancel();
}
void _resetGame() {
game.resetGame();
setState(() {
timer.cancel();
duration = const Duration();
startTimer();
});
}
@override
Widget build(BuildContext context) {
final responsiveSpacing = sqrt(MediaQuery.of(context).size.width) *
sqrt(MediaQuery.of(context).size.height);
return Stack(
children: [
GridView.count(
padding: const EdgeInsets.fromLTRB(8.0, 80.0, 8.0, 8.0),
childAspectRatio: MediaQuery.of(context).size.aspectRatio * 1.2,
mainAxisSpacing: responsiveSpacing / 100,
crossAxisSpacing: responsiveSpacing / 100,
crossAxisCount: game.gridSize,
children: List.generate(game.cards.length, (index) {
return MemoryCard(
index: index,
card: game.cards[index],
onCardPressed: game.onCardPressed,
);
}),
),
Positioned(
top: 12.0,
right: 24.0,
child: RestartGame(
isGameOver: game.isGameOver,
pauseGame: () => pauseTimer(),
restartGame: () => _resetGame(),
continueGame: () => startTimer(),
),
),
Positioned(
bottom: 12.0,
right: 24.0,
child: GameTimer(
time: duration,
),
),
Positioned(
bottom: 12.0,
left: 24.0,
child: GameBestTime(
bestTime: bestTime,
),
),
showConfetti ? const GameConfetti() : const SizedBox(),
],
);
}
}
import 'package:flutter/material.dart';
class GameTimer extends StatelessWidget {
const GameTimer({
required this.time,
super.key,
});
final Duration time;
@override
Widget build(BuildContext context) {
return Text(
time.toString().split('.').first.padLeft(8, "0"),
textAlign: TextAlign.center,
style: const TextStyle(
fontSize: 24.0,
fontWeight: FontWeight.bold,
),
);
}
}
import 'package:flutter/material.dart';
const Color continueButtonColor = Color.fromRGBO(235, 32, 93, 1);
const Color restartButtonColor = Color.fromRGBO(243, 181, 45, 1);
const Color quitButtonColor = Color.fromRGBO(39, 162, 149, 1);
const List<Map<String, dynamic>> gameLevels = [
{'title': 'Easy', 'level': 4, 'color': Colors.amberAccent},
{'title': 'Medium', 'level': 6, 'color': Colors.blueAccent},
{'title': 'Hard', 'level': 8, 'color': Colors.cyanAccent},
];
const String gameTitle = 'MEMORY MATCH';
import 'package:flutter/material.dart';
const List<IconData> cardIcons = <IconData>[
Icons.celebration,
Icons.directions_car_filled,
Icons.directions_bike,
Icons.house,
Icons.local_shipping,
Icons.fastfood,
Icons.album_sharp,
Icons.forest,
Icons.anchor,
Icons.ac_unit,
Icons.android,
Icons.favorite,
Icons.light,
Icons.agriculture_sharp,
Icons.airplanemode_on,
Icons.umbrella,
Icons.alarm,
Icons.directions_subway_rounded,
Icons.person,
Icons.light_mode_outlined,
Icons.bedtime_sharp,
Icons.all_inclusive,
Icons.wine_bar,
Icons.star,
Icons.headset_rounded,
Icons.apple_sharp,
Icons.whatshot_outlined,
Icons.delete,
Icons.audiotrack_rounded,
Icons.back_hand_sharp,
Icons.visibility,
Icons.traffic_rounded,
Icons.beach_access_rounded,
Icons.battery_charging_full_sharp,
Icons.downhill_skiing_rounded,
Icons.directions_boat_rounded,
Icons.eco_sharp,
Icons.restaurant,
Icons.balance_sharp,
Icons.shopping_cart_rounded,
Icons.radar_sharp,
Icons.sports_esports_rounded,
];
//main.dart
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game2/song_tales.dart';
void main() => runApp(SongTalesApp()); // Using the specific name for the app
This diff is collapsed.
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'emoX.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: EmotionGame(),
);
}
}
class EmotionGame extends StatefulWidget {
@override
_EmotionGameState createState() => _EmotionGameState();
}
class _EmotionGameState extends State<EmotionGame> {
late String correctEmotion;
bool isCorrect = false;
int questionIndex = 0;
bool allQuestionsCompleted =
false; // Flag to track if all questions are completed
// Map containing emotions, questions, and corresponding image paths
final Map<String, Map<String, String>> emotionData = {
'Sad': {
'question': 'How Lili looks like if she is Sad?',
'image': 'gsad.png'
},
'Angry': {
'question': 'How Lili looks like if she is Angry?',
'image': 'gangry.png'
},
'Happy': {
'question': 'How Lili looks like if she is Happy?',
'image': 'ghappy.png'
},
'Confused': {
'question': 'How Lili looks like if she is Confused?',
'image': 'gconfused.png'
},
'Surprised': {
'question': 'How Lili looks like if she is Surprised?',
'image': 'gsurprised.png'
},
};
// Lists containing shuffled emotions and questions
late List<String> shuffledEmotions;
late List<String> shuffledQuestions;
@override
void initState() {
super.initState();
// Set preferred orientations to portrait mode after navigating to this screen
SystemChrome.setPreferredOrientations([
DeviceOrientation.portraitUp,
DeviceOrientation.portraitDown,
]);
shuffledEmotions = List.from(emotionData.keys)..shuffle();
shuffledQuestions = List.from(emotionData.values.map((e) => e['question']!))
..shuffle();
correctEmotion = _getCorrectEmotion(shuffledQuestions[questionIndex]);
}
// Function to get the correct emotion based on the question
String _getCorrectEmotion(String question) {
return emotionData.entries
.firstWhere((entry) => entry.value['question'] == question)
.key;
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Emotion Game'),
),
body: Column(
children: [
Text(
shuffledQuestions[questionIndex],
style: TextStyle(
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
SizedBox(height: 60.0),
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: shuffledEmotions.map((emotion) {
return Draggable(
child: Image.asset(
'game_assets/${emotionData[emotion]!['image']}',
width: 65,
height: 65,
),
feedback: Image.asset(
'game_assets/${emotionData[emotion]!['image']}',
width: 60,
height: 60,
),
data: emotion,
);
}).toList(),
),
SizedBox(height: 70.0),
DragTarget<String>(
builder: (BuildContext context, List<String?> candidateData,
List<dynamic> rejectedData) {
return Container(
width: 240,
height: 240,
color: Color.fromARGB(255, 222, 214, 145).withOpacity(0.5),
child: isCorrect
? Image.asset(
'game_assets/${emotionData[correctEmotion]!['image']}')
: null,
);
},
onWillAccept: (data) => data == correctEmotion,
onAccept: (data) {
setState(() {
isCorrect = true;
});
},
),
SizedBox(height: 20.0),
ElevatedButton(
onPressed: () {
setState(() {
if (questionIndex < shuffledQuestions.length - 1) {
questionIndex++;
isCorrect = false;
correctEmotion =
_getCorrectEmotion(shuffledQuestions[questionIndex]);
} else {
// Last question, set the flag to true
allQuestionsCompleted = true;
}
});
},
child: Text(
questionIndex < shuffledQuestions.length - 1
? 'Next Question >>'
: 'Finish Game',
),
),
if (allQuestionsCompleted)
SizedBox(
height: 30,
), // Show the text only when all questions are completed
if (allQuestionsCompleted)
Text(
'Game Over! You Won!',
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20.0,
fontWeight: FontWeight.bold,
),
),
if (allQuestionsCompleted)
SizedBox(
height: 10,
), // Show the single Quit button only when all questions are completed
if (allQuestionsCompleted)
ElevatedButton(
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => LevelScreen()),
);
},
child: Text('Quit'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 247, 56, 35),
onPrimary: Colors.white,
),
),
],
),
);
}
}
import 'package:flutter/material.dart';
import 'emoX.dart';
class Level3 extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Level 3'),
),
body: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Center(
child: Column(
children: [
Text(
"Let's Identify",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
Text(
"Different Human Emotions",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 21,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
// Display the first GIF (laugh.gif)
Image.asset(
'game_assets/laugh.gif',
width: 380,
height: 350,
),
SizedBox(height: 0), // Reduce the gap between GIFs
// Display the second GIF (sad.gif)
Image.asset(
'game_assets/sad.gif',
width: 380,
height: 350,
),
Padding(
padding: const EdgeInsets.only(top: 20.0, bottom: 20.0),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => NextPage()),
);
},
child: Text('Next page'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 120, 149, 145),
onPrimary: Colors.white,
),
),
),
],
),
),
);
}
}
class NextPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Next Page'),
),
body: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Center(
child: Column(
children: [
Text(
"Let's Identify",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
Text(
"Different Human Emotions",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 21,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
// Display the first GIF (fear.gif)
Image.asset(
'game_assets/fear.gif',
width: 380,
height: 320,
),
SizedBox(height: 0), // Reduce the gap between GIFs
// Display the second GIF (anger.gif)
Image.asset(
'game_assets/anger.gif',
width: 380,
height: 350,
),
Padding(
padding: const EdgeInsets.only(top: 20.0, bottom: 20.0),
child: ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => FinalPage()),
);
},
child: Text('Next page'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 120, 149, 145),
onPrimary: Colors.white,
),
),
),
],
),
),
);
}
}
class FinalPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Final Page'),
),
body: SingleChildScrollView(
child: Column(
children: [
Padding(
padding: const EdgeInsets.only(top: 20.0),
child: Center(
child: Column(
children: [
Text(
"Let's Identify",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 20,
fontWeight: FontWeight.bold,
),
),
Text(
"Different Human Emotions",
textAlign: TextAlign.center,
style: TextStyle(
color: Color.fromARGB(255, 48, 173, 26),
fontSize: 21,
fontWeight: FontWeight.bold,
),
),
],
),
),
),
// Display the first GIF (disgust.gif)
Image.asset(
'game_assets/disgust.gif',
width: 380,
height: 320,
),
SizedBox(height: 0), // Reduce the gap between GIFs
// Display the second GIF (surprise.gif)
Image.asset(
'game_assets/surprise.gif',
width: 380,
height: 350,
),
Padding(
padding: const EdgeInsets.only(top: 20.0, bottom: 20.0),
child: ElevatedButton(
onPressed: () {
Navigator.pushReplacement(
context,
MaterialPageRoute(builder: (context) => LevelScreen()),
);
},
child: Text('Finish'),
style: ElevatedButton.styleFrom(
primary: Color.fromARGB(255, 231, 65, 43),
onPrimary: Colors.white,
),
),
),
],
),
),
);
}
}
//main.dart
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game3/emoX.dart';
void main() => runApp(EmoXApp()); // Using the specific name for the app
This diff is collapsed.
import 'package:flutter/material.dart';
import 'package:mobile_application_kids/game4/Posture_pro.dart';
void main() => runApp(PosturePro());
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:mobile_application_kids/ChatScreen.dart'; import 'package:mobile_application_kids/ChatScreen.dart';
import 'package:mobile_application_kids/parentHome.dart'; import 'package:mobile_application_kids/game1/the_memory_match_game.dart';
import 'package:mobile_application_kids/parentProfile.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 { class GamesPage extends StatelessWidget {
final List<Map<String, String>> gameData = [ final String commonImagePath = 'assets/act_photo.png';
{'game': 'Game 1', 'description': 'Description for Game 1'},
{'game': 'Game 2', 'description': 'Description for Game 2'},
{'game': 'Game 3', 'description': 'Description for Game 1'},
{'game': 'Game 4', 'description': 'Description for Game 2'},
// add more games as needed
];
final String commonImagePath = 'lib/assets/act_photo.png';
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
appBar: AppBar( appBar: AppBar(
title: Text(' '), title: Text('Games'),
actions: [
Container(
alignment: Alignment.centerRight,
padding: EdgeInsets.only(right: 16),
child: Text(
'Games',
style: TextStyle(
color: Color(0xFF554994),
fontSize: 24,
fontFamily: 'Poppins',
fontWeight: FontWeight.w700,
height: 0.04,
letterSpacing: -0.96,
),
),
),
],
), ),
body: Column( body: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
...@@ -53,11 +28,10 @@ class GamesPage extends StatelessWidget { ...@@ -53,11 +28,10 @@ class GamesPage extends StatelessWidget {
), ),
), ),
Expanded( Expanded(
child: ListView.builder( child: ListView(
itemCount: gameData.length, children: [
itemBuilder: (context, index) { // Game 1 Card/Button
var game = gameData[index]; Card(
return Card(
child: ListTile( child: ListTile(
contentPadding: EdgeInsets.all(16), contentPadding: EdgeInsets.all(16),
leading: Container( leading: Container(
...@@ -68,20 +42,109 @@ class GamesPage extends StatelessWidget { ...@@ -68,20 +42,109 @@ class GamesPage extends StatelessWidget {
), ),
), ),
title: Text( title: Text(
game['game'] ?? '', 'Game 1',
style: TextStyle( style: TextStyle(
fontSize: 18, fontSize: 18,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
), ),
), ),
subtitle: Text(game['description'] ?? ''), 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,
height: 50,
child: CircleAvatar(
backgroundImage: AssetImage(commonImagePath),
),
),
title: Text(
'Game 2',
style: TextStyle(
fontSize: 18,
fontWeight: FontWeight.bold,
),
),
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( bottomNavigationBar: BottomNavigationBar(
items: const [ items: const [
BottomNavigationBarItem( BottomNavigationBarItem(
......
...@@ -10,11 +10,13 @@ import file_selector_macos ...@@ -10,11 +10,13 @@ import file_selector_macos
import firebase_auth import firebase_auth
import firebase_core import firebase_core
import firebase_storage import firebase_storage
import package_info_plus
import path_provider_foundation import path_provider_foundation
import rive_common import rive_common
import shared_preferences_foundation import shared_preferences_foundation
import sqflite import sqflite
import url_launcher_macos import url_launcher_macos
import wakelock_plus
func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin")) FLTFirebaseFirestorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseFirestorePlugin"))
...@@ -22,9 +24,11 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) { ...@@ -22,9 +24,11 @@ func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin")) FLTFirebaseAuthPlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseAuthPlugin"))
FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin")) FLTFirebaseCorePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseCorePlugin"))
FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin")) FLTFirebaseStoragePlugin.register(with: registry.registrar(forPlugin: "FLTFirebaseStoragePlugin"))
FPPPackageInfoPlusPlugin.register(with: registry.registrar(forPlugin: "FPPPackageInfoPlusPlugin"))
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin")) PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin")) RivePlugin.register(with: registry.registrar(forPlugin: "RivePlugin"))
SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin")) SharedPreferencesPlugin.register(with: registry.registrar(forPlugin: "SharedPreferencesPlugin"))
SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin")) SqflitePlugin.register(with: registry.registrar(forPlugin: "SqflitePlugin"))
UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin")) UrlLauncherPlugin.register(with: registry.registrar(forPlugin: "UrlLauncherPlugin"))
WakelockPlusMacosPlugin.register(with: registry.registrar(forPlugin: "WakelockPlusMacosPlugin"))
} }
...@@ -9,6 +9,14 @@ packages: ...@@ -9,6 +9,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.3.16" version: "1.3.16"
args:
dependency: transitive
description:
name: args
sha256: eef6c46b622e0494a36c5a12d10d77fb4e855501a91c1b9ef9339326e58f0596
url: "https://pub.dev"
source: hosted
version: "2.4.2"
async: async:
dependency: transitive dependency: transitive
description: description:
...@@ -89,6 +97,14 @@ packages: ...@@ -89,6 +97,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "0.12.0" version: "0.12.0"
chewie:
dependency: "direct main"
description:
name: chewie
sha256: "8bc4ac4cf3f316e50a25958c0f5eb9bb12cf7e8308bb1d74a43b230da2cfc144"
url: "https://pub.dev"
source: hosted
version: "1.7.5"
clock: clock:
dependency: transitive dependency: transitive
description: description:
...@@ -129,6 +145,14 @@ packages: ...@@ -129,6 +145,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.17.1" 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: cross_file:
dependency: transitive dependency: transitive
description: description:
...@@ -161,6 +185,14 @@ packages: ...@@ -161,6 +185,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.6" version: "1.0.6"
dbus:
dependency: transitive
description:
name: dbus
sha256: "365c771ac3b0e58845f39ec6deebc76e3276aa9922b0cc60840712094d9047ac"
url: "https://pub.dev"
source: hosted
version: "0.7.10"
fake_async: fake_async:
dependency: transitive dependency: transitive
description: description:
...@@ -488,6 +520,14 @@ packages: ...@@ -488,6 +520,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.4" version: "1.0.4"
nested:
dependency: transitive
description:
name: nested
sha256: "03bac4c528c64c95c722ec99280375a6f2fc708eec17c7b3f07253b626cd2a20"
url: "https://pub.dev"
source: hosted
version: "1.0.0"
octo_image: octo_image:
dependency: transitive dependency: transitive
description: description:
...@@ -496,6 +536,22 @@ packages: ...@@ -496,6 +536,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.0" 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: path:
dependency: transitive dependency: transitive
description: description:
...@@ -552,6 +608,14 @@ packages: ...@@ -552,6 +608,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.2.1" version: "2.2.1"
petitparser:
dependency: transitive
description:
name: petitparser
sha256: cb3798bef7fc021ac45b308f4b51208a152792445cce0448c9a4ba5879dd8750
url: "https://pub.dev"
source: hosted
version: "5.4.0"
pie_chart: pie_chart:
dependency: "direct main" dependency: "direct main"
description: description:
...@@ -576,6 +640,14 @@ packages: ...@@ -576,6 +640,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.1.7" version: "2.1.7"
provider:
dependency: transitive
description:
name: provider
sha256: c8a055ee5ce3fd98d6fc872478b03823ffdb448699c6ebdbbc71d59b596fd48c
url: "https://pub.dev"
source: hosted
version: "6.1.2"
rive: rive:
dependency: transitive dependency: transitive
description: description:
...@@ -885,6 +957,22 @@ packages: ...@@ -885,6 +957,22 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.0.17" 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: win32:
dependency: transitive dependency: transitive
description: description:
...@@ -901,6 +989,14 @@ packages: ...@@ -901,6 +989,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "1.0.4" version: "1.0.4"
xml:
dependency: transitive
description:
name: xml
sha256: "5bc72e1e45e941d825fd7468b9b4cc3b9327942649aeb6fc5cdbf135f0a86e84"
url: "https://pub.dev"
source: hosted
version: "6.3.0"
sdks: sdks:
dart: ">=3.0.1 <4.0.0" dart: ">=3.0.1 <4.0.0"
flutter: ">=3.10.0" flutter: ">=3.10.0"
...@@ -50,6 +50,9 @@ dependencies: ...@@ -50,6 +50,9 @@ dependencies:
table_calendar: ^3.0.3 table_calendar: ^3.0.3
carousel_slider: ^4.0.0 carousel_slider: ^4.0.0
intl: ^0.17.0 intl: ^0.17.0
confetti: ^0.7.0
chewie: ^1.0.0
dev_dependencies: dev_dependencies:
...@@ -107,6 +110,72 @@ flutter: ...@@ -107,6 +110,72 @@ flutter:
- lib/assets/I.png - lib/assets/I.png
- lib/assets/i2.png - lib/assets/i2.png
- lib/assets/act_photo.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