Skip to content
This repository was archived by the owner on Feb 15, 2023. It is now read-only.

Commit

Permalink
Version 0.9.0 (preparing for initial release)
Browse files Browse the repository at this point in the history
  • Loading branch information
SheaBelsky committed Mar 13, 2019
1 parent 5cd51f8 commit b9deaa3
Show file tree
Hide file tree
Showing 11 changed files with 332 additions and 138 deletions.
2 changes: 0 additions & 2 deletions lib/classes/FirebaseManager.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// Dart imports
import 'dart:io';
import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';

// Firebase Analytics
import 'package:firebase_analytics/firebase_analytics.dart';
Expand Down
29 changes: 12 additions & 17 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ class _MyHomePageState extends State<MyHomePage> {

// If this date has never been set before, it means this is the user's first time
DateTime lastUpdatedAt = loadedAppState["tournamentsUpdatedAt"] != null
? DateTime.parse(loadedAppState["tournamentsUpdatedAt"])
: now;
? DateTime.parse(loadedAppState["tournamentsUpdatedAt"])
: now;

// If the last time the tournaments were updated was 7 or more days ago, update them now
if (lastUpdatedAt.difference(now).inDays >= 7 || lastUpdatedAt == now) {
Expand Down Expand Up @@ -142,13 +142,6 @@ class _MyHomePageState extends State<MyHomePage> {
});
}

/// Updates the state of the app locally to minimize I/O operations
void updateState(Map file) {
setState(() {
_appState = file;
});
}

/**
* Manages favorites
*/
Expand Down Expand Up @@ -222,9 +215,10 @@ class _MyHomePageState extends State<MyHomePage> {
if (tournaments is List && tournaments.length != 0) {
List<TournamentListItem> favoriteTournaments = _getFavoriteTournaments();
return Favorites(
addFavorite: _addFavorite,
removeFavorite: _removeFavorite,
tournaments: favoriteTournaments
addFavorite: _addFavorite,
firebaseManager: _firebaseManager,
removeFavorite: _removeFavorite,
tournaments: favoriteTournaments
);
}
else {
Expand All @@ -244,10 +238,11 @@ class _MyHomePageState extends State<MyHomePage> {
Widget _tournamentListView (List<TournamentListItem> tournaments) {
if (tournaments is List && tournaments.length != 0) {
return TournamentList(
addFavorite: _addFavorite,
favoriteTournaments: _getFavoriteTournaments(),
removeFavorite: _removeFavorite,
tournaments: tournaments
addFavorite: _addFavorite,
firebaseManager: _firebaseManager,
favoriteTournaments: _getFavoriteTournamentIDs(),
removeFavorite: _removeFavorite,
tournaments: tournaments
);
}
else {
Expand Down Expand Up @@ -280,7 +275,7 @@ class _MyHomePageState extends State<MyHomePage> {
items: [
BottomNavigationBarItem(icon: Icon(Icons.home), title: Text('Home'), backgroundColor: Colors.red),
BottomNavigationBarItem(icon: Icon(Icons.favorite), title: Text('Favorites'), backgroundColor: Colors.red),
BottomNavigationBarItem(icon: Icon(Icons.settings), title: Text('Settings'), backgroundColor: Colors.red),
BottomNavigationBarItem(icon: Icon(Icons.info), title: Text('About'), backgroundColor: Colors.red),
],
currentIndex: _selectedIndex,
fixedColor: Colors.red,
Expand Down
6 changes: 5 additions & 1 deletion lib/views/app/Favorites.dart
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:date_format/date_format.dart';
import 'package:ezra_companion/classes/TournamentListItem.dart';

// Route imports
import "package:ezra_companion/views/tournament/TournamentView.dart";

class Favorites extends StatelessWidget {
final Function addFavorite;
final Function removeFavorite;

final List tournaments;

final firebaseManager;

const Favorites({
Key key,
this.addFavorite,
this.firebaseManager,
this.removeFavorite,
this.tournaments,
}) : super(key: key);
Expand All @@ -39,6 +42,7 @@ class Favorites extends StatelessWidget {
builder: (context) {
return TournamentView(
addFavorite: addFavorite,
firebaseManager: firebaseManager,
isFavorited: true,
removeFavorite: removeFavorite,
tournamentInfo: tournaments[index]
Expand Down
39 changes: 21 additions & 18 deletions lib/views/app/Settings.dart
Original file line number Diff line number Diff line change
@@ -1,34 +1,37 @@
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';

// Allow people to opt into notifications from this tournament

// Allow staff members to enter a password that will opt them into staff-only notifications

// Class imports
import "package:ezra_companion/classes/TournamentListItem.dart";

class Settings extends StatelessWidget {
final Function handleResetButtonPress;

const Settings({
Key key,
this.handleResetButtonPress
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Column(
children: <Widget>[
Text('This is the settings page'),
RaisedButton(
child: Text("reset"),
onPressed: (() async {
await handleResetButtonPress();
// alert to something...
print('done');
}),
final TextTheme textTheme = Theme.of(context).textTheme;

return Center(
child: Padding(
padding: EdgeInsets.all(15),
child: Column(
children: <Widget>[
RichText(
textAlign: TextAlign.center,
text: TextSpan(
text: "About",
style: textTheme.headline
)
),
Text('The Ezra Companion is the official app for Ezra, the premier Science Olympiad tournament management system.'),
SizedBox(height: 30),
Text('Use this app to instantly view important information about a tournament, see a map of the tournament if available, and receive push notifications from tournament organizers.'),
SizedBox(height: 30),
],
)
],
)
);
}
}
7 changes: 6 additions & 1 deletion lib/views/app/TournamentList.dart
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,18 @@ List<TournamentListItem> parseTournaments(String responseBody) {
class TournamentList extends StatelessWidget {
final Function addFavorite;
final Function removeFavorite;

final firebaseManager;

final List favoriteTournaments;
final List tournaments;

TournamentList({
Key key,
this.addFavorite,
this.removeFavorite,
this.favoriteTournaments,
this.firebaseManager,
this.removeFavorite,
this.tournaments
}) : super(key: key);

Expand All @@ -73,6 +77,7 @@ class TournamentList extends StatelessWidget {
TournamentListItem currentTournament = tournaments[index];
return TournamentView(
addFavorite: addFavorite,
firebaseManager: firebaseManager,
isFavorited: favoriteTournaments.contains(currentTournament.ezraId),
removeFavorite: removeFavorite,
tournamentInfo: currentTournament
Expand Down
Loading

0 comments on commit b9deaa3

Please sign in to comment.