Skip to content

Commit

Permalink
Mock some data on home
Browse files Browse the repository at this point in the history
  • Loading branch information
MaironLucas committed Jul 6, 2024
1 parent a12fa7c commit 72d202e
Show file tree
Hide file tree
Showing 11 changed files with 170 additions and 11 deletions.
17 changes: 17 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -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",
],
}
]
}
17 changes: 16 additions & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/common/routing/routing.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ final appRoutes = GoRouter(
GoRoute(
path: RoutePaths.homePath,
builder: (context, state) {
return const HomePage();
return HomePage();
},
),
],
Expand Down
1 change: 1 addition & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class _MyApp extends StatelessWidget {
MaterialTheme theme = MaterialTheme(textTheme);
return MaterialApp.router(
title: 'NBApp',
debugShowCheckedModeBanner: false,
theme: theme.dark(),
routerConfig: appRoutes,
);
Expand Down
142 changes: 134 additions & 8 deletions lib/presentation/home/home_page.dart
Original file line number Diff line number Diff line change
@@ -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(
Expand All @@ -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),
Expand All @@ -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,
),
],
),
),
),
),
],
),
),
),
],
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit 72d202e

Please sign in to comment.