From 37cd34f5687857d659e0fa0d57ad5a2940b68a28 Mon Sep 17 00:00:00 2001 From: Elham Rababh Date: Thu, 9 Sep 2021 12:10:49 +0300 Subject: [PATCH] move no data widget to separate file --- lib/screens/patients/In_patient/NoData.dart | 20 +++++++++++++++++ .../In_patient/in_patient_list_page.dart | 22 +++++-------------- 2 files changed, 25 insertions(+), 17 deletions(-) create mode 100644 lib/screens/patients/In_patient/NoData.dart diff --git a/lib/screens/patients/In_patient/NoData.dart b/lib/screens/patients/In_patient/NoData.dart new file mode 100644 index 00000000..0c48cd2a --- /dev/null +++ b/lib/screens/patients/In_patient/NoData.dart @@ -0,0 +1,20 @@ +import 'package:doctor_app_flutter/util/translations_delegate_base.dart'; +import 'package:doctor_app_flutter/widgets/shared/errors/error_message.dart'; +import 'package:flutter/material.dart'; + +class NoData extends StatelessWidget { + const NoData({ + Key key, + }) : super(key: key); + + @override + Widget build(BuildContext context) { + return Expanded( + child: SingleChildScrollView( + child: Container( + child: ErrorMessage( + error: TranslationBase.of(context).noDataAvailable)), + ), + ); + } +} \ No newline at end of file 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 9106de0f..152d87db 100644 --- a/lib/screens/patients/In_patient/in_patient_list_page.dart +++ b/lib/screens/patients/In_patient/in_patient_list_page.dart @@ -14,6 +14,7 @@ import 'package:flutter/material.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import '../../../routes.dart'; +import 'NoData.dart'; class InPatientListPage extends StatefulWidget { final bool isMyInPatient; @@ -90,6 +91,7 @@ class _InPatientListPageState extends State { onTap: () { setState(() { isAllClinic = false; + if(widget.patientSearchViewModel.myInpatientClinicList.length > 0) showBottomSheet = true; }); }, @@ -102,7 +104,8 @@ class _InPatientListPageState extends State { setState(() { setState(() { isAllClinic = false; - showBottomSheet = true; + if(widget.patientSearchViewModel.myInpatientClinicList.length > 0) + showBottomSheet = true; }); }); }, @@ -320,7 +323,7 @@ class _InPatientListPageState extends State { height: 0, ) : Container( - height: 500, + height: MediaQuery.of(context).size.height * 0.5, color: Colors.white, child: ListView.builder( itemCount: widget @@ -369,19 +372,4 @@ class _InPatientListPageState extends State { } } -class NoData extends StatelessWidget { - const NoData({ - Key key, - }) : super(key: key); - @override - Widget build(BuildContext context) { - return Expanded( - child: SingleChildScrollView( - child: Container( - child: ErrorMessage( - error: TranslationBase.of(context).noDataAvailable)), - ), - ); - } -}