From 307a11c36ff62ac0b252a72afdb8cd14b384aab2 Mon Sep 17 00:00:00 2001 From: Aamir Date: Mon, 11 Dec 2023 16:00:23 +0300 Subject: [PATCH] Null Safety --- .../In_patient/in_patient_list_page.dart | 22 +++++----- .../In_patient/in_patient_screen.dart | 41 +++++++++++++++---- lib/widgets/shared/app_texts_widget.dart | 13 +++--- 3 files changed, 51 insertions(+), 25 deletions(-) diff --git a/lib/screens/patients/In_patient/in_patient_list_page.dart b/lib/screens/patients/In_patient/in_patient_list_page.dart index d3ebf42f..bd336871 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -7,7 +7,6 @@ import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/loader/gif_loader_dialog_utils.dart'; import 'package:doctor_app_flutter/widgets/shared/text_fields/app_text_field_custom_serach.dart'; -import 'package:doctor_app_flutter/widgets/shared/text_fields/app-textfield-custom.dart'; import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; @@ -22,9 +21,9 @@ class InPatientListPage extends StatefulWidget { final bool isAllClinic; final bool showBottomSheet; final String? selectedClinicName; - final Function onChangeValue; + final Function? onChangeValue; - InPatientListPage({this.isMyInPatient = false, this.patientSearchViewModel, this.selectedClinicName, required this.onChangeValue, this.isAllClinic = false, this.showBottomSheet = false}); + InPatientListPage({this.isMyInPatient = false, this.patientSearchViewModel, this.selectedClinicName, this.onChangeValue, this.isAllClinic = false, this.showBottomSheet = false}); @override _InPatientListPageState createState() => _InPatientListPageState(); @@ -65,7 +64,7 @@ class _InPatientListPageState extends State { groupValue: widget.isAllClinic ? 1 : 2, onChanged: (value) { setState(() { - widget.onChangeValue(isAllClinic: true, showBottomSheet: false, selectedClinicName: null); + widget.onChangeValue!(isAllClinic: true, showBottomSheet: false, selectedClinicName: null); widget.patientSearchViewModel!.setDefaultInPatientList(); }); @@ -79,7 +78,7 @@ class _InPatientListPageState extends State { ], ), onTap: () { - widget.onChangeValue(isAllClinic: true, showBottomSheet: false, selectedClinicName: null); + widget.onChangeValue!(isAllClinic: true, showBottomSheet: false, selectedClinicName: null); widget.patientSearchViewModel!.setDefaultInPatientList(); }, @@ -88,7 +87,7 @@ class _InPatientListPageState extends State { InkWell( onTap: () { if (widget.patientSearchViewModel!.InpatientClinicList.length > 0) { - widget.onChangeValue(isAllClinic: false, showBottomSheet: true, selectedClinicName: widget.selectedClinicName); + widget.onChangeValue!(isAllClinic: false, showBottomSheet: true, selectedClinicName: widget.selectedClinicName); } }, child: Row( @@ -98,7 +97,7 @@ class _InPatientListPageState extends State { groupValue: widget.isAllClinic ? 1 : 2, onChanged: (value) { if (widget.patientSearchViewModel!.InpatientClinicList.length > 0) { - widget.onChangeValue(isAllClinic: false, showBottomSheet: true, selectedClinicName: widget.selectedClinicName); + widget.onChangeValue!(isAllClinic: false, showBottomSheet: true, selectedClinicName: widget.selectedClinicName); } }, activeColor: Colors.red, @@ -135,7 +134,8 @@ class _InPatientListPageState extends State { isSortDes = !isSortDes; GifLoaderDialogUtils.hideDialog(context); }, - ), onFieldSubmitted: (){}, + ), + onFieldSubmitted: () {}, ), widget.patientSearchViewModel!.state == ViewState.Idle ? (widget.isMyInPatient && widget.patientSearchViewModel!.myIinPatientList.length > 0) @@ -171,7 +171,7 @@ class _InPatientListPageState extends State { children: [ InkWell( onTap: () { - widget.onChangeValue(isAllClinic: widget.isAllClinic, showBottomSheet: false, selectedClinicName: widget.selectedClinicName); + widget.onChangeValue!(isAllClinic: widget.isAllClinic, showBottomSheet: false, selectedClinicName: widget.selectedClinicName); }, child: Icon(DoctorApp.close_1, size: SizeConfig.getTextMultiplierBasedOnWidth() * 4.5, color: Color(0xFF2B353E))) ], @@ -198,7 +198,7 @@ class _InPatientListPageState extends State { itemBuilder: (context, index) { return InkWell( onTap: () { - widget.onChangeValue(isAllClinic: false, showBottomSheet: false, selectedClinicName: widget.patientSearchViewModel!.InpatientClinicList[index]); + widget.onChangeValue!(isAllClinic: false, showBottomSheet: false, selectedClinicName: widget.patientSearchViewModel!.InpatientClinicList[index]); widget.patientSearchViewModel!.filterByClinic(clinicName: widget.patientSearchViewModel!.InpatientClinicList[index]); }, @@ -209,7 +209,7 @@ class _InPatientListPageState extends State { groupValue: widget.selectedClinicName, onChanged: (value) { setState(() { - widget.onChangeValue(isAllClinic: false, showBottomSheet: false, selectedClinicName: widget.patientSearchViewModel!.InpatientClinicList[index]); + widget.onChangeValue!(isAllClinic: false, showBottomSheet: false, selectedClinicName: widget.patientSearchViewModel!.InpatientClinicList[index]); widget.patientSearchViewModel!.filterByClinic(clinicName: value!); }); }, diff --git a/lib/screens/patients/In_patient/in_patient_screen.dart b/lib/screens/patients/In_patient/in_patient_screen.dart index 46941840..d8da44e1 100644 --- a/lib/screens/patients/In_patient/in_patient_screen.dart +++ b/lib/screens/patients/In_patient/in_patient_screen.dart @@ -191,16 +191,41 @@ class _InPatientScreenState extends State with SingleTickerProv }); } - Widget tabWidget(Size screenSize, bool isActive, String title, {int counter = -1, bool isFirst = false, bool isMiddle = false, bool isLast = false, BuildContext? context}) { + Widget tabWidget( + Size screenSize, + bool isActive, + String title, { + int counter = -1, + bool isFirst = false, + bool isMiddle = false, + bool isLast = false, + BuildContext? context, + }) { ProjectViewModel projectsProvider = Provider.of(context!); - return Center( - child: Container( - height: TabUtils.getTabHeight(context!), - decoration: TabUtils.getBoxTabsBoxDecoration(isActive: isActive, isFirst: isFirst, isMiddle: isMiddle, isLast: isLast, projectViewModel: projectsProvider), - child: Row( - mainAxisAlignment: MainAxisAlignment.center, - children: [TabUtils.getTabText(title: title, isActive: isActive), if (counter != -1) TabUtils.getTabCounter(isActive: isActive, counter: counter)], + return Container( + color: Colors.yellow, + child: Center( + child: Container( + height: TabUtils.getTabHeight(context), + decoration: TabUtils.getBoxTabsBoxDecoration( + isActive: isActive, + isFirst: isFirst, + isMiddle: isMiddle, + isLast: isLast, + projectViewModel: projectsProvider, + ), + child: Row( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + TabUtils.getTabText(title: title, isActive: isActive), + if (counter != -1) + TabUtils.getTabCounter( + isActive: isActive, + counter: counter, + ), + ], + ), ), ), ); diff --git a/lib/widgets/shared/app_texts_widget.dart b/lib/widgets/shared/app_texts_widget.dart index 958852ec..07c0c7e9 100644 --- a/lib/widgets/shared/app_texts_widget.dart +++ b/lib/widgets/shared/app_texts_widget.dart @@ -163,14 +163,15 @@ class _AppTextState extends State { style: widget.style != null ? _getFontStyle()!.copyWith( fontStyle: widget.italic ? FontStyle.italic : FontStyle.normal, - fontSize: widget.fontSize ?? _getFontSize(), + // fontSize: widget.fontSize ?? _getFontSize(), + fontSize: widget.fontSize != 0.0 ? widget.fontSize : _getFontSize(), color: widget.color, fontWeight: widget.fontWeight ?? _getFontWeight(), height: widget.fontHeight) : TextStyle( fontStyle: widget.italic ? FontStyle.italic : null, - color: widget.color != null ? widget.color : Color(0xff2E303A), - fontSize: widget.fontSize ?? _getFontSize(), + color: widget.color != null ? widget.color : Color(0xff7588e7), + fontSize: widget.fontSize != 0.0 ? widget.fontSize : _getFontSize(), letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null), fontWeight: widget.fontWeight ?? _getFontWeight(), fontFamily: widget.fontFamily ?? 'Poppins', @@ -189,14 +190,14 @@ class _AppTextState extends State { ? _getFontStyle()!.copyWith( fontStyle: widget.italic ? FontStyle.italic : FontStyle.normal, color: widget.color, - fontSize: widget.fontSize ?? _getFontSize(), + fontSize: widget.fontSize != 0.0 ? widget.fontSize : _getFontSize(), fontWeight: widget.fontWeight ?? _getFontWeight(), height: widget.fontHeight, ) : TextStyle( fontStyle: widget.italic ? FontStyle.italic : FontStyle.normal, color: widget.color != null ? widget.color : Colors.black, - fontSize: widget.fontSize ?? _getFontSize(), + fontSize: widget.fontSize != 0.0 ? widget.fontSize : _getFontSize(), letterSpacing: widget.letterSpacing ?? (widget.variant == "overline" ? 1.5 : null), fontWeight: widget.fontWeight ?? _getFontWeight(), fontFamily: widget.fontFamily ?? 'Poppins', @@ -231,7 +232,7 @@ class _AppTextState extends State { case "button": return Theme.of(context).textTheme.button; default: - return TextStyle(); + return TextStyle(fontSize: 5); } }