merge-requests/1/merge
unknown 6 years ago
commit c53439f014

@ -26,6 +26,8 @@
<string>LaunchScreen</string> <string>LaunchScreen</string>
<key>UIMainStoryboardFile</key> <key>UIMainStoryboardFile</key>
<string>Main</string> <string>Main</string>
<key>NSFaceIDUsageDescription</key>
<string>Why is my app authenticating using face id?</string>
<key>UISupportedInterfaceOrientations</key> <key>UISupportedInterfaceOrientations</key>
<array> <array>
<string>UIInterfaceOrientationPortrait</string> <string>UIInterfaceOrientationPortrait</string>

@ -0,0 +1,54 @@
import 'package:doctor_app_flutter/config/config.dart';
import 'package:flutter/cupertino.dart';
class SizeConfig {
static double _blockWidth = 0;
static double _blockHeight = 0;
static double screenWidth;
static double screenHeight;
static double textMultiplier;
static double imageSizeMultiplier;
static double heightMultiplier;
static double widthMultiplier;
static bool isPortrait = true;
static bool isMobilePortrait = false;
static bool isMobile = false;
void init(BoxConstraints constraints, Orientation orientation) {
screenHeight = constraints.maxHeight;
screenWidth = constraints.maxWidth;
_blockWidth = screenWidth / 100;
_blockHeight = screenHeight / 100;
if(constraints.maxWidth<= MAX_SMALL_SCREEN){
isMobile = true;
}
if (orientation == Orientation.portrait) {
isPortrait = true;
if (screenWidth < 450) {
isMobilePortrait = true;
}
textMultiplier = _blockHeight;
imageSizeMultiplier = _blockWidth;
} else {
isPortrait = false;
isMobilePortrait = false;
textMultiplier = _blockWidth;
imageSizeMultiplier = _blockHeight;
}
heightMultiplier = _blockHeight;
widthMultiplier = _blockWidth;
print('screenWidth $screenWidth');
print('screenHeight $screenHeight');
print('textMultiplier $textMultiplier');
print('imageSizeMultiplier $imageSizeMultiplier');
print('heightMultiplier$heightMultiplier');
print('widthMultiplier $widthMultiplier');
print('isPortrait $isPortrait');
print('isMobilePortrait $isMobilePortrait');
}
}

@ -1,14 +1,39 @@
import 'package:doctor_app_flutter/providers/auth_provider.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:http_interceptor/http_interceptor.dart'; import 'package:http_interceptor/http_interceptor.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
List<String> publicUrls = [LOGIN_URL,SELECT_DEVICE_IMEI,];
class HttpInterceptor extends InterceptorContract { class HttpInterceptor extends InterceptorContract {
Future<RequestData> interceptRequest({RequestData data}) async { Future<RequestData> interceptRequest({RequestData data}) async {
print('RequestData ${data.body}'); // print('RequestData ${data.body}');
try { try {
// data.params['appid'] = OPEN_WEATHER_API_KEY;
// data.params['units'] = 'metric';
data.headers["Content-Type"] = "application/json"; data.headers["Content-Type"] = "application/json";
data.headers["Accept"] = "application/json"; data.headers["Accept"] = "application/json";
if (!publicUrls.contains(data.url)) {
var loggedUserInfo = await sharedPref.getObj('loggedUser');
print('loggedUserInfo$loggedUserInfo');
// the sevices handel the token in differat name so I ask to be change
// we must change the implementaion once the name are changed
if(data.body['LogInTokenID']){
data.body['LogInTokenID'] = loggedUserInfo['LogInTokenID'];
}
if(data.body['TokenID']){
data.body['TokenID'] = loggedUserInfo['LogInTokenID'];
}
print('data.body${data.body}');
}
else {
if(data.body['LogInTokenID']){
data.body['LogInTokenID'] = '';
}
if(data.body['TokenID']){
data.body['TokenID'] = '';
}
}
} catch (e) { } catch (e) {
print(e); print(e);
} }
@ -17,7 +42,7 @@ class HttpInterceptor extends InterceptorContract {
@override @override
Future<ResponseData> interceptResponse({ResponseData data}) async { Future<ResponseData> interceptResponse({ResponseData data}) async {
print('${data.body}'); // print('ResponseData ${data.body}');
return data; return data;
} }
} }

@ -1 +1 @@
enum loginType { knownUser, unknownUser } enum loginType { knownUser, unknownUser, changePassword, verifyPassword }

@ -1,9 +1,11 @@
import 'package:doctor_app_flutter/providers/auth_provider.dart';
import 'package:doctor_app_flutter/providers/patients_provider.dart';
import 'package:doctor_app_flutter/providers/projects_provider.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import './config/size_config.dart';
import './providers/auth_provider.dart';
import './providers/patients_provider.dart';
import './providers/projects_provider.dart';
import './routes.dart'; import './routes.dart';
void main() => runApp(MyApp()); void main() => runApp(MyApp());
@ -12,6 +14,10 @@ class MyApp extends StatelessWidget {
// This widget is the root of your application. // This widget is the root of your application.
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return LayoutBuilder(
builder: (context, constraints) {
return OrientationBuilder(builder: (context, orientation) {
SizeConfig().init(constraints, orientation);
return MultiProvider( return MultiProvider(
providers: [ providers: [
ChangeNotifierProvider.value(value: PatientsProvider()), ChangeNotifierProvider.value(value: PatientsProvider()),
@ -29,5 +35,8 @@ class MyApp extends StatelessWidget {
routes: routes, routes: routes,
), ),
); );
});
},
);
} }
} }

@ -9,20 +9,23 @@ import './screens/medicine/medicine_search_screen.dart';
import './screens/my_schedule_screen.dart'; import './screens/my_schedule_screen.dart';
import './screens/patients/patient_search_screen.dart'; import './screens/patients/patient_search_screen.dart';
import './screens/patients/patients_list_screen.dart'; import './screens/patients/patients_list_screen.dart';
import './screens/auth/change_password_screen.dart';
import './screens/auth/verify_account_screen.dart';
const String INIT_ROUTE = LOGIN;
const String HOME = '/'; const String HOME = '/';
const String LOGIN = 'login'; const String LOGIN = 'login';
const String INIT_ROUTE = LOGIN; const String CHANGE_PASSWORD = 'change-password';
const String VERIFY_ACCOUNT = 'verify-account';
const String MY_SCHEDULE = 'my-schedule'; const String MY_SCHEDULE = 'my-schedule';
const String QR_READER = 'qr_reader'; const String QR_READER = 'qr-reader';
const String PATIENT_SEARCH = 'patients/patient-search'; const String PATIENT_SEARCH = 'patients/patient-search';
const String PATIENTS = 'patients/patients'; const String PATIENTS = 'patients/patients';
const String BLOOD_BANK = 'blood_bank'; const String BLOOD_BANK = 'blood-bank';
const String DOCTOR_REPLY = 'doctor_reply'; const String DOCTOR_REPLY = 'doctor-reply';
const String MEDICINE_SEARCH='medicine_search'; const String MEDICINE_SEARCH = 'medicine-search';
const String SETTINGS = 'settings'; const String SETTINGS = 'settings';
var routes = { var routes = {
HOME: (_) => DashboardPage(title: 'Home',), HOME: (_) => DashboardPage(title: 'Home',),
INIT_ROUTE: (_) => Loginsreen(), INIT_ROUTE: (_) => Loginsreen(),
@ -33,8 +36,7 @@ var routes = {
BLOOD_BANK: (_) => BloodBankScreen(), BLOOD_BANK: (_) => BloodBankScreen(),
DOCTOR_REPLY: (_) => DoctorReplyScreen(), DOCTOR_REPLY: (_) => DoctorReplyScreen(),
MEDICINE_SEARCH: (_) => MedicineSearchScreen(), MEDICINE_SEARCH: (_) => MedicineSearchScreen(),
SETTINGS:(_)=>SettingsScreen() SETTINGS: (_) => SettingsScreen(),
CHANGE_PASSWORD: (_) => ChangePasswordScreen(),
VERIFY_ACCOUNT: (_) => VerifyAccountScreen(),
}; };

@ -0,0 +1,24 @@
import 'package:doctor_app_flutter/lookups/auth_lookup.dart';
import 'package:doctor_app_flutter/widgets/auth/auth_header.dart';
import 'package:flutter/material.dart';
import '../../widgets/auth/change_password.dart';
class ChangePasswordScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
// return Container()];
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Container(
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AuthHeader(loginType.changePassword),
ChangePassword(),
],
),
),
));
}
}

@ -1,14 +1,14 @@
import 'dart:async'; import 'dart:async';
import 'package:doctor_app_flutter/lookups/auth_lookup.dart';
import 'package:doctor_app_flutter/util/dr_app_shared_pref.dart';
import 'package:doctor_app_flutter/widgets/auth/known_user_login.dart';
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../../lookups/auth_lookup.dart';
import '../../util/dr_app_shared_pref.dart';
import '../../widgets/auth/auth_header.dart'; import '../../widgets/auth/auth_header.dart';
import '../../widgets/auth/known_user_login.dart';
import '../../widgets/auth/login_form.dart'; import '../../widgets/auth/login_form.dart';
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
class Loginsreen extends StatefulWidget { class Loginsreen extends StatefulWidget {

@ -0,0 +1,24 @@
import 'package:doctor_app_flutter/lookups/auth_lookup.dart';
import 'package:doctor_app_flutter/widgets/auth/auth_header.dart';
import 'package:flutter/material.dart';
class VerifyAccountScreen extends StatelessWidget {
@override
Widget build(BuildContext context) {
// return Container()];
return Scaffold(
backgroundColor: Colors.white,
body: SingleChildScrollView(
child: Container(
margin: EdgeInsetsDirectional.fromSTEB(30, 0, 0, 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
AuthHeader(loginType.verifyPassword),
// ChangePassword(),
],
),
),
));
}
}

@ -1,5 +1,5 @@
import 'package:doctor_app_flutter/lookups/home_items_lookup.dart'; import '../lookups/home_items_lookup.dart';
import 'package:doctor_app_flutter/routes.dart'; import '../routes.dart';
import '../widgets/home/home_item.dart'; import '../widgets/home/home_item.dart';
import '../widgets/shared/app.drawer.dart'; import '../widgets/shared/app.drawer.dart';

@ -80,6 +80,6 @@ class DrAppSharedPreferances {
if (string == null ){ if (string == null ){
return null; return null;
} }
return json.decode(prefs.getString(key)); return json.decode(string);
} }
} }

@ -1,7 +1,8 @@
import 'package:doctor_app_flutter/lookups/auth_lookup.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter_device_type/flutter_device_type.dart';
import '../../config/size_config.dart';
import '../../lookups/auth_lookup.dart';
class AuthHeader extends StatelessWidget { class AuthHeader extends StatelessWidget {
var userType; var userType;
@ -9,14 +10,11 @@ class AuthHeader extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
var smallScreenSize = 660;
return LayoutBuilder(builder: (ctx, constraints) {
bool isSmallScreen = constraints.maxWidth <= smallScreenSize;
var screen = Container( var screen = Container(
margin: isSmallScreen margin: SizeConfig.isMobile
? null ? null
: EdgeInsetsDirectional.fromSTEB(constraints.maxWidth * 0.30, : EdgeInsetsDirectional.fromSTEB(SizeConfig.screenWidth * 0.30,
constraints.maxWidth * 0.1, 0, 0), SizeConfig.screenWidth * 0.1, 0, 0),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -24,44 +22,33 @@ class AuthHeader extends StatelessWidget {
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Container( Container(
margin: isSmallScreen margin: SizeConfig.isMobile
? EdgeInsetsDirectional.fromSTEB(0, 50, 0, 0) ? EdgeInsetsDirectional.fromSTEB(0, 50, 0, 0)
: EdgeInsetsDirectional.fromSTEB( : EdgeInsetsDirectional.fromSTEB(
constraints.maxWidth * 0.13, 0, 0, 0), SizeConfig.screenWidth * 0.13, 0, 0, 0),
child: Image.asset( child: buildImageLogo(),
'assets/images/login_icon.png',
fit: BoxFit.cover,
height:
isSmallScreen ? null : constraints.maxWidth * 0.09,
),
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Container( Container(
margin: isSmallScreen margin: SizeConfig.isMobile
? null ? null
: EdgeInsetsDirectional.fromSTEB( : EdgeInsetsDirectional.fromSTEB(
constraints.maxWidth * 0.13, 0, 0, 0), SizeConfig.screenWidth * 0.13, 0, 0, 0),
child: Text( child: buildTextUnderLogo(context),
"LOGIN",
style: TextStyle(
fontSize:
isSmallScreen ? 30 : constraints.maxWidth * 0.035,
fontWeight: FontWeight.w800),
),
) )
], ],
), ),
Column( Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: isSmallScreen children: SizeConfig.isMobile
? <Widget>[ ? <Widget>[
SizedBox( SizedBox(
height: 10, height: 10,
), ),
buildWelText(isSmallScreen, constraints), buildWelText(),
buildDrSulText(isSmallScreen, constraints, context), buildDrSulText(context),
] ]
: <Widget>[ : <Widget>[
SizedBox( SizedBox(
@ -70,58 +57,119 @@ class AuthHeader extends StatelessWidget {
Row( Row(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
buildWelText(isSmallScreen, constraints), buildWelText(),
buildDrSulText(isSmallScreen, constraints, context), buildDrSulText(context),
], ],
), ),
], ],
), ),
buildDrAppContainer(isSmallScreen, constraints, context) buildDrAppContainer(context)
], ],
)); ));
return screen; return screen;
});
} }
Container buildDrAppContainer( Image buildImageLogo() {
bool isSmallScreen, BoxConstraints constraints, BuildContext context) { String img = 'assets/images/login_icon.png';
if (userType == loginType.unknownUser) {
img = 'assets/images/welcome_login_icon.png';
}
return Image.asset(
img,
fit: BoxFit.cover,
height: SizeConfig.isMobile ? null : SizeConfig.screenWidth * 0.09,
);
}
Widget buildTextUnderLogo(context) {
if (userType == loginType.knownUser || userType == loginType.unknownUser) {
return Text(
"LOGIN",
style: TextStyle(
fontSize: SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035,
fontWeight: FontWeight.w800),
);
} else {
String text1;
String text2;
if (userType == loginType.changePassword) {
text1 = 'Change';
text2 = 'Password!';
}
if (userType == loginType.verifyPassword) {
text1 = 'verify';
text2 = 'Your Account!';
}
return Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
Text(
text1,
style: TextStyle(
fontSize:
SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035,
fontWeight: FontWeight.w800),
),
Text(
text2,
style: TextStyle(
color: Theme.of(context).primaryColor,
fontSize:
SizeConfig.isMobile ? 30 : SizeConfig.screenWidth * 0.035,
fontWeight: FontWeight.w800),
)
],
);
}
}
Container buildDrAppContainer(BuildContext context) {
if (userType == loginType.changePassword || userType == loginType.verifyPassword ) {
return Container();
}
return Container( return Container(
margin: isSmallScreen margin: SizeConfig.isMobile
? null ? null
: EdgeInsetsDirectional.fromSTEB( : EdgeInsetsDirectional.fromSTEB(
constraints.maxWidth * 0.13, 0, 0, 0), SizeConfig.screenWidth * 0.13, 0, 0, 0),
child: Text( child: Text(
"Doctor App", "Doctor App",
style: TextStyle( style: TextStyle(
fontSize: isSmallScreen ? 26 : constraints.maxWidth * 0.030, fontSize: SizeConfig.isMobile ? 26 : SizeConfig.screenWidth * 0.030,
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
color: Theme.of(context).primaryColor), color: Theme.of(context).primaryColor),
), ),
); );
} }
Text buildDrSulText( Text buildDrSulText(BuildContext context) {
bool isSmallScreen, BoxConstraints constraints, BuildContext context) { if (userType == loginType.changePassword || userType == loginType.verifyPassword ) {
return Text('');
}
return Text( return Text(
'Dr Sulaiman Al Habib', 'Dr Sulaiman Al Habib',
style: TextStyle( style: TextStyle(
fontWeight: FontWeight.w800, fontWeight: FontWeight.w800,
fontSize: isSmallScreen ? 24 : constraints.maxWidth * 0.029, fontSize: SizeConfig.isMobile ? 24 : SizeConfig.screenWidth * 0.029,
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
), ),
); );
} }
Text buildWelText(bool isSmallScreen, BoxConstraints constraints) { Widget buildWelText() {
String text = 'Welcome to '; String text = 'Welcome to ';
if (userType == loginType.unknownUser) { if (userType == loginType.unknownUser) {
text = 'Welcome Back to '; text = 'Welcome Back to ';
} }
if (userType == loginType.changePassword || userType == loginType.verifyPassword ) {
return Text('');
}
return Text( return Text(
text, text,
style: TextStyle( style: TextStyle(
fontSize: isSmallScreen ? 24 : constraints.maxWidth * 0.029), fontSize: SizeConfig.isMobile ? 24 : SizeConfig.screenWidth * 0.029),
); );
} }
} }

@ -0,0 +1,159 @@
import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:flutter/material.dart';
import 'package:hexcolor/hexcolor.dart';
class ChangePassword extends StatelessWidget {
final changePassFormKey = GlobalKey<FormState>();
var changePassFormValues = {
'currentPass': null,
'newPass': null,
'repeatedPass': null
};
@override
Widget build(BuildContext context) {
return Form(
key: changePassFormKey,
child: Container(
width: SizeConfig.widthMultiplier * 90,
child:
Column(crossAxisAlignment: CrossAxisAlignment.start, children: <
Widget>[
buildSizedBox(),
TextFormField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
// ts/images/password_icon.png
prefixIcon: Image.asset('assets/images/password_icon.png'),
hintText: 'Current Password',
hintStyle:
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide:
BorderSide(color: Theme.of(context).primaryColor),
)
//BorderRadius.all(Radius.circular(20));
),
validator: (value) {
if (value.isEmpty) {
return 'Please enter your Current Password';
}
return null;
},
onSaved: (value) {
// changePassFormValues. = value;
},
),
buildSizedBox(40),
// buildSizedBox(),
Text(
"New Password",
style: TextStyle(
fontSize: 2.8 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w800),
),
buildSizedBox(10.0),
// Text()
TextFormField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
// ts/images/password_icon.png
prefixIcon: Image.asset('assets/images/password_icon.png'),
hintText: 'New Password',
hintStyle:
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide:
BorderSide(color: Theme.of(context).primaryColor),
)
//BorderRadius.all(Radius.circular(20));
),
validator: (value) {
if (value.isEmpty) {
return 'Please enter your New Password';
}
return null;
},
onSaved: (value) {
// userInfo.UserID = value;
},
),
buildSizedBox(),
TextFormField(
keyboardType: TextInputType.number,
decoration: InputDecoration(
prefixIcon: Image.asset('assets/images/password_icon.png'),
hintText: 'Repeat Password',
hintStyle:
TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
),
focusedBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(10.0)),
borderSide:
BorderSide(color: Theme.of(context).primaryColor),
)
//BorderRadius.all(Radius.circular(20));
),
validator: (value) {
if (value.isEmpty) {
return 'Please enter your Repeat Password';
}
return null;
},
onSaved: (value) {
// userInfo.UserID = value;
},
),
buildSizedBox(),
RaisedButton(
onPressed:changePass,
elevation: 0.0,
child: Container(
width: double.infinity,
height: 50,
child: Center(
child: Text(
'Change Password'
.toUpperCase(),
// textAlign: TextAlign.center,
style: TextStyle(
color: Colors.white,
fontSize: 2.5 * SizeConfig.textMultiplier),
),
),
),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10),
side: BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))),
),
SizedBox(
height: 10,
),
])));
}
SizedBox buildSizedBox([double height = 20]) {
return SizedBox(
height: height,
);
}
changePass(){
if(changePassFormKey.currentState.validate()){
changePassFormKey.currentState.save();
// call Api
}
}
}

@ -1,17 +1,17 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:hexcolor/hexcolor.dart'; import 'package:hexcolor/hexcolor.dart';
import 'package:local_auth/error_codes.dart' as auth_error;
import 'package:local_auth/local_auth.dart'; import 'package:local_auth/local_auth.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import 'package:shared_preferences/shared_preferences.dart'; import 'package:shared_preferences/shared_preferences.dart';
import '../../config/config.dart'; import '../../config/size_config.dart';
import '../../providers/auth_provider.dart'; import '../../providers/auth_provider.dart';
import '../../routes.dart'; import '../../routes.dart';
import '../../util/dr_app_shared_pref.dart'; import '../../util/dr_app_shared_pref.dart';
import '../../util/dr_app_toast_msg.dart'; import '../../util/dr_app_toast_msg.dart';
import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart'; import '../../widgets/shared/dr_app_circular_progress_Indeicator.dart';
import 'package:local_auth/error_codes.dart' as auth_error;
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
DrAppToastMsg toastMsg = DrAppToastMsg(); DrAppToastMsg toastMsg = DrAppToastMsg();
@ -88,11 +88,6 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
if (snapshot.hasError) { if (snapshot.hasError) {
return Text('Error: ${snapshot.error}'); return Text('Error: ${snapshot.error}');
} else { } else {
return LayoutBuilder(
builder: (ctx, constraints) {
int maxSmallScreenSize = MAX_SMALL_SCREEN;
bool isSmallScreen =
constraints.maxWidth <= maxSmallScreenSize;
return Column( return Column(
mainAxisAlignment: MainAxisAlignment.start, mainAxisAlignment: MainAxisAlignment.start,
children: <Widget>[ children: <Widget>[
@ -113,8 +108,8 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
decoration: new BoxDecoration( decoration: new BoxDecoration(
// color: Colors.green, // border color // color: Colors.green, // border color
shape: BoxShape.circle, shape: BoxShape.circle,
border: Border.all( border:
color: Hexcolor('#CCCCCC'))), Border.all(color: Hexcolor('#CCCCCC'))),
child: CircleAvatar( child: CircleAvatar(
child: Image.asset( child: Image.asset(
'assets/images/dr_avatar.png', 'assets/images/dr_avatar.png',
@ -126,26 +121,21 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
vertical: 3, horizontal: 15), vertical: 3, horizontal: 15),
child: Column( child: Column(
// mainAxisAlignment: MainAxisAlignment.start, // mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: crossAxisAlignment: CrossAxisAlignment.start,
CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
Text( Text(
_loggedUser['List_MemberInformation'][0] _loggedUser['List_MemberInformation'][0]
['MemberName'], ['MemberName'],
style: TextStyle( style: TextStyle(
color: Hexcolor('515A5D'), color: Hexcolor('515A5D'),
fontSize: isSmallScreen fontSize: 2.5 *SizeConfig.textMultiplier,
? 24
: constraints.maxWidth * 0.029,
fontWeight: FontWeight.w800), fontWeight: FontWeight.w800),
), ),
Text( Text(
'ENT Spec', 'ENT Spec',
style: TextStyle( style: TextStyle(
color: Hexcolor('515A5D'), color: Hexcolor('515A5D'),
fontSize: isSmallScreen fontSize: 1.5 *SizeConfig.textMultiplier),
? 20
: constraints.maxWidth * 0.025),
) )
], ],
), ),
@ -162,12 +152,9 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
)) ))
]), ]),
buildVerificationTypeImageContainer(), buildVerificationTypeImageContainer(),
buildButtonsContainer( buildButtonsContainer(context)
isSmallScreen, constraints, context)
], ],
); );
},
);
} }
} }
}); });
@ -187,8 +174,7 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
} }
// //
Container buildButtonsContainer( Container buildButtonsContainer(BuildContext context) {
bool isSmallScreen, BoxConstraints constraints, BuildContext context) {
return Container( return Container(
margin: EdgeInsetsDirectional.fromSTEB(0, 0, 30, 0), margin: EdgeInsetsDirectional.fromSTEB(0, 0, 30, 0),
width: double.infinity, width: double.infinity,
@ -207,8 +193,7 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
// textAlign: TextAlign.center, // textAlign: TextAlign.center,
style: TextStyle( style: TextStyle(
color: Colors.white, color: Colors.white,
fontSize: fontSize: 2.5 *SizeConfig.textMultiplier),
isSmallScreen ? 20 : constraints.maxWidth * 0.029),
), ),
), ),
), ),
@ -234,8 +219,7 @@ class _KnownUserLoginState extends State<KnownUserLogin> {
"More verification Options".toUpperCase(), "More verification Options".toUpperCase(),
style: TextStyle( style: TextStyle(
color: Theme.of(context).primaryColor, color: Theme.of(context).primaryColor,
fontSize: fontSize: 2.5 *SizeConfig.textMultiplier),
isSmallScreen ? 20 : constraints.maxWidth * 0.029),
)), )),
), ),
SizedBox( SizedBox(

@ -1,5 +1,3 @@
import '../../providers/projects_provider.dart';
import '../../util/dr_app_toast_msg.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart'; import 'package:flutter/rendering.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
@ -7,10 +5,13 @@ import 'package:hexcolor/hexcolor.dart';
import 'package:imei_plugin/imei_plugin.dart'; import 'package:imei_plugin/imei_plugin.dart';
import 'package:provider/provider.dart'; import 'package:provider/provider.dart';
import '../../config/size_config.dart';
import '../../models/user_model.dart'; import '../../models/user_model.dart';
import '../../providers/auth_provider.dart'; import '../../providers/auth_provider.dart';
import '../../providers/projects_provider.dart';
import '../../routes.dart'; import '../../routes.dart';
import '../../util/dr_app_shared_pref.dart'; import '../../util/dr_app_shared_pref.dart';
import '../../util/dr_app_toast_msg.dart';
DrAppSharedPreferances sharedPref = DrAppSharedPreferances(); DrAppSharedPreferances sharedPref = DrAppSharedPreferances();
DrAppToastMsg toastMsg = DrAppToastMsg(); DrAppToastMsg toastMsg = DrAppToastMsg();
@ -53,27 +54,20 @@ class _LoginFormState extends State<LoginForm> {
} }
AuthProvider authProv = Provider.of<AuthProvider>(context); AuthProvider authProv = Provider.of<AuthProvider>(context);
return LayoutBuilder(builder: (ctx, constraints) {
var smallScreenSize = 660;
bool isSmallScreen = constraints.maxWidth <= smallScreenSize;
return Form( return Form(
key: loginFormKey, key: loginFormKey,
child: Container( child: Container(
width: constraints.maxWidth * 0.9, width: SizeConfig.widthMultiplier * 90,
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[ children: <Widget>[
SizedBox( buildSizedBox(),
height: 20,
),
TextFormField( TextFormField(
keyboardType: TextInputType.number, keyboardType: TextInputType.number,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: Image.asset('assets/images/user_id_icon.png'), prefixIcon: Image.asset('assets/images/user_id_icon.png'),
hintText: 'Enter ID', hintText: 'Enter ID',
hintStyle: TextStyle( hintStyle: TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
fontSize:
isSmallScreen ? 14 : constraints.maxWidth * 0.024),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')), borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
@ -87,7 +81,7 @@ class _LoginFormState extends State<LoginForm> {
), ),
validator: (value) { validator: (value) {
if (value.isEmpty) { if (value.isEmpty) {
return 'Please enter some text'; return 'Please enter your ID';
} }
return null; return null;
}, },
@ -95,19 +89,14 @@ class _LoginFormState extends State<LoginForm> {
userInfo.UserID = value; userInfo.UserID = value;
}, },
), ),
SizedBox( buildSizedBox(),
height: 20,
),
TextFormField( TextFormField(
obscureText: true, obscureText: true,
decoration: InputDecoration( decoration: InputDecoration(
prefixIcon: prefixIcon: Image.asset('assets/images/password_icon.png'),
Image.asset('assets/images/password_icon.png'),
hintText: 'Enter Password', hintText: 'Enter Password',
hintStyle: TextStyle( hintStyle:
fontSize: isSmallScreen TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
? 14
: constraints.maxWidth * 0.024),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')), borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
@ -121,29 +110,24 @@ class _LoginFormState extends State<LoginForm> {
), ),
validator: (value) { validator: (value) {
if (value.isEmpty) { if (value.isEmpty) {
return 'Please enter some text'; return 'Please enter your Password';
} }
return null; return null;
}, },
onSaved: (value) { onSaved: (value) {
userInfo.Password = value; userInfo.Password = value;
}), }),
SizedBox( buildSizedBox(),
height: 20,
),
DropdownButtonFormField( DropdownButtonFormField(
value: userInfo.ProjectID, value: userInfo.ProjectID,
isExpanded: false, isExpanded: false,
decoration: InputDecoration( decoration: InputDecoration(
contentPadding: EdgeInsets.all(10), contentPadding: EdgeInsets.all(10),
isDense: true, isDense: true,
prefixIcon: prefixIcon: Image.asset('assets/images/hospital_icon.png'),
Image.asset('assets/images/hospital_icon.png'),
// hintText: 'Enter Password', // hintText: 'Enter Password',
hintStyle: TextStyle( hintStyle:
fontSize: isSmallScreen TextStyle(fontSize: 2 * SizeConfig.textMultiplier),
? 14
: constraints.maxWidth * 0.024),
enabledBorder: OutlineInputBorder( enabledBorder: OutlineInputBorder(
borderRadius: BorderRadius.all(Radius.circular(20)), borderRadius: BorderRadius.all(Radius.circular(20)),
borderSide: BorderSide(color: Hexcolor('#CCCCCC')), borderSide: BorderSide(color: Hexcolor('#CCCCCC')),
@ -158,7 +142,7 @@ class _LoginFormState extends State<LoginForm> {
validator: (value) { validator: (value) {
print(value); print(value);
if (value == null) { if (value == null) {
return 'Please enter some text'; return 'Please select your project';
} }
return null; return null;
}, },
@ -171,11 +155,12 @@ class _LoginFormState extends State<LoginForm> {
); );
}).toList(), }).toList(),
onChanged: (value) { onChanged: (value) {
print(value);
setState(() {
userInfo.ProjectID = value; userInfo.ProjectID = value;
});
}), }),
SizedBox( buildSizedBox(),
height: 20,
),
Row( Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
@ -189,9 +174,7 @@ class _LoginFormState extends State<LoginForm> {
onChanged: (bool newValue) {}), onChanged: (bool newValue) {}),
Text("Remember me", Text("Remember me",
style: TextStyle( style: TextStyle(
fontSize: isSmallScreen fontSize: 2 * SizeConfig.textMultiplier)),
? 18
: constraints.maxWidth * 0.018)),
], ],
), ),
), ),
@ -204,20 +187,19 @@ class _LoginFormState extends State<LoginForm> {
padding: const EdgeInsets.all(0.0), padding: const EdgeInsets.all(0.0),
shape: RoundedRectangleBorder( shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10), borderRadius: BorderRadius.circular(10),
side: side: BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))),
BorderSide(width: 0.5, color: Hexcolor('#CCCCCC'))),
child: Container( child: Container(
padding: const EdgeInsets.all(10.0), padding: const EdgeInsets.all(10.0),
height: 50, height: 50,
width: 140, width: SizeConfig.widthMultiplier * 30,
child: Row( child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween, mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[ children: <Widget>[
Text('LOGIN', Text('LOGIN',
style: TextStyle( style: TextStyle(
fontSize: isSmallScreen fontSize: SizeConfig.isMobilePortrait
? 20 ? 2.3 * SizeConfig.textMultiplier
: constraints.maxWidth * 0.020)), : 2.3 * SizeConfig.textMultiplier)),
Image.asset('assets/images/login_btn_arrow_icon.png') Image.asset('assets/images/login_btn_arrow_icon.png')
], ],
), ),
@ -229,7 +211,12 @@ class _LoginFormState extends State<LoginForm> {
), ),
), ),
); );
}); }
SizedBox buildSizedBox() {
return SizedBox(
height: 20,
);
} }
login(context, AuthProvider authProv) { login(context, AuthProvider authProv) {

@ -70,7 +70,7 @@ packages:
name: build_daemon name: build_daemon
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "2.1.3" version: "2.1.4"
build_modules: build_modules:
dependency: transitive dependency: transitive
description: description:
@ -91,14 +91,14 @@ packages:
name: build_runner name: build_runner
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.8.0" version: "1.8.1"
build_runner_core: build_runner_core:
dependency: transitive dependency: transitive
description: description:
name: build_runner_core name: build_runner_core
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "4.5.2" version: "5.0.0"
build_web_compilers: build_web_compilers:
dependency: "direct dev" dependency: "direct dev"
description: description:
@ -281,7 +281,7 @@ packages:
name: http_parser name: http_parser
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "3.1.3" version: "3.1.4"
i18n: i18n:
dependency: "direct main" dependency: "direct main"
description: description:
@ -386,7 +386,7 @@ packages:
name: package_config name: package_config
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.9.1" version: "1.9.3"
package_resolver: package_resolver:
dependency: transitive dependency: transitive
description: description:
@ -456,7 +456,7 @@ packages:
name: pub_semver name: pub_semver
url: "https://pub.dartlang.org" url: "https://pub.dartlang.org"
source: hosted source: hosted
version: "1.4.3" version: "1.4.4"
pubspec_parse: pubspec_parse:
dependency: transitive dependency: transitive
description: description:

@ -70,6 +70,7 @@ flutter:
- assets/images/verification_sms_lg_icon.png - assets/images/verification_sms_lg_icon.png
- assets/images/verification_whatsapp_lg_icon.png - assets/images/verification_whatsapp_lg_icon.png
- assets/images/close_icon.png - assets/images/close_icon.png
- assets/images/welcome_login_icon.png
# - images/a_dot_ham.jpeg # - images/a_dot_ham.jpeg
# An image asset can refer to one or more resolution-specific "variants", see # An image asset can refer to one or more resolution-specific "variants", see

Loading…
Cancel
Save