Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
WeiHen01 committed Aug 13, 2024
1 parent a20da9d commit 23cc637
Show file tree
Hide file tree
Showing 10 changed files with 844 additions and 268 deletions.
2 changes: 2 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@


allprojects {
repositories {
google()
Expand Down
2 changes: 1 addition & 1 deletion lib/Controller/Request Controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class WebRequestController{
//10.0.2.2
//192.168.8.119

String server = "http://192.168.115.212:8000/api/";
String server = "http://192.168.0.8:8000/api/";
http.Response? _res;
final Map<dynamic, dynamic> _body = {};
final Map<String, String> _headers = {};
Expand Down
20 changes: 20 additions & 0 deletions lib/View/Patient/Body Status/Body Home.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:convert'; //json encode/decode
import 'package:gradient_borders/box_borders/gradient_box_border.dart';
import 'package:http/http.dart' as http;
import 'dart:io';

Expand Down Expand Up @@ -647,6 +648,13 @@ class _BodyHomeState extends State<BodyHome> {
child: Container(
width: MediaQuery.of(context).size.width,
height: 180,
decoration: BoxDecoration(
border: Border.all(
color: Colors.black, // Border color
width: 4.0, // Border width
),

),
child: Stack(
children: [
Container(
Expand Down Expand Up @@ -687,6 +695,12 @@ class _BodyHomeState extends State<BodyHome> {
child: Container(
width: MediaQuery.of(context).size.width / 2,
height: MediaQuery.of(context).size.width / 2,
decoration: BoxDecoration(
border: Border.all(
color: Colors.black, // Border color
width: 4.0, // Border width
),
),
child: Stack(
children: [
Container(
Expand Down Expand Up @@ -763,6 +777,12 @@ class _BodyHomeState extends State<BodyHome> {
child: Container(
width: MediaQuery.of(context).size.width / 2,
height: MediaQuery.of(context).size.width / 2,
decoration: BoxDecoration(
border: Border.all(
color: Colors.black, // Border color
width: 4.0, // Border width
),
),
child: Stack(
children: [
Container(
Expand Down
128 changes: 119 additions & 9 deletions lib/View/Patient/Body Status/Heart Beat/Pulse Dashboard.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:calendar_date_picker2/calendar_date_picker2.dart';
import 'package:fl_chart/fl_chart.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
Expand Down Expand Up @@ -80,6 +81,29 @@ class _PulseDashboardState extends State<PulseDashboard> {
}
}

@override
void initState() {
// TODO: implement initState
super.initState();
// Initialize with today's date
selectedDate = DateTime.now();
}

DateTime? selectedDate;

DateTime today = DateTime.now();

// List of month names
final List<String> monthNames = [
'January', 'February', 'March', 'April',
'May', 'June', 'July', 'August',
'September', 'October', 'November', 'December'
];

DateTime? startRange, endRange;

String? dateRange;

@override
Widget build(BuildContext context) {
return Scaffold(
Expand Down Expand Up @@ -132,11 +156,55 @@ class _PulseDashboardState extends State<PulseDashboard> {

Padding(
padding: const EdgeInsets.all(8.0),
child: Text("Today", style: GoogleFonts.poppins(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 20.0
),),
child: InkWell(
onTap: ()async{
var date_result = await showCalendarDatePicker2Dialog(
context: context,
config: CalendarDatePicker2WithActionButtonsConfig(
controlsTextStyle: GoogleFonts.poppins(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
weekdayLabelTextStyle: GoogleFonts.poppins(fontWeight: FontWeight.bold, color: Colors.black),
lastMonthIcon: Icon(Icons.arrow_back_ios, color: Colors.black),
nextMonthIcon: Icon(Icons.arrow_forward_ios, color: Colors.black),

dayTextStyle: GoogleFonts.poppins(color: Colors.black),
monthTextStyle: GoogleFonts.poppins(color: Color(0xFF000000)),
yearTextStyle: GoogleFonts.poppins(color: Colors.black),
okButtonTextStyle: GoogleFonts.poppins(color: Color(0xFFFF4081), fontWeight: FontWeight.bold),
selectedMonthTextStyle: GoogleFonts.poppins(color: Colors.white),
selectedDayTextStyle: GoogleFonts.poppins(color: Colors.white),
selectedDayHighlightColor: Color(0xFFFF4081),

cancelButtonTextStyle: GoogleFonts.poppins(color: Color(0xFFFF4081), fontWeight: FontWeight.bold),


),
dialogSize: const Size(325, 400),
value: [selectedDate],
borderRadius: BorderRadius.circular(15),

);

// If results are not null and contain at least one date, update the selected date
if (date_result != null) {
setState(() {
selectedDate = date_result.last; // Update selected date to the first (and only) selected date
});
print("Selected Date: ${selectedDate.toString()}"); // Print the selected date

}
},
child: Row(
children: [
Text("${selectedDate == today ? "Today" : "${selectedDate!.day.toString()} ${monthNames[selectedDate!.month - 1]} ${selectedDate!.year.toString()}"} ", style: GoogleFonts.poppins(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18.0
),),

Icon(Icons.arrow_drop_down_sharp, color: Colors.white),
],
),
),
),

SizedBox(height: 10),
Expand Down Expand Up @@ -393,11 +461,18 @@ class _PulseDashboardState extends State<PulseDashboard> {

SizedBox(height: 20),


Padding(
padding: const EdgeInsets.all(8.0),
child: Text("${dateRange == null ? "" : dateRange}", style: GoogleFonts.poppins(
color: Colors.white,
fontSize: 13.0,
), textAlign: TextAlign.center),
),


Container(
alignment: Alignment.center,
height: 160,
height: 200,
padding: const EdgeInsets.all(8.0),
child: Column(
children: [
Expand All @@ -419,6 +494,7 @@ class _PulseDashboardState extends State<PulseDashboard> {
getAllPulseRecordsByToday();
setState(() {
graphTitle = "Today Pulse";
dateRange = null;
});
},
child: Card(
Expand Down Expand Up @@ -459,8 +535,42 @@ class _PulseDashboardState extends State<PulseDashboard> {


InkWell(
onTap: (){

onTap: () async{
var date_result = await showCalendarDatePicker2Dialog(
context: context,
config: CalendarDatePicker2WithActionButtonsConfig(
controlsTextStyle: GoogleFonts.poppins(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
selectedDayHighlightColor: Color(0xFFFF4081),
weekdayLabelTextStyle: GoogleFonts.poppins(fontWeight: FontWeight.bold, color: Colors.black),
lastMonthIcon: Icon(Icons.arrow_back_ios, color: Colors.black),
nextMonthIcon: Icon(Icons.arrow_forward_ios, color: Colors.black),

dayTextStyle: GoogleFonts.poppins(color: Colors.black),
monthTextStyle: GoogleFonts.poppins(color: Color(0xFF000000)),
yearTextStyle: GoogleFonts.poppins(color: Colors.black),
okButtonTextStyle: GoogleFonts.poppins(color: Color(0xFFFF4081), fontWeight: FontWeight.bold),
selectedMonthTextStyle: GoogleFonts.poppins(color: Colors.white),
selectedDayTextStyle: GoogleFonts.poppins(color: Colors.white),
calendarType: CalendarDatePicker2Type.range,
cancelButtonTextStyle: GoogleFonts.poppins(color: Color(0xFFFF4081), fontWeight: FontWeight.bold),

),
dialogSize: const Size(325, 400),
value: [startRange, endRange],
borderRadius: BorderRadius.circular(15),

);

// If results are not null and contain at least one date, update the selected date
if (date_result != null) {
setState(() {
startRange = date_result.first; // Update selected date to the first (and only) selected date
endRange = date_result.last;
dateRange = "Date Selected: ${startRange!.day} ${monthNames[startRange!.month - 1]} ${startRange!.year} - ${endRange!.day} ${monthNames[endRange!.month - 1]} ${endRange!.year} ";
});


}
},
child: Card(
elevation: 3,
Expand Down
78 changes: 74 additions & 4 deletions lib/View/Patient/Body Status/Heart Beat/Pulse History.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import 'package:calendar_date_picker2/calendar_date_picker2.dart';
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';

Expand Down Expand Up @@ -84,6 +85,15 @@ class _PulseHistoryState extends State<PulseHistory> {
}
}

DateTime? selectedDate;

// List of month names
final List<String> monthNames = [
'January', 'February', 'March', 'April',
'May', 'June', 'July', 'August',
'September', 'October', 'November', 'December'
];


@override
Widget build(BuildContext context) {
Expand Down Expand Up @@ -135,10 +145,70 @@ class _PulseHistoryState extends State<PulseHistory> {
children: [
Padding(
padding: const EdgeInsets.all(8.0),
child: Text("History", style: GoogleFonts.poppins(
fontWeight: FontWeight.bold, color: Colors.white,
fontSize: 20.0
),),
child: Row(
children: [
Text("History", style: GoogleFonts.poppins(
fontWeight: FontWeight.bold, color: Colors.white,
fontSize: 20.0
),),

Spacer(),

Padding(
padding: const EdgeInsets.all(8.0),
child: InkWell(
onTap: ()async{
var date_result = await showCalendarDatePicker2Dialog(
context: context,
config: CalendarDatePicker2WithActionButtonsConfig(
controlsTextStyle: GoogleFonts.poppins(fontWeight: FontWeight.bold, color: Colors.black, fontSize: 13),
weekdayLabelTextStyle: GoogleFonts.poppins(fontWeight: FontWeight.bold, color: Colors.black),
lastMonthIcon: Icon(Icons.arrow_back_ios, color: Colors.black),
nextMonthIcon: Icon(Icons.arrow_forward_ios, color: Colors.black),
selectedDayHighlightColor: Color(0xFFFF4081),
dayTextStyle: GoogleFonts.poppins(color: Colors.black),
monthTextStyle: GoogleFonts.poppins(color: Color(0xFF000000)),
yearTextStyle: GoogleFonts.poppins(color: Colors.black),
okButtonTextStyle: GoogleFonts.poppins(color: Color(0xFFFF4081), fontWeight: FontWeight.bold),
selectedMonthTextStyle: GoogleFonts.poppins(color: Colors.white),
selectedDayTextStyle: GoogleFonts.poppins(color: Colors.white),
cancelButtonTextStyle: GoogleFonts.poppins(color: Color(0xFFFF4081), fontWeight: FontWeight.bold),

),
dialogSize: const Size(325, 400),
value: [selectedDate],
borderRadius: BorderRadius.circular(15),

);

// If results are not null and contain at least one date, update the selected date
if (date_result != null) {
setState(() {
selectedDate = date_result.last; // Update selected date to the first (and only) selected date
});
print("Selected Date: ${selectedDate.toString()}"); // Print the selected date

}
else{
selectedDate = null;
}

},
child: Row(
children: [
Text("${selectedDate == null ? "-" : "${selectedDate!.day.toString()} ${monthNames[selectedDate!.month - 1]} ${selectedDate!.year.toString()}"} ", style: GoogleFonts.poppins(
color: Colors.white,
fontWeight: FontWeight.bold,
fontSize: 18.0
),),

Icon(Icons.arrow_drop_down_sharp, color: Colors.white),
],
),
),
),
],
),
),

Expanded(
Expand Down
Loading

0 comments on commit 23cc637

Please sign in to comment.