Skip to content

Commit

Permalink
Entrega Final AppDev (Afonso Freitas)
Browse files Browse the repository at this point in the history
  • Loading branch information
AAAAAfonso committed Apr 11, 2023
1 parent 0e32092 commit 2089ca9
Show file tree
Hide file tree
Showing 174 changed files with 19,909 additions and 38,175 deletions.
4 changes: 4 additions & 0 deletions appdev/Entregas/AfonsoFreitas/CPSCounter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# cpscounter

Esta entrega Atualmente não consegue escrever no JSon com mais tempo conseguiria resolver o problema
e a spalsh screen esta a deafault pelo que nao tem nenhuma alteração
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.joguinho_estupido"
applicationId "com.example.cpscounter"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
minSdkVersion flutter.minSdkVersion
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.joguinho_estupido">
package="com.example.cpscounter">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.joguinho_estupido">
package="com.example.cpscounter">
<application
android:label="joguinho_estupido"
android:label="cpscounter"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.example.joguinho_estupido
package com.example.cpscounter

import io.flutter.embedding.android.FlutterActivity

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.joguinho_estupido">
package="com.example.cpscounter">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>joguinho_estupido</string>
<string>cpscounter</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,32 +1,31 @@
import 'package:flutter/material.dart';
import 'dart:convert';
import 'dart:io';
import 'dart:html';

class GameOver extends StatelessWidget{
const GameOver(this.count,this.username,{super.key});

final int count;
final String username;

/*Future<void> writeToJson() async {
final jsonFile = File('../assets/data.json');
Future<void> writeToJson() async {
List<dynamic> jsonList;

if (await jsonFile.exists()) {
final jsonString = await jsonFile.readAsString();
final jsonString = window.localStorage['data'];
if (jsonString != null) {
jsonList = jsonDecode(jsonString);
} else {
jsonList = [];
}

jsonList.add({'username': username, 'score': count});

await jsonFile.writeAsString(jsonEncode(jsonList));
}*/
window.localStorage['data'] = jsonEncode(jsonList);
}

@override
Widget build(BuildContext context) {
//writeToJson();
writeToJson();

return Scaffold(
backgroundColor: Colors.black,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:math';

import 'package:joguinho_estupido/score_board.dart';
import 'package:cpscounter/score_board.dart';

import 'game_main.dart';
import 'package:flutter/material.dart';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:flutter/material.dart';
import 'dart:convert';
import 'dart:html';
import 'entities/score.dart';
import 'package:flutter/services.dart' show rootBundle;

class ScoreBoard extends StatefulWidget {
const ScoreBoard({super.key});
Expand All @@ -17,13 +17,20 @@ class _ScoreBoardState extends State<ScoreBoard> {
Future<List<Score>> scoreBoard() async {
var scoreList = <Score>[];

final jsonString = await rootBundle.loadString('assets/data.json');
for(var json in jsonDecode(jsonString)){
scoreList.add(Score.fromJson(json));
scoreList.sort( (a,b) => a.compareTo(b));
try {
final jsonString = window.localStorage['data'];
if (jsonString != null) {
final jsonData = jsonDecode(jsonString);
for (var json in jsonData) {
scoreList.add(Score.fromJson(json));
}
}
scoreList.sort((a, b) => a.compareTo(b));
} catch (e) {
print('Error: $e');
}

return scoreList;

}

@override
Expand All @@ -43,8 +50,8 @@ class _ScoreBoardState extends State<ScoreBoard> {
backgroundColor: Colors.black,
body: ListView.builder(
itemBuilder: (context, index) {
if (index >= 100) {
return null; // return null for indexes above 100 to skip rendering
if (_scoreList.isEmpty || index >= _scoreList.length || index >= 100) {
return Container();
}
return ListTile(
title: Text(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ project(runner LANGUAGES CXX)

# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "joguinho_estupido")
set(BINARY_NAME "cpscounter")
# The unique GTK application identifier for this application. See:
# https://wiki.gnome.org/HowDoI/ChooseApplicationID
set(APPLICATION_ID "com.example.joguinho_estupido")
set(APPLICATION_ID "com.example.cpscounter")

# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ static void my_application_activate(GApplication* application) {
if (use_header_bar) {
GtkHeaderBar* header_bar = GTK_HEADER_BAR(gtk_header_bar_new());
gtk_widget_show(GTK_WIDGET(header_bar));
gtk_header_bar_set_title(header_bar, "joguinho_estupido");
gtk_header_bar_set_title(header_bar, "cpscounter");
gtk_header_bar_set_show_close_button(header_bar, TRUE);
gtk_window_set_titlebar(window, GTK_WIDGET(header_bar));
} else {
gtk_window_set_title(window, "joguinho_estupido");
gtk_window_set_title(window, "cpscounter");
}

gtk_window_set_default_size(window, 1280, 720);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@
import FlutterMacOS
import Foundation

import path_provider_foundation

func RegisterGeneratedPlugins(registry: FlutterPluginRegistry) {
PathProviderPlugin.register(with: registry.registrar(forPlugin: "PathProviderPlugin"))
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
/* Begin PBXFileReference section */
333000ED22D3DE5D00554162 /* Warnings.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = Warnings.xcconfig; sourceTree = "<group>"; };
335BBD1A22A9A15E00E9071D /* GeneratedPluginRegistrant.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GeneratedPluginRegistrant.swift; sourceTree = "<group>"; };
33CC10ED2044A3C60003C045 /* joguinho_estupido.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "joguinho_estupido.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10ED2044A3C60003C045 /* cpscounter.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "cpscounter.app"; sourceTree = BUILT_PRODUCTS_DIR; };
33CC10F02044A3C60003C045 /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = "<group>"; };
33CC10F22044A3C60003C045 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Assets.xcassets; path = Runner/Assets.xcassets; sourceTree = "<group>"; };
33CC10F52044A3C60003C045 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/MainMenu.xib; sourceTree = "<group>"; };
Expand Down Expand Up @@ -105,7 +105,7 @@
33CC10EE2044A3C60003C045 /* Products */ = {
isa = PBXGroup;
children = (
33CC10ED2044A3C60003C045 /* joguinho_estupido.app */,
33CC10ED2044A3C60003C045 /* cpscounter.app */,
);
name = Products;
sourceTree = "<group>";
Expand Down Expand Up @@ -172,7 +172,7 @@
);
name = Runner;
productName = Runner;
productReference = 33CC10ED2044A3C60003C045 /* joguinho_estupido.app */;
productReference = 33CC10ED2044A3C60003C045 /* cpscounter.app */;
productType = "com.apple.product-type.application";
};
/* End PBXNativeTarget section */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "joguinho_estupido.app"
BuildableName = "cpscounter.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
Expand All @@ -31,7 +31,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "joguinho_estupido.app"
BuildableName = "cpscounter.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
Expand All @@ -54,7 +54,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "joguinho_estupido.app"
BuildableName = "cpscounter.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
Expand All @@ -71,7 +71,7 @@
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "33CC10EC2044A3C60003C045"
BuildableName = "joguinho_estupido.app"
BuildableName = "cpscounter.app"
BlueprintName = "Runner"
ReferencedContainer = "container:Runner.xcodeproj">
</BuildableReference>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// 'flutter create' template.

// The application's name. By default this is also the title of the Flutter window.
PRODUCT_NAME = joguinho_estupido
PRODUCT_NAME = cpscounter

// The application's bundle identifier
PRODUCT_BUNDLE_IDENTIFIER = com.example.joguinhoEstupido
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,4 @@ packages:
source: hosted
version: "2.1.4"
sdks:
dart: ">=2.19.4 <3.0.0"
dart: ">=2.19.5 <3.0.0"
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: joguinho_estupido
name: cpscounter
description: A new Flutter project.
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
Expand Down Expand Up @@ -36,7 +36,6 @@ dependencies:
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.2
path_provider: ^2.0.14

dev_dependencies:
flutter_test:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:joguinho_estupido/main.dart';
import 'package:cpscounter/main.dart';

void main() {
testWidgets('Counter increments smoke test', (WidgetTester tester) async {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
<!-- iOS meta tags & icons -->
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="auxiliar_examples">
<meta name="apple-mobile-web-app-title" content="cpscounter">
<link rel="apple-touch-icon" href="icons/Icon-192.png">

<!-- Favicon -->
<link rel="icon" type="image/png" href="favicon.png"/>

<title>auxiliar_examples</title>
<title>cpscounter</title>
<link rel="manifest" href="manifest.json">

<script>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "auxiliar_examples",
"short_name": "auxiliar_examples",
"name": "cpscounter",
"short_name": "cpscounter",
"start_url": ".",
"display": "standalone",
"background_color": "#0175C2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
# Project-level configuration.
cmake_minimum_required(VERSION 3.14)
project(joguinho_estupido LANGUAGES CXX)
project(cpscounter LANGUAGES CXX)

# The name of the executable created for the application. Change this to change
# the on-disk name of your application.
set(BINARY_NAME "joguinho_estupido")
set(BINARY_NAME "cpscounter")

# Explicitly opt in to modern CMake behaviors to avoid warnings with recent
# versions of CMake.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,12 +90,12 @@ BEGIN
BLOCK "040904e4"
BEGIN
VALUE "CompanyName", "com.example" "\0"
VALUE "FileDescription", "joguinho_estupido" "\0"
VALUE "FileDescription", "cpscounter" "\0"
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "joguinho_estupido" "\0"
VALUE "InternalName", "cpscounter" "\0"
VALUE "LegalCopyright", "Copyright (C) 2023 com.example. All rights reserved." "\0"
VALUE "OriginalFilename", "joguinho_estupido.exe" "\0"
VALUE "ProductName", "joguinho_estupido" "\0"
VALUE "OriginalFilename", "cpscounter.exe" "\0"
VALUE "ProductName", "cpscounter" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
END
END
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
FlutterWindow window(project);
Win32Window::Point origin(10, 10);
Win32Window::Size size(1280, 720);
if (!window.Create(L"joguinho_estupido", origin, size)) {
if (!window.Create(L"cpscounter", origin, size)) {
return EXIT_FAILURE;
}
window.SetQuitOnClose(true);
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Loading

0 comments on commit 2089ca9

Please sign in to comment.