Skip to content

Commit

Permalink
fix sprint not loading
Browse files Browse the repository at this point in the history
upgrade deps
upgrade gradle
upgrade colors
removed teams overview
  • Loading branch information
dante-accenture committed May 7, 2024
1 parent 11fadd6 commit cb33b5a
Show file tree
Hide file tree
Showing 11 changed files with 223 additions and 119 deletions.
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ Formula 1 Paddock Club: the new companion app for F1 fans with a lot of features
- Race Pitstops
- Drivers Standing
- Constructors Standing
- Teams Overview
- Pit Stop Overview

---
Expand Down
14 changes: 5 additions & 9 deletions android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id "com.android.application"
id "kotlin-android"
id "dev.flutter.flutter-gradle-plugin"
}
def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,10 +11,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
Expand All @@ -21,10 +22,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion
Expand Down Expand Up @@ -67,5 +64,4 @@ flutter {
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
}
15 changes: 1 addition & 14 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
buildscript {
ext.kotlin_version = '1.7.10'
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.2.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
Expand All @@ -26,6 +13,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
30 changes: 22 additions & 8 deletions android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.2.0" apply false
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
}

include ":app"
10 changes: 5 additions & 5 deletions lib/common/bottom_bar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,23 +22,23 @@ Widget? getBottomBar(int index, BuildContext context) {
);
break;
case 1:
Navigator.pushReplacement(
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => const DriverStandingPage(),
),
);
break;
case 2:
Navigator.pushReplacement(
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => const TeamStandingPage(),
),
);
break;
case 3:
Navigator.pushReplacement(
Navigator.pushReplacement(
context,
MaterialPageRoute(
builder: (context) => const TeamOverviewPage(),
Expand Down Expand Up @@ -77,11 +77,11 @@ Widget? getBottomBar(int index, BuildContext context) {
),

/// Teams Overview
SalomonBottomBarItem(
/*SalomonBottomBarItem(
icon: const Icon(Icons.broadcast_on_personal),
title: const Text("Overview Team"),
selectedColor: AppColor.details,
),
),*/
],
);
}
8 changes: 3 additions & 5 deletions lib/common/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ class AppColor {
static const text = Color.fromARGB(255, 244, 246, 248);
static const details = Color.fromARGB(255, 90, 184, 150);
static const detailsSecondary = Color.fromARGB(255, 110, 60, 81);

}

class TeamColor {
Expand All @@ -16,9 +15,8 @@ class TeamColor {
static const ferrari = Color.fromARGB(255, 220, 0, 0);
static const alpine = Color.fromARGB(255, 0, 145, 255);
static const haas = Color.fromARGB(255, 255, 255, 255);
static const alfaRomeo = Color.fromARGB(255, 144, 0, 0);
static const sauber = Color(0xff52E252);
static const williams = Color.fromARGB(255, 0, 89, 255);
static const alphaTauri = Color.fromARGB(255, 43, 69, 98);
static const rbVisaCash = Color(0xff6692FF);
static const astonMartin = Color.fromARGB(255, 0, 111, 98);
}

}
15 changes: 7 additions & 8 deletions lib/controller/result_api.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Future<List<RaceRsultModel>> getRaceResult(String idRace) async {
RaceRsultModel driver;

driver = RaceRsultModel(
driverId: race["Driver"]["driverId"],
driverId: race["Driver"]["driverId"],
position: race["position"],
points: race["points"],
driverCode: race["Driver"]["code"],
Expand Down Expand Up @@ -80,20 +80,19 @@ Future<List<QualyRsultModel>> getQualyRsult(String idRace) async {
return results;
}



Future<List<RaceRsultModel>> getSprintResult(String idRace) async {
var response = await http.get(
Uri.parse('$calendarApi${DateTime.now().year}/$idRace/sprint.json'));

var response = await http
.get(Uri.parse('$calendarApi${DateTime.now().year}/$idRace/sprint.json'));

print(response.body);

List<RaceRsultModel> results = [];

var responseJson;
try {
responseJson = jsonDecode(response.body);
responseJson = responseJson["MRData"]["RaceTable"]["Races"][0]["Results"];
responseJson =
responseJson["MRData"]["RaceTable"]["Races"][0]["SprintResults"];
} on RangeError {
return results;
}
Expand All @@ -102,7 +101,7 @@ Future<List<RaceRsultModel>> getSprintResult(String idRace) async {
RaceRsultModel driver;

driver = RaceRsultModel(
driverId: race["Driver"]["driverId"],
driverId: race["Driver"]["driverId"],
position: race["position"],
points: race["points"],
driverCode: race["Driver"]["code"],
Expand Down
19 changes: 13 additions & 6 deletions lib/controller/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,15 @@ String getFlagFromName(String country) {
if (locale == "sp") locale = "es";
if (locale == "ja") locale = "jp";
if (locale == "uk") locale = "gb-nir";
if (locale == "ch") locale = "cn";
if (locale == "mo") locale = "mc";
if (locale == "ne") locale = "nl";
if (locale == "ba") locale = "bh";
if (locale == "si") locale = "sg";
if (locale == "me") locale = "mx";
if (locale == "ua") locale = "ae";

return "icons/flags/png/$locale.png";
return "icons/flags/png250px/$locale.png";
}

Color? getTeamColor(String team) {
Expand All @@ -24,17 +31,17 @@ Color? getTeamColor(String team) {
return TeamColor.ferrari;
case "Mercedes":
return TeamColor.mercedes;
case "Alfa Romeo":
return TeamColor.alfaRomeo;
case "Sauber":
return TeamColor.sauber;
case "Alpine F1 Team":
return TeamColor.alpine;
case "Williams":
return TeamColor.williams;
case "AlphaTauri":
return TeamColor.alphaTauri;
case "RB F1 Team":
return TeamColor.rbVisaCash;
case "Haas F1 Team":
return TeamColor.haas;

default:
return Colors.amber;
}
Expand Down
16 changes: 8 additions & 8 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,17 @@ class MyApp extends StatelessWidget {
return MaterialApp(
title: 'F1 Paddock',
theme: ThemeData(

primarySwatch: Colors.red,
useMaterial3: false,
),
home: FlutterSplashScreen.gif(
backgroundColor: const Color.fromARGB(255, 219, 239, 251),
gifHeight: 300,
gifWidth: 400,
gifPath: 'assets/splash.gif',
defaultNextScreen: const CalendarPage(),
duration: const Duration(seconds: 5),
),
backgroundColor: const Color.fromARGB(255, 219, 239, 251),
gifHeight: 300,
gifWidth: 400,
gifPath: 'assets/splash.gif',
nextScreen: const CalendarPage(),
duration: const Duration(seconds: 5),
),
);
}
}
Loading

0 comments on commit cb33b5a

Please sign in to comment.