Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,21 +50,21 @@ jobs:
- name: Get dependencies
run: flutter pub get

- name: Create google-services.json
run: cat /home/runner/work/Makeathon5_app/Makeathon5_app/app/google-services.json | base64
# - name: Create google-services.json
# run: cat /home/runner/work/Makeathon5_app/Makeathon5_app/app/google-services.json | base64

- name: Putting data into google-services.json
env:
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
run: echo $GOOGLE_SERVICES_JSON | base64 -di > ./android/app/google-services.json
# - name: Putting data into google-services.json
# env:
# GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }}
# run: echo $GOOGLE_SERVICES_JSON | base64 -di > ./android/app/google-services.json

- name: Create firebase_options.dart
run: cat /home/runner/work/Makeathon5_app/Makeathon5_app/lib/firebase_options.dart | base64
# - name: Create firebase_options.dart
# run: cat /home/runner/work/Makeathon5_app/Makeathon5_app/lib/firebase_options.dart | base64

- name: Putting data into firebase_options.dart
env:
FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
run: echo $FIREBASE_OPTIONS | base64 -di > ./lib/firebase_options.dart
# - name: Putting data into firebase_options.dart
# env:
# FIREBASE_OPTIONS: ${{ secrets.FIREBASE_OPTIONS }}
# run: echo $FIREBASE_OPTIONS | base64 -di > ./lib/firebase_options.dart

# Runs a set of commands using the runners shell
- name: Start release build
Expand Down
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ app.*.map.json
/android/app/release

#Firebase
/lib/firebase_options.dart
/android/app/google-services.json
/ios/firebase_app_id_file.json
# /lib/firebase_options.dart
# /android/app/google-services.json
# /ios/firebase_app_id_file.json

Binary file modified Assets/vector.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Assets/vector4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ This section provides all the details needed to start contributing to this proje

- Open the project in your IDE

- Initialise Firebase:
- Open your firebase console and create a new project
- Activate firebase using your terminal ```dart pub global activate flutterfire_cli```
- Run ```flutterfire configure --project=[Project-ID]``` from your project directory, (Replace [Project-ID] with the project ID from your firebase project or directly copy the command with the project ID from your Firebase console.)
- If asked to select platforms for configuring Firebase, select only Android & IOS
~~Initialise Firebase:~~
~~- Open your firebase console and create a new project~~
~~- Activate firebase using your terminal ```dart pub global activate flutterfire_cli```~~
~~- Run ```flutterfire configure --project=[Project-ID]``` from your project directory, (Replace [Project-ID] with the project ID from your~~ ~~firebase project or directly copy the command with the project ID from your Firebase console.)~~
~~- If asked to select platforms for configuring Firebase, select only Android & IOS~~

- We have connected a dummy firebase database so you do not have to configure firebase anymore.
- run ```flutter pub get```

Your project is now all set-up in your local machine!!
Expand Down
57 changes: 57 additions & 0 deletions android/app/google-services.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"project_info": {
"project_number": "962819408926",
"firebase_url": "https://make5app-dummy-default-rtdb.firebaseio.com",
"project_id": "make5app-dummy",
"storage_bucket": "make5app-dummy.appspot.com"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "1:962819408926:android:09dd55ce0b250e83181a0f",
"android_client_info": {
"package_name": "com.example.makeathon5_app"
}
},
"oauth_client": [
{
"client_id": "962819408926-s6p8991knv2traif6cempkub8vkn1k2h.apps.googleusercontent.com",
"client_type": 1,
"android_info": {
"package_name": "com.example.makeathon5_app",
"certificate_hash": "9f09222d58c8315f47aa8d807c92efcde29cd6fe"
}
},
{
"client_id": "962819408926-88ci77f7607hpjsadk15psg60medv7uc.apps.googleusercontent.com",
"client_type": 3
}
],
"api_key": [
{
"current_key": "AIzaSyDMF4heZmdjWorNFjCLIXayNr1huxT9oYo"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": [
{

"client_id": "962819408926-88ci77f7607hpjsadk15psg60medv7uc.apps.googleusercontent.com",
"client_type": 3
},
{
"client_id": "962819408926-fjvgqgmjj1n1rfjshk4dq1crfdqmrh7r.apps.googleusercontent.com",
"client_type": 2,
"ios_info": {
"bundle_id": "com.example.makeathon5App"
}
}
]
}
}
}
],
"configuration_version": "1"
}

7 changes: 7 additions & 0 deletions ios/firebase_app_id_file.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"file_generated_by": "FlutterFire CLI",
"purpose": "FirebaseAppID & ProjectID for this Firebase app in this directory",
"GOOGLE_APP_ID": "1:962819408926:ios:c4d8255eee42004c181a0f",
"FIREBASE_PROJECT_ID": "make5app-dummy",
"GCM_SENDER_ID": "962819408926"
}
30 changes: 30 additions & 0 deletions lib/AnnouncementsPage/announcement.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import 'package:intl/intl.dart';

class Announcement {
List months = [
'Jan',
'Feb',
'Mar',
'Apr',
'May',
'Jun',
'Jul',
'Aug',
'Sep',
'Oct',
'Nov',
'Dec'
];
DateFormat dateFormat = DateFormat("yyyy-MM-dd HH:mm:ss");
String? body;
String? time;
String? date;
String? formattedDateTime;
DateTime? dateTime;

Announcement({this.body, this.formattedDateTime}) {
dateTime = dateFormat.parse(formattedDateTime!);
date = "${dateTime!.day} ${months[dateTime!.month]}";
time = DateFormat("hh:mm a").format(dateTime!);
}
}
58 changes: 58 additions & 0 deletions lib/AnnouncementsPage/announcement_card.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'announcement.dart';

class AnnouncementCard extends StatelessWidget {
Announcement? announcement;

AnnouncementCard(this.announcement);
@override
Widget build(BuildContext context) {
return Card(
margin: EdgeInsets.only(bottom: 20),
elevation: 4,
clipBehavior: Clip.antiAlias,
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(18)),
child: Material(
child: InkWell(
splashFactory: InkRipple.splashFactory,
splashColor: Color.fromARGB(66, 128, 128, 128),
onTap: () {
print('Tapped!');
},
child: Container(
padding: EdgeInsets.fromLTRB(5, 10, 5, 10),
child: ListTile(
title: Row(
children: [
Text(
announcement!.time!,
style: TextStyle(
fontFamily: 'Inter', fontWeight: FontWeight.bold),
),
Spacer(),
Text(
announcement!.date!,
style: TextStyle(
fontFamily: 'Inter', fontWeight: FontWeight.bold),
),
],
),
subtitle: Container(
margin: EdgeInsets.only(top: 10),
child: Text(
announcement!.body!,
style: TextStyle(
color: Colors.black,
fontFamily: 'Inter',
),
textAlign: TextAlign.left,
),
),
),
),
),
),
);
}
}
84 changes: 84 additions & 0 deletions lib/AnnouncementsPage/main.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_database/firebase_database.dart';
import 'package:flutter/material.dart';
import 'package:makeathon5_app/AnnouncementsPage/announcement.dart';
import 'package:makeathon5_app/AnnouncementsPage/announcement_card.dart';
import 'package:makeathon5_app/AnnouncementsPage/top_bar.dart';

import '../firebase_options.dart';

class AnnouncementsPage extends StatefulWidget {
@override
State<AnnouncementsPage> createState() => _AnnouncementsPage();
}

class _AnnouncementsPage extends State<AnnouncementsPage> {
var announcements = <Announcement>[];
bool buffering = true;

@override
void initState() {
super.initState();
fetchAnnouncements();
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
children: [
TopBar(),
Visibility(
visible: buffering,
child: Container(
margin: EdgeInsets.only(
top: MediaQuery.of(context).size.height / 3.5),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Spacer(),
Row(
children: [Spacer(), CircularProgressIndicator(), Spacer()],
),
Spacer()
],
),
),
),
Container(
margin:
EdgeInsets.only(top: MediaQuery.of(context).size.height / 3.5),
child: ListView.builder(
padding: EdgeInsets.all(15),
itemBuilder: (context, position) {
return AnnouncementCard(
announcements[announcements.length - position - 1]);
},
itemCount: announcements.length,
),
)
],
),
);
}

Future<void> fetchAnnouncements() async {
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
DatabaseReference announcementsRef =
FirebaseDatabase.instance.ref().child("Announcements");
announcementsRef.onChildAdded.listen((event) {
Announcement announcement = Announcement(
formattedDateTime: event.snapshot.child("time").value.toString(),
body: event.snapshot.child("body").value.toString(),
);
setState(
() {
announcements.add(announcement);
buffering = false;
},
);
});
}
}
70 changes: 70 additions & 0 deletions lib/AnnouncementsPage/top_bar.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import 'package:flutter/material.dart';

class TopBar extends StatelessWidget {
static double? height;
@override
Widget build(BuildContext context) {
height = MediaQuery.of(context).size.height / 3.5;
return Stack(
children: [
Image.asset(
'Assets/vector2.png',
width: MediaQuery.of(context).size.width,
height: height,
fit: BoxFit.fill,
),
Column(
children: [
Container(
child: Image.asset(
'Assets/vector7.png',
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height / 5.5,
fit: BoxFit.fill,
),
),
Container(
transform: Matrix4.translationValues(
0, -MediaQuery.of(context).size.height / 13, 0),
child: Row(
children: [
SizedBox(
width: MediaQuery.of(context).size.width / 15,
),
Text(
"Announcements",
style: TextStyle(
fontSize: 30,
color: Colors.white,
fontFamily: 'Jejugothic'),
),
],
),
),
],
),
Padding(
padding: EdgeInsets.only(top: 50, bottom: 40, left: 20, right: 20),
child: Column(
children: [
Row(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// Image.asset(
// 'Assets/back_arrow.png',
// scale: 1.25,
// ),
Spacer(),
Image.asset(
'Assets/MLSClogo.png',
scale: 2.75,
),
],
),
],
),
),
],
);
}
}
Loading