diff --git a/lib/Screens/circuit.dart b/lib/Screens/circuit.dart index 5dd05b0..0bf3b20 100644 --- a/lib/Screens/circuit.dart +++ b/lib/Screens/circuit.dart @@ -357,7 +357,8 @@ class RaceImageProvider extends StatelessWidget { if (scheduleLastSavedFormat == 'ergast') { return RaceTracksUrls().getRaceTrackImageUrl(race.circuitId); } else { - String coverUrl = race.raceCoverUrl!; + String coverUrl = + 'https://media.formula1.com/image/upload/f_auto,c_limit,w_1440,q_auto/f_auto/q_auto/content/dam/fom-website/2018-redesign-assets/Racehub%20header%20images%2016x9/${race.country.replaceAll(" ", "_")}.jpg'; if (race.country == 'Great Britain') { coverUrl = race.raceCoverUrl! .replaceFirst('United_Kingdom', 'Great_Britain'); diff --git a/lib/api/formula1.dart b/lib/api/formula1.dart index 9c912c7..bbf369f 100644 --- a/lib/api/formula1.dart +++ b/lib/api/formula1.dart @@ -817,6 +817,18 @@ class Formula1 { } else if (element['meetingCountryName'] == 'Las Vegas') { detailsPath = 'Las_Vegas'; } + String raceCoverUrl = element['thumbnail']['image']['url']; + if (element['meetingName'] != 'Pre-Season Testing') { + var tmp = element['thumbnail']['image']['url'] + .replaceAll('race-listing/', '') + .split('/'); + tmp.removeLast(); + raceCoverUrl = tmp.join('/') + + '/' + + element['meetingName'].replaceAll(" ", "_") + + '.jpg'; + } + races.add( Race( finalJson.indexOf(element).toString(), @@ -830,7 +842,7 @@ class Formula1 { element['meetingCountryName'], [], isFirst: races.isEmpty, - raceCoverUrl: element['thumbnail']['image']['url'], + raceCoverUrl: raceCoverUrl, detailsPath: detailsPath, isPreSeasonTesting: element['type'] == 'fom-testing', ),