code update in progress

merge-update-with-lab-changes
Sultan khan 2 years ago
parent 1c34843bc5
commit 0c534cffae

@ -19,7 +19,7 @@ class VitalSignViewModel extends BaseViewModel {
String respirationBeatPerMinute = "0";
String bloodPressure = "0 / 0";
getPatientVitalSign({int? appointmentNo, required int projectID}) async {
getPatientVitalSign({int? appointmentNo, int? projectID}) async {
setState(ViewState.Busy);
if (appointmentNo != null && projectID != null) {

@ -74,9 +74,8 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
appMap = AppMap(
cameraPosition.toMap() as Map<dynamic, dynamic>,
//Changed by Aamir
onCameraMove: (camera) {
_updatePosition(camera as CameraPosition);
},
onCameraMove: _updatePosition!,
onMapCreated: () {
_getUserLocation();
setState(() {});
@ -233,9 +232,9 @@ class RRTRequestPickupAddressPageState extends State<RRTRequestPickupAddressPage
)));
}
void _updatePosition(CameraPosition _position) {
latitude = _position.target.latitude;
longitude = _position.target.longitude;
void _updatePosition() {
latitude = cameraPosition.target.latitude;
longitude = cameraPosition.target.longitude;
selectedAddress.latLong = latitude.toString() + "," + longitude.toString();
}

@ -54,7 +54,7 @@ class ToDo extends StatefulWidget {
late MyInAppBrowser browser;
bool isShowAppBar = true;
Function? onBackClick;
VoidCallbackAction? onBackClick;
ToDo({required this.isShowAppBar, this.onBackClick});

@ -50,10 +50,10 @@ class _LiveCarePatmentPageState extends State<LiveCarePatmentPage> {
showNewAppBarTitle: true,
showNewAppBar: true,
description: TranslationBase.of(context).erConsultation,
onTap: () {
Navigator.pop(context);
Navigator.pop(context);
},
// onTap: () {
// Navigator.pop(context);
// Navigator.pop(context);
// },
body: Container(
width: double.infinity,
height: double.infinity,

@ -13,7 +13,7 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class MedicalProfilePageNew extends StatefulWidget {
Function? onTap;
VoidCallbackAction? onTap;
String? a;
MedicalProfilePageNew({this.onTap});
@override

@ -19,9 +19,9 @@ class StepsTracker extends StatefulWidget {
}
class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderStateMixin {
TabController _tabController;
TabController? _tabController;
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
int weeklyStatsAvgValue = 0;
int monthlyStatsAvgValue = 0;
@ -76,13 +76,13 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
unselectedLabelColor: Color(0xff575757),
labelPadding: EdgeInsets.only(top: 0, bottom: 0, left: 20, right: 20),
labelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontFamily: projectViewModel!.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
),
unselectedLabelStyle: TextStyle(
fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
fontFamily: projectViewModel!.isArabic ? 'Cairo' : 'Poppins',
fontSize: 16,
fontWeight: FontWeight.w600,
letterSpacing: -0.48,
@ -129,7 +129,7 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
res['Med_GetWeekStepsTransactionsStsList'].forEach((element) {
weekyStepsList.add(new WeeklyStepsResModel.fromJson(element));
if (element['Value'] != null) {
num value = num.tryParse(element['Value'] ?? "0");
num value = num.parse(element['Value'] ?? "0");
avgWeeklyStepsValue += value.toInt();
weeklyDataLength++;
}
@ -158,7 +158,7 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
res['Med_GetMonthStepsTransactionsStsList'].forEach((element) {
monthlyStepsList.add(new WeeklyStepsResModel.fromJson(element));
if (element['Value'] != null) {
num value = num.tryParse(element['Value'] ?? "0");
num value = num.parse(element['Value'] ?? "0");
avgMonthlyStepsValue += value.toInt();
monthlyDataLength++;
}
@ -212,8 +212,8 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
(element) {
weeklyTimeSeriesData.add(
TimeSeriesSales2(
DateUtil.convertStringToDate(element.machineDate),
element.value != null ? element.value.toDouble() : 0.0,
DateUtil.convertStringToDate(element.machineDate!),
element.value != null ? element.value!.toDouble() : 0.0,
),
);
},
@ -228,8 +228,8 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
(element) {
monthlyTimeSeriesData.add(
TimeSeriesSales2(
DateUtil.convertStringToDate(element.machineDate),
element.value != null ? element.value.toDouble() : 0.0,
DateUtil.convertStringToDate(element.machineDate!),
element.value != null ? element.value!.toDouble() : 0.0,
),
);
},
@ -244,8 +244,8 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
(element) {
yearlyTimeSeriesData.add(
TimeSeriesSales2(
new DateTime(element.year, element.month, 1),
element.valueSum != null ? double.tryParse(element.valueSum.toString()) : 0.0,
new DateTime(element.year!, element.month!, 1),
element.valueSum! != null ? double.parse(element.valueSum.toString()) : 0.0,
),
);
},
@ -497,7 +497,7 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
children: [
Utils.tableColumnValue(
'${DateUtil.getDayMonthYearDateFormatted(
new DateTime(step.year, step.month, 1),
new DateTime(step.year!, step.month!, 1),
)} ',
isCapitable: false,
mProjectViewModel: projectViewModel),
@ -527,7 +527,7 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
children: [
Utils.tableColumnValue(
'${DateUtil.getDayMonthYearDateFormatted(
DateUtil.convertStringToDate(step.machineDate),
DateUtil.convertStringToDate(step.machineDate!),
)} ',
isCapitable: false,
mProjectViewModel: projectViewModel),
@ -557,7 +557,7 @@ class _StepsTrackerState extends State<StepsTracker> with SingleTickerProviderSt
children: [
Utils.tableColumnValue(
'${DateUtil.getDayMonthYearDateFormatted(
DateUtil.convertStringToDate(step.machineDate),
DateUtil.convertStringToDate(step.machineDate!),
)} ',
isCapitable: false,
mProjectViewModel: projectViewModel),

@ -17,8 +17,8 @@ import 'package:flutter_svg/svg.dart';
class VitalSignDetailsScreen extends StatelessWidget {
static const String url = "assets/images/";
int appointmentNo;
int projectID;
int? appointmentNo;
int? projectID;
bool isNotOneAppointment;
VitalSignDetailsScreen({this.appointmentNo, this.projectID, this.isNotOneAppointment = true});
@ -44,7 +44,7 @@ class VitalSignDetailsScreen extends StatelessWidget {
imagesInfo.add(ImagesInfo(
imageEn: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/en/1.png', imageAr: 'https://hmgwebservices.com/Images/MobileApp/imges-info/my-vital-signs/ar/1.png'));
return BaseView<VitalSignViewModel>(
onModelReady: appointmentNo != null && projectID != null ? (model) => model.getPatientVitalSign(appointmentNo: appointmentNo, projectID: projectID) : (model) => model.getPatientVitalSign(),
onModelReady: appointmentNo != null && projectID != null ? (model) => model.getPatientVitalSign(appointmentNo: appointmentNo, projectID: projectID!) : (model) => model!.getPatientVitalSign(),
builder: (_, mode, widget) {
initList(context, mode);
return AppScaffold(

@ -8,13 +8,13 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class VitalSignDetailsWidget extends StatefulWidget {
final List<VitalSignResModel> vitalList;
final String title1;
final String title2;
final String viewKey;
final List<VitalSignResModel>? vitalList;
final String? title1;
final String? title2;
final String? viewKey;
VitalSignDetailsWidget(
{Key key, this.vitalList, this.title1, this.title2, this.viewKey});
{Key? key, this.vitalList, this.title1, this.title2, this.viewKey});
@override
_VitalSignDetailsWidgetState createState() => _VitalSignDetailsWidgetState();
@ -39,7 +39,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
children: <Widget>[
Table(
border: TableBorder.symmetric(
inside: BorderSide(width: 2.0, color: Colors.grey[300]),
inside: BorderSide(width: 2.0, color: Colors.grey[300]!),
),
children: fullData(projectViewModel),
),
@ -85,7 +85,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
height: 60),
)
]));
widget.vitalList.forEach((vital) {
widget.vitalList!.forEach((vital) {
var data = vital.toJson()[widget.viewKey];
if (data != 0)
tableRow.add(TableRow(children: [
@ -95,7 +95,7 @@ class _VitalSignDetailsWidgetState extends State<VitalSignDetailsWidget> {
color: Colors.white,
child: Center(
child: Texts(
'${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(vital.vitalSignDate.weekday) : DateUtil.getWeekDay(vital.vitalSignDate.weekday)}, ${vital.vitalSignDate.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(vital.vitalSignDate.month) : DateUtil.getMonth(vital.vitalSignDate.month)}, ${vital.vitalSignDate.year} ',
'${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(vital.vitalSignDate!.weekday) : DateUtil.getWeekDay(vital.vitalSignDate!.weekday)}, ${vital.vitalSignDate!.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(vital.vitalSignDate!.month) : DateUtil.getMonth(vital.vitalSignDate!.month)}, ${vital.vitalSignDate!.year} ',
textAlign: TextAlign.center,
),
),

@ -8,14 +8,14 @@ import 'package:flutter_svg/flutter_svg.dart';
class VitalSignItem extends StatelessWidget {
const VitalSignItem({
Key key,
@required this.vitalSign,
Key? key,
required this.vitalSign,
this.height,
this.width,
}) : super(key: key);
final double height;
final double width;
final double? height;
final double? width;
final VitalSign vitalSign;
@override

@ -8,13 +8,13 @@ import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class VitalSignItemDetailsScreen extends StatelessWidget {
final VitalSignDetails pageKey;
final String pageTitle;
List<Map> VSchart;
final VitalSignDetails? pageKey;
final String? pageTitle;
List<Map>? VSchart;
VitalSignItemDetailsScreen({this.vitalList, this.pageKey, this.pageTitle});
final List<VitalSignResModel> vitalList;
final List<VitalSignResModel>? vitalList;
@override
Widget build(BuildContext context) {
@ -157,20 +157,20 @@ class VitalSignItemDetailsScreen extends StatelessWidget {
default:
}
return AppScaffold(
appBarTitle: pageTitle,
appBarTitle: pageTitle!,
isShowAppBar: true,
showNewAppBarTitle: true,
showNewAppBar: true,
body: ListView(
children: VSchart.map((chartInfo) {
var vitalListTemp = vitalList.where(
children: VSchart!.map((chartInfo) {
var vitalListTemp = vitalList!.where(
(element) => element.toJson()[chartInfo['viewKey']] != null,
);
if (vitalListTemp.length != 0 && chartInfo['viewKey'] == 'BloodPressure') {
return VitalSingChartBloodPressure(
vitalList: vitalList,
vitalList: vitalList!,
name: projectViewModel.isArabic ? chartInfo['nameAr'] : chartInfo['name'],
title1: chartInfo['title1'],
title2: projectViewModel.isArabic ? chartInfo['title2Ar'] : chartInfo['title2'],
@ -182,7 +182,7 @@ class VitalSignItemDetailsScreen extends StatelessWidget {
return vitalListTemp.length != 0
? VitalSingChartAndDetials(
vitalList: vitalList,
vitalList: vitalList!,
name: projectViewModel.isArabic ? chartInfo['nameAr'] : chartInfo['name'],
title1: chartInfo['title1'],
title2: projectViewModel.isArabic ? chartInfo['title2Ar'] : chartInfo['title2'],

@ -14,12 +14,12 @@ import 'LineChartCurved.dart';
class VitalSingChartAndDetials extends StatefulWidget {
VitalSingChartAndDetials({
Key key,
@required this.vitalList,
@required this.name,
@required this.viewKey,
@required this.title1,
@required this.title2,
Key? key,
required this.vitalList,
required this.name,
required this.viewKey,
required this.title1,
required this.title2,
}) : super(key: key);
final List<VitalSignResModel> vitalList;
@ -35,7 +35,7 @@ class VitalSingChartAndDetials extends StatefulWidget {
class _VitalSingChartAndDetialsState extends State<VitalSingChartAndDetials> {
List<TimeSeriesSales2> timeSeriesData = [];
bool isExpended = true;
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
@override
void initState() {
@ -116,7 +116,7 @@ class _VitalSingChartAndDetialsState extends State<VitalSingChartAndDetials> {
TableRow(
children: [
Utils.tableColumnValue(
"${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate.weekday)}, ${labResultList[i].vitalSignDate.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate.month) : DateUtil.getMonth(labResultList[i].vitalSignDate.month)}, ${labResultList[i].vitalSignDate.year}",
"${projectViewModel!.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate!.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate!.weekday)}, ${labResultList[i].vitalSignDate!.day} ${projectViewModel!.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate!.month) : DateUtil.getMonth(labResultList[i].vitalSignDate!.month)}, ${labResultList[i].vitalSignDate!.year}",
isLast: i == (labResultList.length - 1)),
Utils.tableColumnValue('${labResultList[i].toJson()[widget.viewKey]}', isLast: i == (labResultList.length - 1)),
],
@ -134,7 +134,7 @@ class _VitalSingChartAndDetialsState extends State<VitalSingChartAndDetials> {
if (element.toJson()[widget.viewKey] != null && element.toJson()[widget.viewKey]?.toInt() != 0)
timeSeriesData.add(
TimeSeriesSales2(
new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day),
new DateTime(element.vitalSignDate!.year, element.vitalSignDate!.month, element.vitalSignDate!.day),
element.toJson()[widget.viewKey].toDouble(),
),
);

@ -12,14 +12,14 @@ import 'LineChartCurvedBloodPressure.dart';
class VitalSingChartBloodPressure extends StatelessWidget {
VitalSingChartBloodPressure({
Key key,
@required this.vitalList,
@required this.name,
@required this.viewKey1,
@required this.viewKey2,
@required this.title1,
@required this.title2,
@required this.title3,
Key? key,
required this.vitalList,
required this.name,
required this.viewKey1,
required this.viewKey2,
required this.title1,
required this.title2,
required this.title3,
}) : super(key: key);
final List<VitalSignResModel> vitalList;
@ -31,7 +31,7 @@ class VitalSingChartBloodPressure extends StatelessWidget {
final String title3;
List<TimeSeriesSales2> timeSeriesData1 = [];
List<TimeSeriesSales2> timeSeriesData2 = [];
ProjectViewModel projectViewModel;
ProjectViewModel? projectViewModel;
@override
Widget build(BuildContext context) {
@ -112,7 +112,7 @@ class VitalSingChartBloodPressure extends StatelessWidget {
TableRow(
children: [
Utils.tableColumnValue(
"${projectViewModel.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate.weekday)}, ${labResultList[i].vitalSignDate.day} ${projectViewModel.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate.month) : DateUtil.getMonth(labResultList[i].vitalSignDate.month)}, ${labResultList[i].vitalSignDate.year}",
"${projectViewModel!.isArabic ? DateUtil.getWeekDayArabic(labResultList[i].vitalSignDate!.weekday) : DateUtil.getWeekDay(labResultList[i].vitalSignDate!.weekday)}, ${labResultList[i].vitalSignDate!.day} ${projectViewModel!.isArabic ? DateUtil.getMonthArabic(labResultList[i].vitalSignDate!.month) : DateUtil.getMonth(labResultList[i].vitalSignDate!.month)}, ${labResultList[i].vitalSignDate!.year}",
isLast: i == (labResultList.length - 1)),
Utils.tableColumnValue('${labResultList[i].toJson()[viewKey1]}', isLast: i == (labResultList.length - 1)),
Utils.tableColumnValue('${labResultList[i].toJson()[viewKey2]}', isLast: i == (labResultList.length - 1)),
@ -131,14 +131,14 @@ class VitalSingChartBloodPressure extends StatelessWidget {
if (element.toJson()[viewKey1]?.toInt() != 0)
timeSeriesData1.add(
TimeSeriesSales2(
new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day),
new DateTime(element.vitalSignDate!.year, element.vitalSignDate!.month, element.vitalSignDate!.day),
element.toJson()[viewKey1].toDouble(),
),
);
if (element.toJson()[viewKey2]?.toInt() != 0)
timeSeriesData2.add(
TimeSeriesSales2(
new DateTime(element.vitalSignDate.year, element.vitalSignDate.month, element.vitalSignDate.day),
new DateTime(element.vitalSignDate!.year, element.vitalSignDate!.month, element.vitalSignDate!.day),
element.toJson()[viewKey2].toDouble(),
),
);

@ -19,7 +19,7 @@ class PackageOrderCompletedPage extends StatelessWidget {
String? subTitle;
String? actionTitle;
PackageOrderCompletedPage({this.buttonWidth, this.buttonHeight, required this.heading, required this.title, required this.subTitle, this.actionTitle});
PackageOrderCompletedPage({this.buttonWidth, this.buttonHeight, this.heading, this.title, this.subTitle, this.actionTitle});
@override
Widget build(BuildContext context) {

@ -37,262 +37,262 @@ class NumberTextInputFormatter extends TextInputFormatter {
final _mobileFormatter = NumberTextInputFormatter();
// class TextFields extends StatefulWidget {
// TextFields(
// {Key? key,
// this.type,
// this.hintText,
// this.suffixIcon,
// this.autoFocus,
// this.onChanged,
// this.initialValue,
// this.minLines,
// this.maxLines,
// this.inputFormatters,
// this.padding,
// this.focus = false,
// this.maxLengthEnforced = true,
// this.suffixIconColor,
// this.inputAction,
// this.onSubmit,
// this.keepPadding = true,
// this.textCapitalization = TextCapitalization.none,
// this.controller,
// this.keyboardType,
// this.validator,
// this.borderOnlyError = false,
// this.onSaved,
// this.onSuffixTap,
// this.readOnly= false,
// this.maxLength,
// this.prefixIcon,
// this.bare = false,
// this.onTap,
// this.fontSize = 16.0,
// this.fontWeight = FontWeight.w700,
// this.fillColor,
// this.hintColor})
// : super(key: key);
//
// final String? hintText;
// final String? initialValue;
// final String? type;
// final bool? autoFocus;
// final IconData? suffixIcon;
// final Color? suffixIconColor;
// final Icon? prefixIcon;
// final VoidCallback? onTap;
// final TextEditingController? controller;
// final TextInputType? keyboardType;
// final FormFieldValidator? validator;
// final Function? onSaved;
// final Function? onSuffixTap;
// final Function? onChanged;
// final Function? onSubmit;
// final bool? readOnly;
// final int? maxLength;
// final int? minLines;
// final int? maxLines;
// final bool? maxLengthEnforced;
// final bool? bare;
// final TextInputAction? inputAction;
// final double? fontSize;
// final FontWeight? fontWeight;
// final bool? keepPadding;
// final TextCapitalization? textCapitalization;
// final List<TextInputFormatter>? inputFormatters;
// final EdgeInsets? padding;
// final bool? focus;
// final bool? borderOnlyError;
// final Color? hintColor;
// final Color? fillColor;
//
// @override
// _TextFieldsState createState() => _TextFieldsState();
// }
//
// class _TextFieldsState extends State<TextFields> {
// final FocusNode _focusNode = FocusNode();
// bool? focus = false;
// bool? view = false;
//
// @override
// void initState() {
// super.initState();
// _focusNode.addListener(() {
// setState(() {
// focus = _focusNode.hasFocus;
// });
// });
// }
//
// @override
// void didUpdateWidget(TextFields oldWidget) {
// if (widget.focus != null) _focusNode.requestFocus();
// super.didUpdateWidget(oldWidget);
// }
//
// @override
// void dispose() {
// _focusNode.dispose();
// super.dispose();
// }
//
// Widget _buildSuffixIcon() {
// switch (widget.type) {
// case "password":
// return Padding(
// padding: const EdgeInsets.only(right: 8.0),
// child: view!
// ? InkWell(
// onTap: () {
// this.setState(
// () {
// view = false;
// },
// );
// },
// child: Icon(
// Icons.remove_red_eye_sharp,
// size: 24.0,
// color: Color.fromRGBO(78, 62, 253, 1.0),
// ),
// )
// : InkWell(
// onTap: () {
// this.setState(() {
// view = true;
// });
// },
// child: Icon(Icons.remove_red_eye_sharp,
// size: 24.0, color: Colors.grey[500]),
// ),
// );
// default:
// if (widget.suffixIcon != null)
// return InkWell(
// onTap: widget.onSuffixTap,
// child: Icon(widget.suffixIcon,
// size: 22.0,
// color: widget.suffixIconColor != null
// ? widget.suffixIconColor
// : Colors.grey[500]),
// );
// else
// return null;
// }
// }
//
// bool _determineReadOnly() {
// if (widget.readOnly != null && widget.readOnly!) {
// _focusNode.unfocus();
// return true;
// } else {
// return false;
// }
// }
//
// @override
// Widget build(BuildContext context) {
// return (AnimatedContainer(
// duration: Duration(milliseconds: 300),
// decoration: widget.bare!
// ? null
// : BoxDecoration(boxShadow: [
// // BoxShadow(
// // color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0),
// // offset: Offset(0.0, 13.0),
// // blurRadius: focus ? 34.0 : 12.0)
// BoxShadow(
// color: Color.fromRGBO(110, 68, 80, focus ? 0.20 : 0),
// offset: Offset(0.0, 13.0),
// blurRadius: focus ? 34.0 : 12.0)
// ]),
// child: TextFormField(
// keyboardAppearance: Theme.of(context).brightness,
// scrollPhysics: BouncingScrollPhysics(),
// textCapitalization: widget.textCapitalization,
// onFieldSubmitted: widget.inputAction == TextInputAction.next
// ? (widget.onSubmit != null
// ? widget.onSubmit
// : (val) {
// _focusNode.nextFocus();
// })
// : widget.onSubmit,
// textInputAction: widget.inputAction,
// minLines: widget.minLines ?? 1,
// maxLines: widget.maxLines ?? 1,
// // maxLengthEnforcement: widget.maxLengthEnforced,
// initialValue: widget.initialValue,
// onChanged: widget.onChanged,
// focusNode: _focusNode,
// maxLength: widget.maxLength ?? null,
// controller: widget.controller,
// keyboardType: widget.keyboardType,
// readOnly: _determineReadOnly(),
// obscureText: widget.type == "password" && !view ? true : false,
// autofocus: widget.autoFocus ?? false,
// validator: widget.validator,
// onSaved: widget.onSaved,
// style: Theme.of(context)
// .textTheme
// .bodyText1
// .copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight),
// inputFormatters: widget.keyboardType == TextInputType.phone
// ? <TextInputFormatter>[
// FilteringTextInputFormatter.digitsOnly,
// _mobileFormatter,
// ]
// : widget.inputFormatters,
// decoration: InputDecoration(
// counterText: "",
// hintText: widget.hintText,
// hintStyle: TextStyle(
// fontSize: widget.fontSize,
// fontWeight: widget.fontWeight,
// color: widget.hintColor ?? Theme.of(context).hintColor,
// ),
// contentPadding: widget.padding != null
// ? widget.padding
// : EdgeInsets.symmetric(
// vertical: (widget.bare && !widget.keepPadding) ? 0.0 : 10.0,
// horizontal: 16.0),
// filled: true,
// fillColor: widget.bare
// ? Colors.transparent
// : Theme.of(context).backgroundColor,
// suffixIcon: _buildSuffixIcon(),
// prefixIcon: widget.prefixIcon,
// errorStyle: TextStyle(
// fontSize: 14.0,
// fontWeight: widget.fontWeight,
// height: widget.borderOnlyError ? 0.0 : null),
// errorBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: Theme.of(context)
// .errorColor
// .withOpacity(widget.bare ? 0.0 : 0.5),
// width: 1.0),
// borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)),
// focusedErrorBorder: OutlineInputBorder(
// borderSide: BorderSide(
// color: Theme.of(context)
// .errorColor
// .withOpacity(widget.bare ? 0.0 : 0.5),
// width: 1.0),
// borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)),
// focusedBorder: OutlineInputBorder(
// borderSide: BorderSide(color: Colors.grey, width: 1.0),
// borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)),
// disabledBorder: OutlineInputBorder(
// borderSide: BorderSide(color: Colors.grey, width: 1.0),
// borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0)),
// enabledBorder: OutlineInputBorder(
// borderSide: BorderSide(color: Colors.grey, width: 1.0),
// borderRadius: BorderRadius.circular(widget.bare ? 0.0 : 8.0),
// ),
// ),
// ),
// ));
// }
// }
class TextFields extends StatefulWidget {
TextFields(
{Key? key,
this.type,
this.hintText,
this.suffixIcon,
this.autoFocus,
this.onChanged,
this.initialValue,
this.minLines,
this.maxLines,
this.inputFormatters,
this.padding,
this.focus = false,
this.maxLengthEnforced = true,
this.suffixIconColor,
this.inputAction,
this.onSubmit,
this.keepPadding = true,
this.textCapitalization = TextCapitalization.none,
this.controller,
this.keyboardType,
this.validator,
this.borderOnlyError = false,
this.onSaved,
this.onSuffixTap,
this.readOnly= false,
this.maxLength,
this.prefixIcon,
this.bare = false,
this.onTap,
this.fontSize = 16.0,
this.fontWeight = FontWeight.w700,
this.fillColor,
this.hintColor})
: super(key: key);
final String? hintText;
final String? initialValue;
final String? type;
final bool? autoFocus;
final IconData? suffixIcon;
final Color? suffixIconColor;
final Icon? prefixIcon;
final VoidCallback? onTap;
final TextEditingController? controller;
final TextInputType? keyboardType;
final FormFieldValidator? validator;
final Function(String?)? onSaved;
final VoidCallback? onSuffixTap;
final Function(String?)? onChanged;
final Function(String?)? onSubmit;
final bool? readOnly;
final int? maxLength;
final int? minLines;
final int? maxLines;
final bool? maxLengthEnforced;
final bool? bare;
final TextInputAction? inputAction;
final double? fontSize;
final FontWeight? fontWeight;
final bool? keepPadding;
final TextCapitalization? textCapitalization;
final List<TextInputFormatter>? inputFormatters;
final EdgeInsets? padding;
final bool? focus;
final bool? borderOnlyError;
final Color? hintColor;
final Color? fillColor;
@override
_TextFieldsState createState() => _TextFieldsState();
}
class _TextFieldsState extends State<TextFields> {
final FocusNode _focusNode = FocusNode();
bool? focus = false;
bool? view = false;
@override
void initState() {
super.initState();
_focusNode.addListener(() {
setState(() {
focus = _focusNode.hasFocus;
});
});
}
@override
void didUpdateWidget(TextFields oldWidget) {
if (widget.focus != null) _focusNode.requestFocus();
super.didUpdateWidget(oldWidget);
}
@override
void dispose() {
_focusNode.dispose();
super.dispose();
}
Widget _buildSuffixIcon() {
switch (widget.type) {
case "password":
return Padding(
padding: const EdgeInsets.only(right: 8.0),
child: view!
? InkWell(
onTap: () {
this.setState(
() {
view = false;
},
);
},
child: Icon(
Icons.remove_red_eye_sharp,
size: 24.0,
color: Color.fromRGBO(78, 62, 253, 1.0),
),
)
: InkWell(
onTap: () {
this.setState(() {
view = true;
});
},
child: Icon(Icons.remove_red_eye_sharp,
size: 24.0, color: Colors.grey[500]),
),
);
default:
if (widget.suffixIcon != null)
return InkWell(
onTap: widget.onSuffixTap,
child: Icon(widget.suffixIcon,
size: 22.0,
color: widget.suffixIconColor != null
? widget.suffixIconColor
: Colors.grey[500]),
);
else
return SizedBox();
}
}
bool _determineReadOnly() {
if (widget.readOnly != null && widget.readOnly!) {
_focusNode.unfocus();
return true;
} else {
return false;
}
}
@override
Widget build(BuildContext context) {
return (AnimatedContainer(
duration: Duration(milliseconds: 300),
decoration: widget.bare!
? null
: BoxDecoration(boxShadow: [
// BoxShadow(
// color: Color.fromRGBO(70, 68, 167, focus ? 0.20 : 0),
// offset: Offset(0.0, 13.0),
// blurRadius: focus ? 34.0 : 12.0)
BoxShadow(
color: Color.fromRGBO(110, 68, 80, focus! ? 0.20 : 0),
offset: Offset(0.0, 13.0),
blurRadius: focus! ? 34.0 : 12.0)
]),
child: TextFormField(
keyboardAppearance: Theme.of(context).brightness,
scrollPhysics: BouncingScrollPhysics(),
textCapitalization: widget.textCapitalization!,
onFieldSubmitted: widget.inputAction! == TextInputAction.next!
? (widget.onSubmit! != null
? widget.onSubmit!
: (val) {
_focusNode.nextFocus!();
})
: widget.onSubmit!,
textInputAction: widget.inputAction,
minLines: widget.minLines ?? 1,
maxLines: widget.maxLines ?? 1,
// maxLengthEnforcement: widget.maxLengthEnforced,
initialValue: widget.initialValue,
onChanged: widget.onChanged!,
focusNode: _focusNode,
maxLength: widget.maxLength ?? null,
controller: widget.controller,
keyboardType: widget.keyboardType,
readOnly: _determineReadOnly(),
obscureText: widget.type == "password" && !view! ? true : false,
autofocus: widget.autoFocus ?? false,
validator: widget.validator,
onSaved: widget.onSaved,
style: Theme.of(context)
.textTheme
.bodyText1!
.copyWith(fontSize: widget.fontSize, fontWeight: widget.fontWeight),
inputFormatters: widget.keyboardType == TextInputType.phone
? <TextInputFormatter>[
FilteringTextInputFormatter.digitsOnly,
_mobileFormatter,
]
: widget.inputFormatters,
decoration: InputDecoration(
counterText: "",
hintText: widget.hintText,
hintStyle: TextStyle(
fontSize: widget.fontSize,
fontWeight: widget.fontWeight,
color: widget.hintColor ?? Theme.of(context).hintColor,
),
contentPadding: widget.padding != null
? widget.padding
: EdgeInsets.symmetric(
vertical: (widget.bare! && !widget.keepPadding!) ? 0.0 : 10.0,
horizontal: 16.0),
filled: true,
fillColor: widget.bare!
? Colors.transparent
: Theme.of(context).backgroundColor,
suffixIcon: _buildSuffixIcon(),
prefixIcon: widget.prefixIcon,
errorStyle: TextStyle(
fontSize: 14.0,
fontWeight: widget.fontWeight,
height: widget.borderOnlyError! ? 0.0 : null),
errorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.errorColor
.withOpacity(widget.bare! ? 0.0 : 0.5),
width: 1.0),
borderRadius: BorderRadius.circular(widget.bare! ? 0.0 : 8.0)),
focusedErrorBorder: OutlineInputBorder(
borderSide: BorderSide(
color: Theme.of(context)
.errorColor
.withOpacity(widget.bare! ? 0.0 : 0.5),
width: 1.0),
borderRadius: BorderRadius.circular(widget.bare! ? 0.0 : 8.0)),
focusedBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(widget.bare! ? 0.0 : 8.0)),
disabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(widget.bare! ? 0.0 : 8.0)),
enabledBorder: OutlineInputBorder(
borderSide: BorderSide(color: Colors.grey, width: 1.0),
borderRadius: BorderRadius.circular(widget.bare! ? 0.0 : 8.0),
),
),
),
));
}
}

@ -76,7 +76,7 @@ class AppScaffold extends StatefulWidget {
final int? dropdownIndexValue;
List<String>? dropDownList;
final void Function(int?)? dropDownIndexChange;
final Function? onTap;
final VoidCallbackAction? onTap;
final bool isMainPharmacyPages;
final bool extendBody;
final ValueChanged<int>? changeCurrentTab;

Loading…
Cancel
Save