dashboard added

dev
Sneha 1 year ago
parent 51bb2d5792
commit 77a7051c41

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 163 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 6.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

After

Width:  |  Height:  |  Size: 10 KiB

@ -0,0 +1,23 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/settings.dart';
class BMICalculator extends StatefulWidget {
const BMICalculator({Key? key}) : super(key: key);
@override
State<BMICalculator> createState() => _BMICalculatorState();
}
class _BMICalculatorState extends State<BMICalculator> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('Body Mass Index'),
body: Container(
),
);
}
}

@ -4,6 +4,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:healthcare_user/emergency.dart'; import 'package:healthcare_user/emergency.dart';
import 'package:healthcare_user/invitations.dart'; import 'package:healthcare_user/invitations.dart';
import 'package:healthcare_user/medicines.dart'; import 'package:healthcare_user/medicines.dart';
import 'package:healthcare_user/my_health.dart';
import 'package:healthcare_user/prescriptions.dart'; import 'package:healthcare_user/prescriptions.dart';
import 'package:healthcare_user/reports.dart'; import 'package:healthcare_user/reports.dart';
import 'package:healthcare_user/seekopinion.dart'; import 'package:healthcare_user/seekopinion.dart';
@ -24,8 +25,8 @@ class _DashboardState extends State<Dashboard> {
int _selectedIndex = 0; int _selectedIndex = 0;
final List<String> imgList = [ final List<String> imgList = [
'images/mobilebg.png', 'images/mobilebg.png',
'images/mobilebg.png', 'images/mobilebg2.png',
'images/mobilebg.png' 'images/mobilebg3.png'
]; ];
final ImagePicker _picker = ImagePicker(); final ImagePicker _picker = ImagePicker();
@ -282,17 +283,15 @@ class _DashboardState extends State<Dashboard> {
), ),
), ),
Text( Text(
"Sneha", AppSettings.userName,
//AppSettings.userName,
style: TextStyle(color: Colors.white, fontSize: 15), style: TextStyle(color: Colors.white, fontSize: 15),
), ),
Text( Text(
'9898989898', AppSettings.phoneNumber,
//AppSettings.phoneNumber,
style: TextStyle(color: Colors.white, fontSize: 15), style: TextStyle(color: Colors.white, fontSize: 15),
), ),
Text( Text(
'sneha@armintasolutions.com', //AppSettings.email, AppSettings.email,
style: TextStyle(color: Colors.white, fontSize: 15), style: TextStyle(color: Colors.white, fontSize: 15),
), ),
], ],
@ -339,7 +338,13 @@ class _DashboardState extends State<Dashboard> {
Text('My Health', style: TextStyle(color: primaryColor)), Text('My Health', style: TextStyle(color: primaryColor)),
], ],
), ),
onTap: () {}, onTap: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const MyHealth()),
);
},
), ),
Divider( Divider(
color: Colors.grey, color: Colors.grey,

@ -6,7 +6,7 @@ import 'package:flutter/services.dart';
void main () async { void main () async {
// Set default home. // Set default home.
Widget _defaultHome = Dashboard(); Widget _defaultHome = Splash();
WidgetsFlutterBinding.ensureInitialized(); WidgetsFlutterBinding.ensureInitialized();
SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp]) SystemChrome.setPreferredOrientations([DeviceOrientation.portraitUp])
.then((_) { .then((_) {

@ -0,0 +1,343 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/settings.dart';
import 'bmicalculator.dart';
class MyHealth extends StatefulWidget {
const MyHealth({Key? key}) : super(key: key);
@override
State<MyHealth> createState() => _MyHealthState();
}
class _MyHealthState extends State<MyHealth> {
TextEditingController heightController = TextEditingController();
TextEditingController weightController = TextEditingController();
TextEditingController ageController = TextEditingController();
var heightUnitItems = [
'feet',
'cm',
'inches',
];
var heightUnits = 'feet';
var weightUnitItems = [
'kg',
'gr',
];
var weightUnits = 'kg';
showBMIAdddialog(){
return showDialog(
context: context,
barrierDismissible: false,
builder: (BuildContext context) {
return StatefulBuilder(
builder: (BuildContext context, StateSetter setState) {
return AlertDialog(
title: Center(
child: Text('Body Mass Index',style: TextStyle(color: primaryColor),),
),
content: SingleChildScrollView(
child: ListBody(
children: <Widget>[
TextFormField(
cursorColor: greyColor,
controller: ageController,
textCapitalization: TextCapitalization.characters,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.person,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Age',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
SizedBox(height:10),
Container(
//height: 60,
child: Row(
children: [
Expanded(child: TextFormField(
cursorColor: greyColor,
controller: heightController,
textCapitalization: TextCapitalization.characters,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.height,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Height',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),),
SizedBox(width:5),
Expanded(child: DropdownButtonFormField(
// Initial Value
value: heightUnits,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.ac_unit_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Units',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: heightUnitItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(items, style: TextStyle(
fontSize: 16,
),textAlign: TextAlign.center,)
);
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
heightUnits = newValue!;
});
},
),)
],
),
),
SizedBox(height:10),
Container(
//height: 40,
padding: const EdgeInsets.fromLTRB(0, 0, 0, 0),
child: Row(
children: [
Expanded(child: TextFormField(
cursorColor: greyColor,
controller: weightController,
textCapitalization: TextCapitalization.characters,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.line_weight_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Weight',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),),
SizedBox(width:5),
Expanded(child: DropdownButtonFormField(
// Initial Value
value: weightUnits,
isExpanded: true,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.ac_unit_outlined,
color: primaryColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: primaryColor),
),
labelText: 'Units',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
hint: Text('Units'),
// Down Arrow Icon
//icon: const Icon(Icons.keyboard_arrow_down),
// Array list of items
items: weightUnitItems.map((String items) {
return DropdownMenuItem(
value: items,
child: Text(items, style: TextStyle(
fontSize: 16,
),textAlign: TextAlign.center,)
);
}).toList(),
// After selecting the desired option,it will
// change button value to selected value
onChanged: (String? newValue) {
setState(() {
weightUnits = newValue!;
});
},
),)
],
),
),
],
),
),
actions: <Widget>[
TextButton(
child: Text('Cancel', style: textButtonStyle()),
onPressed: () {
Navigator.of(context).pop();
},
),
TextButton(
child: Text('Calculate BMI', style: textButtonStyle()),
onPressed: () async {
},
),
],
);
});
},
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppSettings.appBar('My Health'),
body: Container(
child: Column(
children: [
Card(
child: Padding(
padding: EdgeInsets.all(3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Body Mass Index'),
IconButton(onPressed: (){
/* Navigator.push(
context,
MaterialPageRoute(
builder: (context) => BMICalculator()),
);*/
showBMIAdddialog();
}, icon: Icon(Icons.add,color: greyColor,),)
],
),
)
),
Card(
child: Padding(
padding: EdgeInsets.all(3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Blood Pressure'),
IconButton(onPressed: (){}, icon: Icon(Icons.add,color: greyColor,),)
],
),
)
),
Card(
child: Padding(
padding: EdgeInsets.all(3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Diabetes'),
IconButton(onPressed: (){}, icon: Icon(Icons.add,color: greyColor,),)
],
),
)
),
Card(
child: Padding(
padding: EdgeInsets.all(3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Cholesterol'),
IconButton(onPressed: (){}, icon: Icon(Icons.add,color: greyColor,),)
],
),
)
),
Card(
child: Padding(
padding: EdgeInsets.all(3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Habbits'),
IconButton(onPressed: (){
}, icon: Icon(Icons.add,color: greyColor,),)
],
),
)
),
Card(
child: Padding(
padding: EdgeInsets.all(3),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Allergies'),
IconButton(onPressed: (){}, icon: Icon(Icons.add,color: greyColor,),)
],
),
)
)
],
),
),
);
}
}

@ -0,0 +1,239 @@
import 'package:flutter/material.dart';
import 'package:healthcare_user/dashboard.dart';
import 'package:healthcare_user/login.dart';
import 'package:healthcare_user/settings.dart';
class OtpScreen extends StatefulWidget {
var myObject;
OtpScreen({this.myObject});
@override
State<OtpScreen> createState() => _OtpScreenState();
}
class _OtpScreenState extends State<OtpScreen> {
final TextEditingController _fieldOne = TextEditingController();
final TextEditingController _fieldTwo = TextEditingController();
final TextEditingController _fieldThree = TextEditingController();
final TextEditingController _fieldFour = TextEditingController();
final TextEditingController _fieldFive = TextEditingController();
final TextEditingController _fieldSix = TextEditingController();
TextEditingController mobileNumberController = TextEditingController();
TextEditingController passwordController = TextEditingController();
bool isTextfieldVisible=true;
bool isOtpVisible=false;
bool isObscureText=true;
// This is the entered code
// It will be displayed in a Text widget
String? _otp;
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Text('Phone Number Verification'),
Visibility(
visible: false,
child: Container(
padding: const EdgeInsets.all(10),
child: TextFormField(
cursorColor: greyColor,
controller: mobileNumberController,
keyboardType: TextInputType.number,
decoration: const InputDecoration(
prefixIcon: Icon(
Icons.phone,
color: greyColor,
),
border: OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color:greyColor),
),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
labelText: 'Enter MobileNumber',
labelStyle: TextStyle(
color: greyColor, //<-- SEE HERE
),
),
),
),),
const SizedBox(
height: 30,
),
Visibility(
visible: false,
child: Container(
width: MediaQuery.of(context).size.width * .99,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: ()async {
},
child: const Text('Submit')),
),),
// Implement 4 input fields
Visibility(
visible:true,
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
OtpInput(_fieldOne, true), // auto focus
OtpInput(_fieldTwo, false),
OtpInput(_fieldThree, false),
OtpInput(_fieldFour, false),
OtpInput(_fieldFive, false),
OtpInput(_fieldSix, false),
],
),),
const SizedBox(
height: 30,
),
Visibility(
visible: false,
child: Container(
padding: const EdgeInsets.fromLTRB(10, 10, 10, 0),
child: TextFormField(
cursorColor: greyColor,
obscureText: isObscureText,
controller: passwordController,
decoration: InputDecoration(
labelText: 'Password',
prefixIcon: const Icon(Icons.password, color: greyColor,),
labelStyle: const TextStyle(
color: greyColor, //<-- SEE HERE
),
border: const OutlineInputBorder(
borderSide: BorderSide(color: greyColor)),
focusedBorder: const OutlineInputBorder(
borderSide: BorderSide(color: greyColor),
),
enabledBorder: const OutlineInputBorder(
borderSide: BorderSide(color: textFieldStartColor),
),
suffixIcon: IconButton(
icon: Icon(
Icons.visibility_off_outlined,
color: isObscureText==true?greyColor:primaryColor,
),
onPressed: () {
print("show password");
setState(() {
isObscureText = !isObscureText;
});
},
),
),
),
),),
const SizedBox(
height: 30,
),
Visibility(
visible: true,
child: Container(
width: MediaQuery.of(context).size.width * .99,
height: 50,
child: ElevatedButton(
style: ElevatedButton.styleFrom(
primary: primaryColor, // background
onPrimary: Colors.white, // foreground
),
onPressed: ()async {
setState(() {
_otp = _fieldOne.text +
_fieldTwo.text +
_fieldThree.text +
_fieldFour.text+
_fieldFive.text +
_fieldSix.text;
});
if (_otp!.length == 6) {
AppSettings.preLoaderDialog(context);
bool isOnline = await AppSettings.internetConnectivity();
if(isOnline){
var payload = new Map<String, dynamic>();
payload["phoneVerificationCode"] = _otp.toString();
payload["phone"] = widget.myObject.toString();
bool phoneVerified = await AppSettings.phoneVerification(payload);
if(phoneVerified){
Navigator.of(context,rootNavigator: true).pop();
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => const Login()),
);
}
else{
Navigator.of(context,rootNavigator: true).pop();
}
}
else{
Navigator.of(context,rootNavigator: true).pop();
}
}
else{
}
},
child: const Text('Submit')),
)
)
],
),
);
}
}
// Create an input widget that takes only one digit
class OtpInput extends StatelessWidget {
final TextEditingController controller;
final bool autoFocus;
const OtpInput(this.controller, this.autoFocus, {Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return SizedBox(
height: 60,
width: 50,
child: TextField(
autofocus: autoFocus,
textAlign: TextAlign.center,
keyboardType: TextInputType.number,
controller: controller,
maxLength: 1,
cursorColor: Theme.of(context).primaryColor,
decoration: const InputDecoration(
border: OutlineInputBorder(),
counterText: '',
hintStyle: TextStyle(color: Colors.black, fontSize: 20.0)),
onChanged: (value) {
if (value.length == 1) {
FocusScope.of(context).nextFocus();
}
},
),
);
}
}

@ -131,6 +131,8 @@ class AppSettings {
static String host = 'http://35.200.129.165:4000/api/'; static String host = 'http://35.200.129.165:4000/api/';
static String loginUrl = host + 'login'; static String loginUrl = host + 'login';
static String signUpUrl = host + 'users'; static String signUpUrl = host + 'users';
static String sendSmsUrl = host + 'sendSms';
static String phoneVerificationUrl = host + 'phone';
static String verifyPhnUrl = host + 'phone'; static String verifyPhnUrl = host + 'phone';
@ -292,6 +294,27 @@ class AppSettings {
} }
} }
static Future<bool> sendSms(payload) async{
var response=await http.post(Uri.parse(sendSmsUrl),body: json.encode(payload), headers: {'Content-type': 'application/json'});
if(response.statusCode==200){
return true;
}
else{
return false;
}
}
static Future<bool> phoneVerification(payload) async{
var response=await http.post(Uri.parse(phoneVerificationUrl),body: json.encode(payload), headers: {'Content-type': 'application/json'});
if(response.statusCode==200){
return true;
}
else{
return false;
}
}
static Future<bool> verifyPhn(payload) async { static Future<bool> verifyPhn(payload) async {
var response = await http.post(Uri.parse(verifyPhnUrl), var response = await http.post(Uri.parse(verifyPhnUrl),
body: json.encode(payload), body: json.encode(payload),

@ -14,6 +14,7 @@ import 'package:google_maps_flutter_platform_interface/google_maps_flutter_platf
import 'package:location/location.dart' as locationmap; import 'package:location/location.dart' as locationmap;
import 'google_maps_place_picker_mb/src/models/pick_result.dart'; import 'google_maps_place_picker_mb/src/models/pick_result.dart';
import 'google_maps_place_picker_mb/src/place_picker.dart'; import 'google_maps_place_picker_mb/src/place_picker.dart';
import 'otpscreen.dart';
@ -493,7 +494,8 @@ class _SignUpState extends State<SignUp> {
payload["phone"] = payload["phone"] =
mobileNumberController.text.toString(); mobileNumberController.text.toString();
payload["firstName"] = ''; payload["emails"] = [ payload["firstName"] = nameController.text.toString();
payload["emails"] = [
{"email": emailController.text.toString()} {"email": emailController.text.toString()}
]; ];
payload["lastName"] = ''; payload["lastName"] = '';
@ -512,34 +514,24 @@ class _SignUpState extends State<SignUp> {
try { try {
if (signUpStatus) { if (signUpStatus) {
var phoneVerifyPayload = new Map<String, dynamic>(); var smsPayload = new Map<String, dynamic>();
smsPayload["mobileNumbers"] = mobileNumberController.text.toString();
bool sendSms = await AppSettings.sendSms(smsPayload);
phoneVerifyPayload["phoneVerificationCode"] = if(sendSms){
"11111";
phoneVerifyPayload["phone"] =
mobileNumberController.text.toString();
bool verifyPhnStatus =
await AppSettings.verifyPhn(phoneVerifyPayload);
if (verifyPhnStatus) {
Navigator.of(context, rootNavigator: true).pop(); Navigator.of(context, rootNavigator: true).pop();
/*AppSettings.longSuccessToast( Navigator.push(
"User SignUp Successfully");*/
showUserSignUSuccessDialog();
/* await Navigator.push(
context, context,
MaterialPageRoute( MaterialPageRoute(
builder: (context) => const Login()), builder: (context) => OtpScreen(myObject: mobileNumberController.text.toString(),)),
);*/ );
}
} else { else{
Navigator.of(context, rootNavigator: true).pop(); Navigator.of(context, rootNavigator: true).pop();
/*AppSettings.longFailedToast(
"Phone verification failed");*/
} }
} }
else { else {
Navigator.of(context, rootNavigator: true).pop(); Navigator.of(context, rootNavigator: true).pop();

Loading…
Cancel
Save