From 72d202e37275e3d5e323bb6d6cdc391d5cd64814 Mon Sep 17 00:00:00 2001 From: Mairon Lucas Date: Sat, 6 Jul 2024 15:07:20 -0300 Subject: [PATCH] Mock some data on home --- .vscode/launch.json | 17 +++ android/app/build.gradle | 17 ++- .../{ic_launcher.png => ic_launcher.jpg} | Bin .../{ic_launcher.png => ic_launcher.jpg} | Bin .../{ic_launcher.png => ic_launcher.jpg} | Bin .../{ic_launcher.png => ic_launcher.jpg} | Bin .../{ic_launcher.png => ic_launcher.jpg} | Bin lib/common/routing/routing.dart | 2 +- lib/main.dart | 1 + lib/presentation/home/home_page.dart | 142 +++++++++++++++++- pubspec.yaml | 2 +- 11 files changed, 170 insertions(+), 11 deletions(-) create mode 100644 .vscode/launch.json rename android/app/src/main/res/mipmap-hdpi/{ic_launcher.png => ic_launcher.jpg} (100%) rename android/app/src/main/res/mipmap-mdpi/{ic_launcher.png => ic_launcher.jpg} (100%) rename android/app/src/main/res/mipmap-xhdpi/{ic_launcher.png => ic_launcher.jpg} (100%) rename android/app/src/main/res/mipmap-xxhdpi/{ic_launcher.png => ic_launcher.jpg} (100%) rename android/app/src/main/res/mipmap-xxxhdpi/{ic_launcher.png => ic_launcher.jpg} (100%) diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..be9c41c --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "DEV", + "request": "launch", + "type": "dart", + "flutterMode": "debug", + "args": [ + "--dart-define-from-file=.env", + ], + } + ] +} \ No newline at end of file diff --git a/android/app/build.gradle b/android/app/build.gradle index a277c5d..a1cdec4 100644 --- a/android/app/build.gradle +++ b/android/app/build.gradle @@ -23,6 +23,12 @@ if (flutterVersionName == null) { flutterVersionName = "1.0" } +def keystoreProperties = new Properties() +def keystorePropertiesFile = rootProject.file('key.properties') +if (keystorePropertiesFile.exists()) { + keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) +} + android { namespace = "com.mairon.nbapp" compileSdk = flutter.compileSdkVersion @@ -44,11 +50,20 @@ android { versionName = flutterVersionName } + signingConfigs { + release { + keyAlias keystoreProperties['keyAlias'] + keyPassword keystoreProperties['keyPassword'] + storeFile keystoreProperties['storeFile'] ? file(keystoreProperties['storeFile']) : null + storePassword keystoreProperties['storePassword'] + } + } + buildTypes { release { // TODO: Add your own signing config for the release build. // Signing with the debug keys for now, so `flutter run --release` works. - signingConfig = signingConfigs.debug + signingConfig signingConfigs.release } } } diff --git a/android/app/src/main/res/mipmap-hdpi/ic_launcher.png b/android/app/src/main/res/mipmap-hdpi/ic_launcher.jpg similarity index 100% rename from android/app/src/main/res/mipmap-hdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-hdpi/ic_launcher.jpg diff --git a/android/app/src/main/res/mipmap-mdpi/ic_launcher.png b/android/app/src/main/res/mipmap-mdpi/ic_launcher.jpg similarity index 100% rename from android/app/src/main/res/mipmap-mdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-mdpi/ic_launcher.jpg diff --git a/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xhdpi/ic_launcher.jpg similarity index 100% rename from android/app/src/main/res/mipmap-xhdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-xhdpi/ic_launcher.jpg diff --git a/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.jpg similarity index 100% rename from android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-xxhdpi/ic_launcher.jpg diff --git a/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.jpg similarity index 100% rename from android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png rename to android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.jpg diff --git a/lib/common/routing/routing.dart b/lib/common/routing/routing.dart index 0aa4c63..9f0924f 100644 --- a/lib/common/routing/routing.dart +++ b/lib/common/routing/routing.dart @@ -9,7 +9,7 @@ final appRoutes = GoRouter( GoRoute( path: RoutePaths.homePath, builder: (context, state) { - return const HomePage(); + return HomePage(); }, ), ], diff --git a/lib/main.dart b/lib/main.dart index b030c04..8868d03 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -45,6 +45,7 @@ class _MyApp extends StatelessWidget { MaterialTheme theme = MaterialTheme(textTheme); return MaterialApp.router( title: 'NBApp', + debugShowCheckedModeBanner: false, theme: theme.dark(), routerConfig: appRoutes, ); diff --git a/lib/presentation/home/home_page.dart b/lib/presentation/home/home_page.dart index c0596d6..26fdcee 100644 --- a/lib/presentation/home/home_page.dart +++ b/lib/presentation/home/home_page.dart @@ -1,10 +1,87 @@ +import 'package:domain/model/game_status.dart'; +import 'package:domain/model/game_summary.dart'; +import 'package:domain/model/team.dart'; +import 'package:domain/model/team_score.dart'; import 'package:flutter/material.dart'; class HomePage extends StatelessWidget { - const HomePage({ + HomePage({ super.key, }); + final isEmpty = false; + + final mockGames = [ + // GameSummary( + // date: DateTime.now(), + // period: 1, + // gameStatus: GameStatus( + // isFinished: false, + // isHalfTime: false, + // ), + // id: '123', + // arenaName: 'Crypto Arena', + // homeTeam: Team( + // id: 'hasd', + // name: 'Los Angeles Lakers', + // nickName: 'Lakers', + // code: 'LKR', + // logoUrl: + // 'https://upload.wikimedia.org/wikipedia/commons/thumb/3/3c/Los_Angeles_Lakers_logo.svg/220px-Los_Angeles_Lakers_logo.svg.png'), + // visitorTeam: Team( + // id: 'hasd', + // name: 'Boston Celtics', + // nickName: 'Celtics', + // code: 'BCS', + // logoUrl: + // 'https://upload.wikimedia.org/wikipedia/fr/thumb/6/65/Celtics_de_Boston_logo.svg/1024px-Celtics_de_Boston_logo.svg.png'), + // homeTeamScore: TeamScore( + // wins: 10, + // loses: 5, + // points: 27, + // ), + // visitorTeamScore: TeamScore( + // wins: 13, + // loses: 2, + // points: 33, + // ), + // ), + // GameSummary( + // date: DateTime.now(), + // period: 4, + // gameStatus: GameStatus( + // isFinished: false, + // isHalfTime: false, + // ), + // id: '123', + // arenaName: 'Crypto Arena', + // homeTeam: Team( + // id: 'hasd', + // name: 'Atlanta Hawks', + // nickName: 'Lakers', + // code: 'LKR', + // logoUrl: + // 'https://upload.wikimedia.org/wikipedia/fr/e/ee/Hawks_2016.png'), + // visitorTeam: Team( + // id: 'hasd', + // name: 'Boston Celtics', + // nickName: 'Celtics', + // code: 'BCS', + // logoUrl: + // 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Brooklyn_Nets_newlogo.svg/130px-Brooklyn_Nets_newlogo.svg.png'), + // homeTeamScore: TeamScore( + // wins: 10, + // loses: 5, + // points: 120, + // ), + // visitorTeamScore: TeamScore( + // wins: 13, + // loses: 2, + // points: 100, + // ), + // ), + ]; + @override Widget build(BuildContext context) => Scaffold( appBar: AppBar( @@ -30,7 +107,7 @@ class HomePage extends StatelessWidget { ), SizedBox(height: 4), Container( - height: 120, + height: 168, decoration: BoxDecoration( color: Theme.of(context).colorScheme.surfaceContainer, borderRadius: BorderRadius.circular(8), @@ -39,12 +116,61 @@ class HomePage extends StatelessWidget { width: 1, ), ), - child: Center( - child: Text( - 'There is no game being played right now.\nCome back when the season starts!', - textAlign: TextAlign.center, - ), - ), + child: mockGames.isEmpty + ? Center( + child: Text( + 'There is no game being played right now.\nCome back when the season starts!', + textAlign: TextAlign.center, + ), + ) + : Padding( + padding: const EdgeInsets.all(8.0), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + ...mockGames.map( + (game) => Padding( + padding: + const EdgeInsets.symmetric(horizontal: 8.0), + child: Container( + decoration: BoxDecoration( + color: Theme.of(context) + .colorScheme + .surfaceContainer, + borderRadius: BorderRadius.circular(8), + border: Border.all( + color: + Theme.of(context).colorScheme.outline, + width: 1, + ), + ), + padding: EdgeInsets.all(4), + child: Column( + children: [ + Image.network( + game.homeTeam.logoUrl, + height: 50, + width: 50, + ), + Text( + game.homeTeamScore.points.toString(), + ), + Text( + game.visitorTeamScore.points.toString(), + ), + Image.network( + game.visitorTeam.logoUrl, + height: 50, + width: 50, + ), + ], + ), + ), + ), + ), + ], + ), + ), ), ], ), diff --git a/pubspec.yaml b/pubspec.yaml index 427c271..c32f964 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,7 +1,7 @@ name: nbapp description: "To follow NBA games and stats" publish_to: 'none' -version: 1.0.0+1 +version: 1.0.0+2 environment: sdk: '>=3.4.1 <4.0.0'