Merge branch 'development' of https://gitlab.com/Cloud_Solution/doctor_app_flutter into code_reafactoring
Conflicts: lib/screens/medical-file/medical_file_page.dart lib/screens/patients/profile/refer_patient_screen.dartmerge-requests/522/head
commit
89451a3c70
@ -0,0 +1,406 @@
|
||||
import 'package:doctor_app_flutter/config/config.dart';
|
||||
import 'package:doctor_app_flutter/core/viewModel/patient_view_model.dart';
|
||||
import 'package:doctor_app_flutter/models/patient/patiant_info_model.dart';
|
||||
import 'package:doctor_app_flutter/screens/base/base_view.dart';
|
||||
import 'package:doctor_app_flutter/util/dr_app_toast_msg.dart';
|
||||
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/buttons/app_buttons_widget.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/dialogs/dailog-list-select.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/errors/dr_app_embedded_error.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/rounded_container_widget.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
||||
import '../../../config/size_config.dart';
|
||||
import '../../../util/dr_app_shared_pref.dart';
|
||||
import '../../../util/extenstions.dart';
|
||||
import '../../../widgets/shared/app_scaffold_widget.dart';
|
||||
import '../../../widgets/shared/app_texts_widget.dart';
|
||||
|
||||
DrAppSharedPreferances sharedPref = new DrAppSharedPreferances();
|
||||
|
||||
/*
|
||||
*@author: ibrahim albitar
|
||||
*@Date:4/6/2020
|
||||
*@param:
|
||||
*@return:
|
||||
*@desc:
|
||||
*/
|
||||
|
||||
class ReferPatientScreen extends StatefulWidget {
|
||||
@override
|
||||
_ReferPatientState createState() => _ReferPatientState();
|
||||
}
|
||||
|
||||
class _ReferPatientState extends State<ReferPatientScreen> {
|
||||
dynamic _selectedClinic;
|
||||
dynamic _selectedDoctor;
|
||||
final _extController = TextEditingController();
|
||||
int _activePriority = 1;
|
||||
dynamic _selectedFrequency;
|
||||
final _remarksController = TextEditingController();
|
||||
bool isValid;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final screenSize = MediaQuery.of(context).size;
|
||||
|
||||
return BaseView<PatientViewModel>(
|
||||
onModelReady: (model) => model.getClinicsList(),
|
||||
builder: (_, model, w) => AppScaffold(
|
||||
baseViewModel: model,
|
||||
appBarTitle: TranslationBase.of(context).referralPatient,
|
||||
body: model.clinicsList == null
|
||||
? DrAppEmbeddedError(error: 'Something Wrong!')
|
||||
: SingleChildScrollView(
|
||||
child: Container(
|
||||
margin: EdgeInsets.symmetric(vertical: 16, horizontal: 16),
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.start,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: model.clinicsList != null &&
|
||||
model.clinicsList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.clinicsList,
|
||||
attributeName: 'ClinicDescription',
|
||||
attributeValueId: 'ClinicID',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedDoctor = null;
|
||||
_selectedClinic = selectedValue;
|
||||
model.getDoctorsList(
|
||||
_selectedClinic['ClinicID']);
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).clinicSelect,
|
||||
_selectedClinic != null
|
||||
? _selectedClinic['ClinicDescription']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: model.doctorsList != null &&
|
||||
model.doctorsList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.doctorsList,
|
||||
attributeName: 'DoctorName',
|
||||
attributeValueId: 'DoctorID',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedDoctor = selectedValue;
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).doctorSelect,
|
||||
_selectedDoctor != null
|
||||
? _selectedDoctor['DoctorName']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).ext, null, false),
|
||||
enabled: true,
|
||||
controller: _extController,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(ONLY_NUMBERS))
|
||||
],
|
||||
keyboardType: TextInputType.number,
|
||||
)),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
priorityBar(context, screenSize),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
AppText(
|
||||
"${TranslationBase.of(context).referralFrequency} ${getPriority()}",
|
||||
fontWeight: FontWeight.bold,
|
||||
fontSize: 16,
|
||||
),
|
||||
SizedBox(
|
||||
height: 20,
|
||||
),
|
||||
Container(
|
||||
height: screenSize.height * 0.070,
|
||||
child: InkWell(
|
||||
onTap: model.referralFrequencyList != null &&
|
||||
model.referralFrequencyList.length > 0
|
||||
? () {
|
||||
ListSelectDialog dialog = ListSelectDialog(
|
||||
list: model.referralFrequencyList,
|
||||
attributeName: 'Description',
|
||||
attributeValueId: 'ParameterCode',
|
||||
okText: TranslationBase.of(context).ok,
|
||||
okFunction: (selectedValue) {
|
||||
setState(() {
|
||||
_selectedFrequency = selectedValue;
|
||||
});
|
||||
},
|
||||
);
|
||||
showDialog(
|
||||
barrierDismissible: false,
|
||||
context: context,
|
||||
builder: (BuildContext context) {
|
||||
return dialog;
|
||||
},
|
||||
);
|
||||
}
|
||||
: null,
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context)
|
||||
.selectReferralFrequency,
|
||||
_selectedFrequency != null
|
||||
? _selectedFrequency['Description']
|
||||
: null,
|
||||
true),
|
||||
enabled: false,
|
||||
),
|
||||
),
|
||||
),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: TextField(
|
||||
decoration: textFieldSelectorDecoration(
|
||||
TranslationBase.of(context).clinicDetailsandRemarks,
|
||||
null,
|
||||
false),
|
||||
enabled: true,
|
||||
controller: _remarksController,
|
||||
inputFormatters: [
|
||||
FilteringTextInputFormatter.allow(
|
||||
RegExp(ONLY_LETTERS))
|
||||
],
|
||||
keyboardType: TextInputType.text,
|
||||
minLines: 4,
|
||||
maxLines: 6,
|
||||
)),
|
||||
SizedBox(
|
||||
height: 10,
|
||||
),
|
||||
Container(
|
||||
child: Column(
|
||||
children: <Widget>[
|
||||
AppText(
|
||||
TranslationBase.of(context).pleaseFill,
|
||||
color: HexColor("#B8382B"),
|
||||
fontWeight: FontWeight.bold,
|
||||
margin: 10,
|
||||
visibility: isValid == null ? false : !isValid,
|
||||
),
|
||||
// TODO replace AppButton with secondary button and add loading
|
||||
AppButton(
|
||||
title: TranslationBase.of(context).send,
|
||||
color: HexColor("#B8382B"),
|
||||
onPressed: () => {referToDoctor(context, model)},
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget priorityBar(BuildContext _context, Size screenSize) {
|
||||
List<String> _priorities = [
|
||||
TranslationBase.of(context).veryUrgent.toUpperCase(),
|
||||
TranslationBase.of(context).urgent.toUpperCase(),
|
||||
TranslationBase.of(context).routine.toUpperCase(),
|
||||
];
|
||||
return Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration:
|
||||
containerBorderDecoration(Color(0Xffffffff), Color(0xFFCCCCCC)),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
children: _priorities.map((item) {
|
||||
bool _isActive = _priorities[_activePriority] == item ? true : false;
|
||||
return Expanded(
|
||||
child: InkWell(
|
||||
child: Center(
|
||||
child: Container(
|
||||
height: screenSize.height * 0.070,
|
||||
decoration: containerBorderDecoration(
|
||||
_isActive ? HexColor("#B8382B") : Colors.white,
|
||||
_isActive ? HexColor("#B8382B") : Colors.white),
|
||||
child: Center(
|
||||
child: Text(
|
||||
item,
|
||||
style: TextStyle(
|
||||
fontSize: 12,
|
||||
color: _isActive
|
||||
? Colors.white
|
||||
: Colors.black, //Colors.black,
|
||||
fontWeight: FontWeight.bold,
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
onTap: () {
|
||||
print(_priorities.indexOf(item));
|
||||
setState(() {
|
||||
_activePriority = _priorities.indexOf(item);
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}).toList(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
String getPriority() {
|
||||
DateTime date = DateTime.now();
|
||||
switch (_activePriority) {
|
||||
case 0:
|
||||
date = date.add(new Duration(hours: 3));
|
||||
break;
|
||||
case 1:
|
||||
date = date.add(new Duration(hours: 6));
|
||||
break;
|
||||
case 2:
|
||||
date = date.add(new Duration(days: 1));
|
||||
break;
|
||||
}
|
||||
var format = DateFormat('yyyy/mm/dd HH:mm a');
|
||||
var time = format.format(date);
|
||||
print(time);
|
||||
return time;
|
||||
}
|
||||
|
||||
referToDoctor(BuildContext context, PatientViewModel model) async {
|
||||
if (!validation()) {
|
||||
return;
|
||||
}
|
||||
|
||||
final routeArgs = ModalRoute.of(context).settings.arguments as Map;
|
||||
PatiantInformtion patient = routeArgs['patient'];
|
||||
|
||||
try {
|
||||
await model.referToDoctor(
|
||||
extension: _extController.value.text,
|
||||
admissionNo: int.parse(patient.admissionNo),
|
||||
referringDoctorRemarks: _remarksController.value.text,
|
||||
frequency: _selectedFrequency['ParameterCode'].toString(),
|
||||
patientID: patient.patientId,
|
||||
patientTypeID: patient.patientType,
|
||||
priority: (_activePriority + 1).toString(),
|
||||
roomID: patient.roomId,
|
||||
selectedClinicID: _selectedClinic['ClinicID'].toString(),
|
||||
selectedDoctorID: _selectedDoctor['DoctorID'].toString(),
|
||||
projectID: patient.projectId);
|
||||
// TODO: Add Translation
|
||||
DrAppToastMsg.showSuccesToast('Reply Successfully');
|
||||
Navigator.pop(context);
|
||||
} catch (e) {
|
||||
DrAppToastMsg.showErrorToast(e);
|
||||
}
|
||||
}
|
||||
|
||||
bool validation() {
|
||||
setState(() {
|
||||
isValid = !_extController.value.text.isNullOrEmpty() &&
|
||||
!_remarksController.value.text.isNullOrEmpty() &&
|
||||
_selectedClinic != null &&
|
||||
_selectedDoctor != null &&
|
||||
_selectedFrequency != null;
|
||||
});
|
||||
return isValid;
|
||||
}
|
||||
|
||||
InputDecoration textFieldSelectorDecoration(
|
||||
String hintText, String selectedText, bool isDropDown) {
|
||||
return InputDecoration(
|
||||
focusedBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
enabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
disabledBorder: OutlineInputBorder(
|
||||
borderSide: BorderSide(color: Color(0xFFCCCCCC), width: 2.0),
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
hintText: selectedText != null ? selectedText : hintText,
|
||||
suffixIcon: isDropDown ? Icon(Icons.arrow_drop_down) : null,
|
||||
hintStyle: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Colors.grey.shade600,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
BoxDecoration containerBorderDecoration(
|
||||
Color containerColor, Color borderColor) {
|
||||
return BoxDecoration(
|
||||
color: containerColor,
|
||||
shape: BoxShape.rectangle,
|
||||
borderRadius: BorderRadius.all(Radius.circular(6)),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: borderColor,
|
||||
width: 2.0,
|
||||
)),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,262 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
class Texts extends StatefulWidget {
|
||||
final String text;
|
||||
final String variant;
|
||||
final Color color;
|
||||
final bool bold;
|
||||
final bool regular;
|
||||
final bool medium;
|
||||
final int maxLength;
|
||||
final bool italic;
|
||||
final TextAlign textAlign;
|
||||
final int maxLines;
|
||||
final bool readMore;
|
||||
final String style;
|
||||
final bool allowExpand;
|
||||
final double fontSize;
|
||||
final FontWeight fontWeight;
|
||||
final TextDecoration textDecoration;
|
||||
|
||||
Texts(this.text,
|
||||
{Key key,
|
||||
this.variant,
|
||||
this.color,
|
||||
this.bold,
|
||||
this.regular,
|
||||
this.medium,
|
||||
this.allowExpand = true,
|
||||
this.italic: false,
|
||||
this.textAlign,
|
||||
this.maxLength = 60,
|
||||
this.maxLines,
|
||||
this.readMore = false,
|
||||
this.style,
|
||||
this.textDecoration, this.fontSize, this.fontWeight})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_TextsState createState() => _TextsState();
|
||||
}
|
||||
|
||||
class _TextsState extends State<Texts> {
|
||||
bool hidden = false;
|
||||
String text = "";
|
||||
|
||||
@override
|
||||
void didUpdateWidget(Texts oldWidget) {
|
||||
setState(() {
|
||||
if (widget.style == "overline")
|
||||
text = widget.text.toUpperCase();
|
||||
else {
|
||||
text = widget.text;
|
||||
}
|
||||
});
|
||||
super.didUpdateWidget(oldWidget);
|
||||
}
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
hidden = widget.readMore;
|
||||
if (widget.style == "overline")
|
||||
text = widget.text.toUpperCase();
|
||||
else {
|
||||
text = widget.text;
|
||||
}
|
||||
super.initState();
|
||||
}
|
||||
|
||||
double _getFontSize() {
|
||||
switch (widget.variant) {
|
||||
case "heading0":
|
||||
return 40.0;
|
||||
case "heading":
|
||||
return 32.0;
|
||||
case "heading2":
|
||||
return 28.0;
|
||||
case "heading3":
|
||||
return 18.0;
|
||||
case "body1":
|
||||
return 18.0;
|
||||
case "body2":
|
||||
return 20.0;
|
||||
case "body2Link":
|
||||
return 16.0;
|
||||
case "caption":
|
||||
return 16.0;
|
||||
case "caption2":
|
||||
return 14.0;
|
||||
case "bodyText":
|
||||
return 15.0;
|
||||
case "bodyText2":
|
||||
return 17.0;
|
||||
case "caption3":
|
||||
return 12.0;
|
||||
case "caption4":
|
||||
return 9.0;
|
||||
case "overline":
|
||||
return 11.0;
|
||||
case "date":
|
||||
return 24.0;
|
||||
default:
|
||||
return 16.0;
|
||||
}
|
||||
}
|
||||
|
||||
FontWeight _getFontWeight() {
|
||||
if (widget.bold ?? false) {
|
||||
return FontWeight.w900;
|
||||
} else if (widget.regular ?? false) {
|
||||
return FontWeight.w500;
|
||||
} else if (widget.medium ?? false) {
|
||||
return FontWeight.w800;
|
||||
} else {
|
||||
if (widget.style == null) {
|
||||
switch (widget.variant) {
|
||||
case "heading":
|
||||
return FontWeight.w900;
|
||||
case "heading2":
|
||||
return FontWeight.w900;
|
||||
case "heading3":
|
||||
return FontWeight.w900;
|
||||
case "body1":
|
||||
return FontWeight.w800;
|
||||
case "body2":
|
||||
return FontWeight.w900;
|
||||
case "body2Link":
|
||||
return FontWeight.w800;
|
||||
case "caption":
|
||||
return FontWeight.w700;
|
||||
case "caption2":
|
||||
return FontWeight.w700;
|
||||
case "bodyText":
|
||||
return FontWeight.w500;
|
||||
case "bodyText2":
|
||||
return FontWeight.w500;
|
||||
case "caption3":
|
||||
return FontWeight.w600;
|
||||
case "caption4":
|
||||
return FontWeight.w600;
|
||||
case "overline":
|
||||
return FontWeight.w800;
|
||||
case "date":
|
||||
return FontWeight.w900;
|
||||
default:
|
||||
return FontWeight.w500;
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
TextStyle _getFontStyle() {
|
||||
switch (widget.style) {
|
||||
case "headline2":
|
||||
return Theme.of(context).textTheme.headline2;
|
||||
case "headline3":
|
||||
return Theme.of(context).textTheme.headline3;
|
||||
case "headline4":
|
||||
return Theme.of(context).textTheme.headline4;
|
||||
case "headline5":
|
||||
return Theme.of(context).textTheme.headline5;
|
||||
case "headline6":
|
||||
return Theme.of(context).textTheme.headline6;
|
||||
case "bodyText2":
|
||||
return Theme.of(context).textTheme.bodyText2;
|
||||
case "bodyText_15":
|
||||
return Theme.of(context).textTheme.bodyText2.copyWith(fontSize: 15.0);
|
||||
case "bodyText1":
|
||||
return Theme.of(context).textTheme.bodyText1;
|
||||
case "caption":
|
||||
return Theme.of(context).textTheme.caption;
|
||||
case "overline":
|
||||
return Theme.of(context).textTheme.overline;
|
||||
case "button":
|
||||
return Theme.of(context).textTheme.button;
|
||||
default:
|
||||
return TextStyle();
|
||||
}
|
||||
}
|
||||
|
||||
return Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: <Widget>[
|
||||
Stack(
|
||||
children: <Widget>[
|
||||
Text(
|
||||
!hidden
|
||||
? text
|
||||
: (text.substring(
|
||||
0,
|
||||
text.length > widget.maxLength
|
||||
? widget.maxLength
|
||||
: text.length)),
|
||||
textAlign: widget.textAlign,
|
||||
overflow: widget.maxLines != null
|
||||
? ((widget.maxLines > 1)
|
||||
? TextOverflow.fade
|
||||
: TextOverflow.ellipsis)
|
||||
: null,
|
||||
maxLines: widget.maxLines ?? null,
|
||||
style: widget.style != null
|
||||
? _getFontStyle().copyWith(
|
||||
fontStyle: widget.italic ? FontStyle.italic : null,
|
||||
color: widget.color != null ? widget.color : null,
|
||||
fontWeight: widget.fontWeight ?? _getFontWeight(),
|
||||
)
|
||||
: TextStyle(
|
||||
fontStyle: widget.italic ? FontStyle.italic : null,
|
||||
color:
|
||||
widget.color != null ? widget.color : Colors.black,
|
||||
fontSize:widget.fontSize?? _getFontSize(),
|
||||
letterSpacing:
|
||||
widget.variant == "overline" ? 1.5 : null,
|
||||
fontWeight: widget.fontWeight ?? _getFontWeight(),
|
||||
fontFamily: 'Poppins',
|
||||
decoration:
|
||||
widget.textDecoration //TextDecoration.lineThrough
|
||||
)),
|
||||
if (widget.readMore && text.length > widget.maxLength && hidden)
|
||||
Positioned(
|
||||
bottom: 0,
|
||||
left: 0,
|
||||
right: 0,
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
gradient: LinearGradient(colors: [
|
||||
Theme.of(context).backgroundColor,
|
||||
Theme.of(context).backgroundColor.withOpacity(0),
|
||||
], begin: Alignment.bottomCenter, end: Alignment.topCenter)),
|
||||
height: 30,
|
||||
),
|
||||
)
|
||||
],
|
||||
),
|
||||
if (widget.allowExpand &&
|
||||
widget.readMore &&
|
||||
text.length > widget.maxLength)
|
||||
Padding(
|
||||
padding: EdgeInsets.only(top: 8.0, right: 8.0, bottom: 8.0),
|
||||
child: InkWell(
|
||||
onTap: () {
|
||||
setState(() {
|
||||
hidden = !hidden;
|
||||
});
|
||||
},
|
||||
child: Text(hidden ? "Read More" : "Read less",
|
||||
style: _getFontStyle().copyWith(
|
||||
color: HexColor('#FF0000'),
|
||||
fontWeight: FontWeight.w800,
|
||||
fontFamily: "Poppins",
|
||||
)),
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,150 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
class Button extends StatefulWidget {
|
||||
final String title;
|
||||
final Widget icon;
|
||||
final VoidCallback onTap;
|
||||
final bool loading;
|
||||
final Color color;
|
||||
|
||||
Button({
|
||||
Key key,
|
||||
this.title = "",
|
||||
this.icon,
|
||||
this.onTap,
|
||||
this.loading= false,
|
||||
this.color,
|
||||
}) : super(key: key);
|
||||
|
||||
|
||||
|
||||
@override
|
||||
_ButtonState createState() => _ButtonState();
|
||||
}
|
||||
|
||||
class _ButtonState extends State<Button> with TickerProviderStateMixin {
|
||||
double _buttonSize = 1.0;
|
||||
AnimationController _animationController;
|
||||
Animation _animation;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
_animationController = AnimationController(
|
||||
vsync: this,
|
||||
lowerBound: 0.7,
|
||||
upperBound: 1.0,
|
||||
duration: Duration(milliseconds: 120));
|
||||
_animation = CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeOutQuad,
|
||||
reverseCurve: Curves.easeOutQuad);
|
||||
_animation.addListener(() {
|
||||
setState(() {
|
||||
_buttonSize = _animation.value;
|
||||
});
|
||||
});
|
||||
super.initState();
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_animationController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
Widget _buildIcon() {
|
||||
if (widget.icon != null && (widget.title != null && widget.title != "")) {
|
||||
return Container(
|
||||
margin: EdgeInsets.only(right: 12.0),
|
||||
height: 24.0,
|
||||
child: widget.icon);
|
||||
} else if (widget.icon != null) {
|
||||
return Container(
|
||||
height: 18.0,
|
||||
width: 18.0,
|
||||
child: widget.icon,
|
||||
);
|
||||
} else {
|
||||
return Container();
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointer(
|
||||
ignoring: widget.loading,
|
||||
child: GestureDetector(
|
||||
onTapDown: (TapDownDetails tap) {
|
||||
_animationController.reverse(from: 1.0);
|
||||
},
|
||||
onTapUp: (TapUpDetails tap) {
|
||||
_animationController.forward();
|
||||
},
|
||||
onTapCancel: () {
|
||||
_animationController.forward();
|
||||
},
|
||||
onTap: Feedback.wrapForTap(widget.onTap, context),
|
||||
behavior: HitTestBehavior.opaque,
|
||||
child: Transform.scale(
|
||||
scale: _buttonSize,
|
||||
child: AnimatedContainer(
|
||||
duration: Duration(milliseconds: 150),
|
||||
margin:
|
||||
EdgeInsets.only(bottom: widget.title.isNotEmpty ? 14.0 : 0.0),
|
||||
padding: EdgeInsets.symmetric(
|
||||
vertical: widget.title != null && widget.title.isNotEmpty
|
||||
? 12.0
|
||||
: 15.0,
|
||||
horizontal: widget.title != null && widget.title.isNotEmpty
|
||||
? 22.0
|
||||
: 19),
|
||||
decoration: BoxDecoration(
|
||||
color: widget.color ?? HexColor('#515b5d'),
|
||||
borderRadius: BorderRadius.all(Radius.circular(10.0)),
|
||||
boxShadow: [
|
||||
BoxShadow(
|
||||
color: Color.fromRGBO(70, 70, 70, 0.28),
|
||||
spreadRadius:
|
||||
_buttonSize < 1.0 ? -(1 - _buttonSize) * 50 : 0.0,
|
||||
offset: Offset(0, 7.0),
|
||||
blurRadius: 24.0)
|
||||
],
|
||||
),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.center,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
_buildIcon(),
|
||||
widget.loading
|
||||
? Padding(
|
||||
padding: const EdgeInsets.all(2.7),
|
||||
child: SizedBox(
|
||||
height: 19.0,
|
||||
width: 19.0,
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.white,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
HexColor('#FFDDD9'),
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Padding(
|
||||
padding: EdgeInsets.only(bottom: 3.0),
|
||||
child: Text(widget.title,
|
||||
style: TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: 17.0,
|
||||
fontWeight: FontWeight.w700,
|
||||
fontFamily: "Poppins")),
|
||||
)
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,92 +0,0 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
import 'app_texts_widget.dart';
|
||||
|
||||
class AppButton extends StatefulWidget {
|
||||
final GestureTapCallback onPressed;
|
||||
final String title;
|
||||
final IconData icon;
|
||||
final Color color;
|
||||
final double fontSize;
|
||||
final double padding;
|
||||
final Color fontColor;
|
||||
final bool loading;
|
||||
final bool disabled;
|
||||
final FontWeight fontWeight;
|
||||
|
||||
AppButton(
|
||||
{@required this.onPressed,
|
||||
this.title,
|
||||
this.icon,
|
||||
this.color,
|
||||
this.fontSize = 2,
|
||||
this.padding = 13,
|
||||
this.loading = false,
|
||||
this.disabled = false,
|
||||
this.fontColor = Colors.white,
|
||||
this.fontWeight});
|
||||
|
||||
_AppButtonState createState() => _AppButtonState();
|
||||
}
|
||||
|
||||
class _AppButtonState extends State<AppButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointer(
|
||||
ignoring: widget.loading,
|
||||
child: RawMaterialButton(
|
||||
fillColor: widget.color != null ? widget.color : HexColor("#B8382C"),
|
||||
splashColor: widget.color,
|
||||
child: Padding(
|
||||
padding: EdgeInsets.only(
|
||||
top: widget.padding,
|
||||
bottom: widget.padding,
|
||||
//right: SizeConfig.widthMultiplier * widget.padding,
|
||||
//left: SizeConfig.widthMultiplier * widget.padding
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
if (widget.icon != null)
|
||||
Icon(
|
||||
widget.icon,
|
||||
color: Colors.white,
|
||||
),
|
||||
if (widget.icon != null)
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
widget.loading
|
||||
? Padding(
|
||||
padding: EdgeInsets.all(2.6),
|
||||
child: SizedBox(
|
||||
height: 19.0,
|
||||
width: 19.0,
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.white,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.grey[300],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: AppText(
|
||||
widget.title,
|
||||
color: widget.fontColor,
|
||||
fontSize: SizeConfig.textMultiplier * widget.fontSize,
|
||||
fontWeight: widget.fontWeight,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onPressed: widget.onPressed,
|
||||
shape: const RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.all(Radius.circular(6))),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,87 +0,0 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class BorderedButton extends StatelessWidget {
|
||||
final String text;
|
||||
final Function handler;
|
||||
final Color textColor;
|
||||
final bool hasBorder;
|
||||
final Color borderColor;
|
||||
final Color backgroundColor;
|
||||
final double vPadding;
|
||||
final double hPadding;
|
||||
final double radius;
|
||||
final double lPadding;
|
||||
final double tPadding;
|
||||
final double rPadding;
|
||||
final double bPadding;
|
||||
final double fontSize;
|
||||
final String fontFamily;
|
||||
final Widget icon;
|
||||
final FontWeight fontWeight;
|
||||
|
||||
BorderedButton(
|
||||
this.text, {
|
||||
this.handler,
|
||||
this.textColor,
|
||||
this.hasBorder = false,
|
||||
this.borderColor,
|
||||
this.backgroundColor,
|
||||
this.vPadding = 0,
|
||||
this.hPadding = 0,
|
||||
this.radius = 4.0,
|
||||
this.lPadding = 4.0,
|
||||
this.tPadding = 0.0,
|
||||
this.rPadding = 4.0,
|
||||
this.bPadding = 0.0,
|
||||
this.fontSize = 0,
|
||||
this.fontFamily = 'WorkSans',
|
||||
this.icon,
|
||||
this.fontWeight,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return GestureDetector(
|
||||
onTap: () {
|
||||
handler();
|
||||
},
|
||||
child: Container(
|
||||
decoration: BoxDecoration(
|
||||
shape: BoxShape.rectangle,
|
||||
color: backgroundColor ?? Colors.white,
|
||||
borderRadius: BorderRadius.circular(radius),
|
||||
border: Border.fromBorderSide(BorderSide(
|
||||
color: hasBorder ? borderColor : Colors.white,
|
||||
width: 0.8,
|
||||
)),
|
||||
),
|
||||
child: Container(
|
||||
padding: (hPadding > 0 || vPadding > 0)
|
||||
? EdgeInsets.symmetric(
|
||||
vertical: vPadding, horizontal: hPadding)
|
||||
: EdgeInsets.fromLTRB(
|
||||
lPadding, tPadding, rPadding, bPadding),
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
icon != null ? icon : Container(),
|
||||
Container(
|
||||
margin: EdgeInsets.symmetric(horizontal: 2),
|
||||
child: Text(
|
||||
text,
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: fontSize == 0 ? SizeConfig.textMultiplier * 1.6 : fontSize,
|
||||
fontWeight: fontWeight != null ? fontWeight : FontWeight.normal,
|
||||
fontFamily: fontFamily,
|
||||
color: textColor ?? Color(0xffc4aa54)),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,117 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hexcolor/hexcolor.dart';
|
||||
|
||||
import '../app_texts_widget.dart';
|
||||
|
||||
class AppButton extends StatefulWidget {
|
||||
final GestureTapCallback onPressed;
|
||||
final String title;
|
||||
final IconData iconData;
|
||||
final Widget icon;
|
||||
final Color color;
|
||||
final double fontSize;
|
||||
final double padding;
|
||||
final Color fontColor;
|
||||
final bool loading;
|
||||
final bool disabled;
|
||||
final FontWeight fontWeight;
|
||||
final bool hasBorder;
|
||||
final Color borderColor;
|
||||
final double radius;
|
||||
final double vPadding;
|
||||
final double hPadding;
|
||||
|
||||
AppButton({
|
||||
@required this.onPressed,
|
||||
this.title,
|
||||
this.iconData,
|
||||
this.icon,
|
||||
this.color,
|
||||
this.fontSize = 2,
|
||||
this.padding = 13,
|
||||
this.loading = false,
|
||||
this.disabled = false,
|
||||
this.fontColor = Colors.white,
|
||||
this.fontWeight = FontWeight.normal,
|
||||
this.vPadding = 0,
|
||||
this.hPadding = 0,
|
||||
this.radius = 8.0,
|
||||
this.hasBorder = false,
|
||||
this.borderColor,
|
||||
});
|
||||
|
||||
_AppButtonState createState() => _AppButtonState();
|
||||
}
|
||||
|
||||
class _AppButtonState extends State<AppButton> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return IgnorePointer(
|
||||
ignoring: widget.loading,
|
||||
child: RawMaterialButton(
|
||||
fillColor: widget.color != null ? widget.color : HexColor("#B8382C"),
|
||||
splashColor: widget.color,
|
||||
child: Padding(
|
||||
padding: (widget.hPadding > 0 || widget.vPadding > 0)
|
||||
? EdgeInsets.symmetric(
|
||||
vertical: widget.vPadding, horizontal: widget.hPadding)
|
||||
: EdgeInsets.only(
|
||||
top: widget.padding,
|
||||
bottom: widget.padding,
|
||||
//right: SizeConfig.widthMultiplier * widget.padding,
|
||||
//left: SizeConfig.widthMultiplier * widget.padding
|
||||
),
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.max,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: <Widget>[
|
||||
if (widget.icon != null)
|
||||
Container(width: 25, height: 25, child: widget.icon),
|
||||
if (widget.iconData != null)
|
||||
Icon(
|
||||
widget.iconData,
|
||||
color: Colors.white,
|
||||
),
|
||||
if (widget.icon != null || widget.iconData != null)
|
||||
SizedBox(
|
||||
width: 5.0,
|
||||
),
|
||||
widget.loading
|
||||
? Padding(
|
||||
padding: EdgeInsets.all(2.6),
|
||||
child: SizedBox(
|
||||
height: 19.0,
|
||||
width: 19.0,
|
||||
child: CircularProgressIndicator(
|
||||
backgroundColor: Colors.white,
|
||||
valueColor: AlwaysStoppedAnimation<Color>(
|
||||
Colors.grey[300],
|
||||
),
|
||||
),
|
||||
),
|
||||
)
|
||||
: Container(
|
||||
child: AppText(
|
||||
widget.title,
|
||||
color: widget.fontColor,
|
||||
fontSize: SizeConfig.textMultiplier * widget.fontSize,
|
||||
fontWeight: widget.fontWeight,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
onPressed: widget.onPressed,
|
||||
shape: RoundedRectangleBorder(
|
||||
side: BorderSide(
|
||||
color:
|
||||
widget.hasBorder ? widget.borderColor : widget.color,
|
||||
width: 0.8,
|
||||
),
|
||||
borderRadius: BorderRadius.all(Radius.circular(widget.radius))),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import 'app_buttons_widget.dart';
|
||||
|
||||
class ButtonBottomSheet extends StatelessWidget {
|
||||
|
||||
final double height;
|
||||
final String buttonTitle;
|
||||
final Function onPressed;
|
||||
|
||||
ButtonBottomSheet({@required this.height, @required this.buttonTitle, @required this.onPressed});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Container(
|
||||
height: height ?? null,
|
||||
margin: EdgeInsets.symmetric(horizontal: 16, vertical: 16),
|
||||
child: AppButton(
|
||||
title: buttonTitle,
|
||||
onPressed: onPressed,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -1,10 +1,10 @@
|
||||
import 'package:doctor_app_flutter/config/size_config.dart';
|
||||
import 'package:doctor_app_flutter/icons_app/doctor_app_icons.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_field_error.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/user-guid/text_fields/text_fields_utils.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_field_error.dart';
|
||||
import 'package:doctor_app_flutter/widgets/shared/text_fields/text_fields_utils.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import '../../app_texts_widget.dart';
|
||||
|
||||
import '../app_texts_widget.dart';
|
||||
|
||||
class AppTextFieldCustom extends StatefulWidget {
|
||||
final double height;
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue