-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Incremented Version Code * fixes #4 Fixes #4 the home widget had to be put into a seperate class otherwise exceptions were raised. * fixes #6 Sounds are now locally cached for 7 days * Added schedule to drawer and frame for page * Setup schedule tabs * Initial schedule features added * Improved error handling * Fixes blank screen if no events * Fixed blank screen when no schedules * Added clarification to schedule state * Aligned Text and Icons in drawer * Converted all timestamps to utc * Fixed state checking logic * Finalised schedule closes #5 * Changed App Colour to match primary * Allow for text overflow
- Loading branch information
1 parent
62481d1
commit aa230c2
Showing
22 changed files
with
518 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class ActivityData { | ||
final String _name; | ||
final String _description; | ||
final int _startTimestamp; | ||
final int _endTimestamp; | ||
|
||
ActivityData( | ||
this._name, | ||
this._description, | ||
this._startTimestamp, | ||
this._endTimestamp | ||
); | ||
|
||
get name => _name; | ||
get description => _description; | ||
get startTimestamp => _startTimestamp; | ||
get endTimestamp => _endTimestamp; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
import 'package:firebase_database/firebase_database.dart'; | ||
import 'package:firebase_analytics/firebase_analytics.dart'; | ||
|
||
import 'package:cyber_discovery/widgets/drawer_header.dart'; | ||
import 'package:cyber_discovery/widgets/list_item.dart'; | ||
import 'package:cyber_discovery/pages/event_page.dart'; | ||
import 'package:cyber_discovery/pages/schedule_page.dart'; | ||
import 'package:cyber_discovery/pages/soundboard_page.dart'; | ||
import 'package:cyber_discovery/pages/blog_page.dart'; | ||
import 'package:cyber_discovery/widgets/error_message.dart'; | ||
|
||
class HomePage extends StatefulWidget { | ||
final FirebaseDatabase _db; | ||
final FirebaseAnalytics _analytics; | ||
HomePage(this._db, this._analytics); | ||
|
||
@override | ||
_HomePageState createState() => _HomePageState(_db, _analytics); | ||
} | ||
|
||
class _HomePageState extends State<HomePage> { | ||
final FirebaseDatabase db; | ||
final FirebaseAnalytics analytics; | ||
_HomePageState(this.db, this.analytics); | ||
|
||
int _pageId = 0; | ||
|
||
Widget getActivePage(id, db) { | ||
switch(id) { | ||
case 0: | ||
return new EventPage(db); | ||
case 1: | ||
return new SoundBoardPage(db, analytics); | ||
case 2: | ||
return new BlogPage(); | ||
case 3: | ||
return new SchedulePage(db); | ||
default: | ||
return new ErrorMessage("Welp Something Went Wrong", "Unknown Cause"); | ||
} | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return new Scaffold( | ||
appBar: new AppBar( | ||
title: new Text("Cyber Discovery"), | ||
), | ||
drawer: new Drawer( | ||
child: new Container( | ||
color: Colors.deepPurple[500], | ||
child: new ListView( | ||
children: <Widget>[ | ||
new DrawerHead(), | ||
new ListItem(Icons.access_time, "Events", (){setState( | ||
(){ | ||
_pageId = 0; | ||
Navigator.pop(context); | ||
}); | ||
}), | ||
new ListItem(Icons.calendar_today, "Schedule", (){setState( | ||
(){ | ||
_pageId = 3; | ||
Navigator.pop(context); | ||
} | ||
);} | ||
), | ||
new ListItem(Icons.notifications, "Soundboard", (){setState( | ||
(){ | ||
_pageId = 1; | ||
Navigator.pop(context); | ||
}); | ||
}), | ||
new ListItem(Icons.library_books, "Blog", (){setState( | ||
(){ | ||
_pageId = 2; | ||
Navigator.pop(context); | ||
}); | ||
}), | ||
], | ||
), | ||
), | ||
), | ||
body: getActivePage(_pageId, db), | ||
backgroundColor: new Color.fromRGBO(9, 24, 35, 1.0) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'dart:async'; | ||
|
||
import 'package:firebase_database/firebase_database.dart'; | ||
|
||
import 'package:cyber_discovery/widgets/schedule_tab.dart'; | ||
import 'package:cyber_discovery/widgets/error_message.dart'; | ||
|
||
class SchedulePage extends StatelessWidget { | ||
final FirebaseDatabase _db; | ||
SchedulePage(this._db); | ||
|
||
Future<DataSnapshot> getTabData() { | ||
return _db.reference().child("Schedule").child("Tabs").once(); | ||
} | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
return new FutureBuilder<DataSnapshot>( | ||
future: getTabData(), | ||
builder: (BuildContext context, AsyncSnapshot<DataSnapshot> snapshot){ | ||
switch(snapshot.connectionState) { | ||
case ConnectionState.waiting: | ||
return new Center( | ||
child: new CircularProgressIndicator(), | ||
); | ||
case ConnectionState.done: | ||
//Load Tabs | ||
var data = snapshot.data.value; | ||
int i = 0; | ||
int count = data["count"]; | ||
List<Widget> tabs = []; | ||
List<Widget> tabPages = []; | ||
for(i; i < count; i++) { | ||
tabs.add(new Tab(text: data[i.toString()])); | ||
tabPages.add(new ScheduleTab(_db, data[i.toString()])); | ||
} | ||
|
||
if (tabs.length > 0) { | ||
return new DefaultTabController( | ||
length: i+1, | ||
child: new Scaffold( | ||
backgroundColor: new Color.fromRGBO(13, 35, 50, 1.0), | ||
appBar: new TabBar( | ||
tabs: tabs, | ||
indicatorColor: Theme.of(context).primaryColor, | ||
), | ||
body: new TabBarView( | ||
children: tabPages, | ||
), | ||
), | ||
); | ||
} | ||
return new ErrorMessage("There are currently no listed schedules", "Who forgot to put the schedules in the database?"); | ||
default: | ||
return new ErrorMessage("Welp Something Went Wrong", "Check your connection to the internet"); | ||
} | ||
}, | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class ScheduleState { | ||
final String _state; | ||
final bool _active; | ||
|
||
ScheduleState(this._state, this._active); | ||
|
||
get state => _state; | ||
get active => _active; | ||
} |
Oops, something went wrong.