Skip to content

Commit

Permalink
feat:home_page
Browse files Browse the repository at this point in the history
  • Loading branch information
pxnchxm1 committed Jan 19, 2024
1 parent e683191 commit dbb4fcc
Show file tree
Hide file tree
Showing 3 changed files with 232 additions and 15 deletions.
238 changes: 223 additions & 15 deletions lib/pages/home.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'package:firebase_messaging/firebase_messaging.dart';
import 'package:firebase_auth/firebase_auth.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';

class Home extends StatefulWidget {
const Home({super.key});
Expand Down Expand Up @@ -70,23 +72,229 @@ class _HomeState extends State<Home> {
"Class 9"
],
};
String t_c = "Today";
String dayOrder = "Day 1";

@override
void initState() {
// TODO: implement initState
super.initState();
FirebaseMessaging.onMessage.listen((RemoteMessage message) {
print('Got a message whilst in the foreground!');
print('Message data: ${message.data}');
Widget build(BuildContext context) {
return Scaffold(
resizeToAvoidBottomInset: true,
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Container(
height: 200,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.primary,
borderRadius: const BorderRadius.only(
bottomLeft: Radius.circular(30),
bottomRight: Radius.circular(30))),
child: SizedBox(
height: 160,
child: Row(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(left: 4.0, right: 4),
child: RichText(
text: TextSpan(children: [
TextSpan(
text: "Hello,\n",
style: GoogleFonts.poppins(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Colors.white)),
TextSpan(
text: FirebaseAuth
.instance.currentUser!.displayName!
.split("(")
.first,
style: GoogleFonts.poppins(
fontWeight: FontWeight.bold,
fontSize: 18,
color:
Theme.of(context).colorScheme.tertiary))
]),
)),
const SizedBox(
height: 10,
),
Container(
height: 100,
width: 160,
decoration: BoxDecoration(
shape: BoxShape.circle,
border: Border.all(
color: Theme.of(context).colorScheme.tertiary,
width: 4),
image: DecorationImage(
fit: BoxFit.fill,
image: NetworkImage(FirebaseAuth
.instance.currentUser!.photoURL!))),
),
],
),
),
),
const SizedBox(height: 10),
//buttons today and calender
Padding(
padding: const EdgeInsets.all(8.0),
child: Wrap(
alignment: WrapAlignment.start,
direction: Axis.horizontal,
children: List.generate(2, (index) {
String t = "Today";
index == 0 ? t = "Today" : t = "Calender";
return Padding(
padding: const EdgeInsets.all(5.0),
child: TextButton(
onPressed: () {
setState(() {
t_c = t;
});
},
style: ButtonStyle(
elevation: const MaterialStatePropertyAll(5),
fixedSize: MaterialStatePropertyAll(Size(
((MediaQuery.of(context).size.width * 0.9) - 30) /
3,
40)),
backgroundColor: MaterialStatePropertyAll(
t_c == t
? Theme.of(context).colorScheme.primary
: Theme.of(context).colorScheme.secondary,
),
foregroundColor: MaterialStatePropertyAll(
t_c == t ? Colors.white : Colors.black,
),
shadowColor: MaterialStatePropertyAll(
Theme.of(context).colorScheme.secondary,
),
shape:
MaterialStateProperty.all<RoundedRectangleBorder>(
RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
),
),
child: Text(t.toString(),
style: GoogleFonts.poppins(
fontSize: 15,
fontWeight: FontWeight.bold,
color: t_c == t ? Colors.white : Colors.grey[800],
)),
),
);
}),
),
),

if (message.notification != null) {
print('Message also contained a notification: ${message.notification}');
}
});
}
//day text
Padding(
padding: const EdgeInsets.all(12.0),
child: RichText(
text: TextSpan(children: [
TextSpan(
text: DateFormat('EEEE, ').format(DateTime.now()),
style: GoogleFonts.poppins(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Theme.of(context).colorScheme.primary,
)),
TextSpan(
text: DateFormat('d MMMM y').format(DateTime.now()),
style: GoogleFonts.poppins(
fontWeight: FontWeight.bold,
fontSize: 18,
color: Theme.of(context).colorScheme.tertiary))
]),
)),

@override
Widget build(BuildContext context) {
return Scaffold();
//row
Row(
children: [
Padding(
padding: const EdgeInsets.only(
left: 10.0, top: 8, bottom: 8, right: 8),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text("Day Order",
style: GoogleFonts.poppins(
fontWeight: FontWeight.bold,
fontSize: 38,
color: Theme.of(context).colorScheme.primary,
)),
const SizedBox(height: 2),
Text(dayOrder,
style: GoogleFonts.poppins(
fontWeight: FontWeight.bold,
fontSize: 38,
color: Theme.of(context).colorScheme.primary,
)),
],
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Container(
height: 100,
width: 2,
color: Theme.of(context).colorScheme.primary,
),
),
Padding(
padding: const EdgeInsets.all(8.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text("08:30",
style: GoogleFonts.poppins(
fontWeight: FontWeight.normal,
fontSize: 38,
color: Theme.of(context).colorScheme.primary,
)),
Center(
child: Container(
height: 20,
width: 2,
color: Theme.of(context).colorScheme.secondary,
),
),
Text("09:20",
style: GoogleFonts.poppins(
fontWeight: FontWeight.normal,
fontSize: 38,
color: Theme.of(context).colorScheme.primary,
)),
],
),
),
],
),

//container for tt text and notif
const SizedBox(height: 5),
Padding(
padding: const EdgeInsets.all(15.0),
child: Container(
height: 150,
width: MediaQuery.of(context).size.width,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(30),
color: Theme.of(context).colorScheme.secondary,
),
),
),
//Container for present period and time
],
)));
}
}
8 changes: 8 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.0.2"
intl:
dependency: "direct main"
description:
name: intl
sha256: d6f56758b7d3014a48af9701c085700aac781a92a87a62b1333b46d8879661cf
url: "https://pub.dev"
source: hosted
version: "0.19.0"
js:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ dependencies:
shared_preferences: ^2.2.2
http: ^1.2.0
firebase_messaging: ^14.7.10
intl: ^0.19.0


dev_dependencies:
Expand Down

0 comments on commit dbb4fcc

Please sign in to comment.