diff --git a/lib/config/localized_values.dart b/lib/config/localized_values.dart index 2fb608e0..ba148703 100644 --- a/lib/config/localized_values.dart +++ b/lib/config/localized_values.dart @@ -12,5 +12,25 @@ const Map> localizedValues = { 'mySchedule': {'en': 'My Schedule', 'ar': 'جدولي'}, 'logout': {'en': 'Logout', 'ar': 'تسجيل خروج'}, 'bookAppo': {'en': 'Book Appointment', 'ar': 'حجز موعد'}, + 'searchBy': {'en': 'Search By:', 'ar': 'البحث عن طريق:'}, + 'clinic': {'en': 'Clinic', 'ar': 'العيادة'}, + 'name': {'en': 'Name', 'ar': 'الإسم'}, + 'doctor': {'en': 'Doctor', 'ar': 'الطبيب'}, + 'clinicName': {'en': 'Clinic Name', 'ar': 'اسم العيادة'}, + 'doctorName': {'en': 'Doctor Name', 'ar': 'إسم الطبيب'}, + 'nearestAppo': {'en': 'Nearest appointment', 'ar': 'أقرب موعد'}, + 'searchByDocText': {'en': 'Type the name of the doctor to help you find him', 'ar': 'اكتب اسم الطبيب لمساعدتك في العثور عليه'}, + 'enterDocName': {'en': 'Enter Doctor name', 'ar': 'أدخل إسم الطبيب'}, + 'search': {'en': 'Search', 'ar': 'بحث'}, + 'bookNow': {'en': 'BOOK NOW', 'ar': 'احجز الآن'}, + 'docInfo': {'en': 'Doctor Information', 'ar': 'معلومات الطبيب'}, + 'appoInfo': {'en': 'Appointment Information', 'ar': 'معلومات الموعد'}, + 'availableAppo': {'en': 'Available Appointments', 'ar': 'المواعيد المتاحة'}, + 'gender': {'en': 'Gender', 'ar': 'الجنس'}, + 'nationality': {'en': 'nationality', 'ar': 'الجنسية'}, + 'docQualifications': {'en': 'Doctor Qualifications', 'ar': 'مؤهلات الطبيب'}, + 'confirmAppoHeading': {'en': 'Kindly confirm your Appointment', 'ar': 'يرجى تأكيد موعدك'}, + 'patientInfo': {'en': 'Patient Information', 'ar': 'معلومات المريض'}, + }; diff --git a/lib/pages/BookAppointment/BookConfirm.dart b/lib/pages/BookAppointment/BookConfirm.dart index 47fdfb2a..58f0a344 100644 --- a/lib/pages/BookAppointment/BookConfirm.dart +++ b/lib/pages/BookAppointment/BookConfirm.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -13,7 +14,7 @@ class _BookConfirmState extends State { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("Book Appointment"), + title: Text(TranslationBase.of(context).bookAppo), ), body: SingleChildScrollView( child: Container( @@ -25,7 +26,7 @@ class _BookConfirmState extends State { Container( margin: EdgeInsets.only(bottom: 5.0), alignment: Alignment.center, - child: Text("Kindly Confirm your Appointment", + child: Text(TranslationBase.of(context).confirmAppoHeading, textAlign: TextAlign.center, style: TextStyle( fontSize: 22.0, @@ -36,7 +37,7 @@ class _BookConfirmState extends State { ), Container( margin: EdgeInsets.only(top: 15.0), - child: Text("Doctor Information", + child: Text(TranslationBase.of(context).docInfo, style: TextStyle( fontSize: 22.0, color: Colors.black, @@ -116,7 +117,7 @@ class _BookConfirmState extends State { ), Container( margin: EdgeInsets.only(top: 15.0), - child: Text("Appointment Information", + child: Text(TranslationBase.of(context).appoInfo, style: TextStyle( fontSize: 22.0, color: Colors.black, @@ -216,7 +217,7 @@ class _BookConfirmState extends State { ), Container( margin: EdgeInsets.only(top: 15.0), - child: Text("Patient Information", + child: Text(TranslationBase.of(context).patientInfo, style: TextStyle( fontSize: 22.0, color: Colors.black, @@ -299,7 +300,7 @@ class _BookConfirmState extends State { onPressed: () { navigateToBookSuccess(context); }, - child: Text('BOOK NOW', style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).bookNow, style: TextStyle(fontSize: 18.0)), ), ), ), diff --git a/lib/pages/BookAppointment/BookingOptions.dart b/lib/pages/BookAppointment/BookingOptions.dart index d9164e51..c6cc759b 100644 --- a/lib/pages/BookAppointment/BookingOptions.dart +++ b/lib/pages/BookAppointment/BookingOptions.dart @@ -1,17 +1,19 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/widgets/CardCommon.dart'; import 'package:flutter/material.dart'; +import '../../uitl/translations_delegate_base.dart'; + class BookingOptions extends StatelessWidget { @override Widget build(BuildContext context) { return Scaffold( - appBar: AppBar(title: Text("Book Appointment")), + appBar: AppBar(title: Text(TranslationBase.of(context).bookAppo)), body: Container( margin: EdgeInsets.fromLTRB(10.0, 20.0, 10.0, 10.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - Text("Search By:", + Text(TranslationBase.of(context).searchBy, style: TextStyle( fontSize: 24.0, letterSpacing: 1.0, @@ -27,15 +29,15 @@ class BookingOptions extends StatelessWidget { child: CardCommon( image: 'assets/images/new-design/search_by_clinic.png', - text: "Clinic", - subText: "Name"), + text: TranslationBase.of(context).clinic, + subText: TranslationBase.of(context).name), ), Expanded( child: CardCommon( image: 'assets/images/new-design/search_by_doctor.png', - text: "Doctor", - subText: "Name"), + text: TranslationBase.of(context).doctor, + subText: TranslationBase.of(context).name), ) ], ), diff --git a/lib/pages/BookAppointment/DoctorProfile.dart b/lib/pages/BookAppointment/DoctorProfile.dart index 2527ecc7..41479828 100644 --- a/lib/pages/BookAppointment/DoctorProfile.dart +++ b/lib/pages/BookAppointment/DoctorProfile.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'package:rating_bar/rating_bar.dart'; @@ -25,7 +26,7 @@ class _DoctorProfileState extends State Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("Book Appointment"), + title: Text(TranslationBase.of(context).bookAppo), actions: [ IconButton( icon: Icon( @@ -58,7 +59,7 @@ class _DoctorProfileState extends State navigateToBookConfirm(context); }, child: - Text('BOOK NOW', style: TextStyle(fontSize: 18.0)), + Text(TranslationBase.of(context).bookNow, style: TextStyle(fontSize: 18.0)), ), ), ) @@ -136,7 +137,6 @@ class _DoctorProfileState extends State ), ), TabBar( - indicatorColor: new Color(0xFFc5272d), onTap: (index) { setState(() { index == 1 @@ -147,10 +147,10 @@ class _DoctorProfileState extends State }, tabs: [ Tab( - child: Text("Doctor Information", + child: Text(TranslationBase.of(context).docInfo, style: TextStyle(color: Colors.black))), Tab( - child: Text("Available Appointments", + child: Text(TranslationBase.of(context).availableAppo, style: TextStyle(color: Colors.black)), ) ], diff --git a/lib/pages/BookAppointment/Search.dart b/lib/pages/BookAppointment/Search.dart index 2ef22c5f..a5f840e1 100644 --- a/lib/pages/BookAppointment/Search.dart +++ b/lib/pages/BookAppointment/Search.dart @@ -1,5 +1,6 @@ import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByClinic.dart'; import 'package:diplomaticquarterapp/pages/BookAppointment/components/SearchByDoctor.dart'; +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; class Search extends StatefulWidget { @@ -22,14 +23,14 @@ class _SearchState extends State with SingleTickerProviderStateMixin { appBar: AppBar( bottom: TabBar( tabs: [ - Tab(text: "Clinic Name"), + Tab(text: TranslationBase.of(context).clinicName), Tab( - text: "Doctor Name", + text: TranslationBase.of(context).doctorName, ) ], controller: _tabController, ), - title: Text("Book Appointment"), + title: Text(TranslationBase.of(context).bookAppo), ), body: TabBarView(children: [ SearchByClinic(), diff --git a/lib/pages/BookAppointment/SearchResults.dart b/lib/pages/BookAppointment/SearchResults.dart index b99685ab..1fc356c5 100644 --- a/lib/pages/BookAppointment/SearchResults.dart +++ b/lib/pages/BookAppointment/SearchResults.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import 'widgets/DoctorView.dart'; @@ -7,7 +8,7 @@ class SearchResults extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( - title: Text("Book Appointment"), + title: Text(TranslationBase.of(context).bookAppo), ), body: Container( child: SingleChildScrollView( diff --git a/lib/pages/BookAppointment/components/DocInfo.dart b/lib/pages/BookAppointment/components/DocInfo.dart index c83320da..8416357b 100644 --- a/lib/pages/BookAppointment/components/DocInfo.dart +++ b/lib/pages/BookAppointment/components/DocInfo.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; class DoctorInformation extends StatelessWidget { @@ -24,7 +25,7 @@ class DoctorInformation extends StatelessWidget { "assets/images/new-design/doctor_information_icon.png"), Container( margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), - child: Text("Doctor Information", + child: Text(TranslationBase.of(context).docInfo, style: TextStyle(fontSize: 16.0, letterSpacing: 0.8)), ), @@ -36,8 +37,8 @@ class DoctorInformation extends StatelessWidget { child: Table( children: [ TableRow(children: [ - TableCell(child: _getHeadingText("Gender")), - TableCell(child: _getHeadingText("Nationality")), + TableCell(child: _getHeadingText(TranslationBase.of(context).gender)), + TableCell(child: _getHeadingText(TranslationBase.of(context).nationality)), ]), TableRow(children: [ TableCell(child: _getNormalText("Male")), @@ -54,7 +55,7 @@ class DoctorInformation extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _getHeadingText("Clinic"), + _getHeadingText(TranslationBase.of(context).clinic), _getNormalText("INTERNAL MEDICINE CLINIC") ], ), @@ -79,7 +80,7 @@ class DoctorInformation extends StatelessWidget { "assets/images/new-design/doctor_qualification_icon.png"), Container( margin: EdgeInsets.fromLTRB(15.0, 5.0, 15.0, 0.0), - child: Text("Doctor Qualifications", + child: Text(TranslationBase.of(context).docQualifications, style: TextStyle(fontSize: 16.0, letterSpacing: 0.8)), ), @@ -91,7 +92,7 @@ class DoctorInformation extends StatelessWidget { child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ - _getHeadingText("Clinic"), + _getHeadingText(TranslationBase.of(context).clinic), _getNormalText("INTERNAL MEDICINE CLINIC") ], ), diff --git a/lib/pages/BookAppointment/components/SearchByClinic.dart b/lib/pages/BookAppointment/components/SearchByClinic.dart index 7bf8961f..c1fb14c4 100644 --- a/lib/pages/BookAppointment/components/SearchByClinic.dart +++ b/lib/pages/BookAppointment/components/SearchByClinic.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; class SearchByClinic extends StatefulWidget { @@ -27,7 +28,7 @@ class _SearchByClinicState extends State { }); }, ), - Text('Nearest Appointment', + Text(TranslationBase.of(context).nearestAppo, style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), ], ), diff --git a/lib/pages/BookAppointment/components/SearchByDoctor.dart b/lib/pages/BookAppointment/components/SearchByDoctor.dart index 1322654e..a0a0540c 100644 --- a/lib/pages/BookAppointment/components/SearchByDoctor.dart +++ b/lib/pages/BookAppointment/components/SearchByDoctor.dart @@ -1,3 +1,4 @@ +import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:flutter/material.dart'; import '../SearchResults.dart'; @@ -26,7 +27,7 @@ class _SearchByDoctorState extends State { children: [ Container( margin: EdgeInsets.only(top: 10.0, bottom: 15.0), - child: Text("Type the name of the doctor to help you find him", + child: Text(TranslationBase.of(context).searchByDocText, style: TextStyle(fontSize: 16.0, letterSpacing: 0.9)), ), Container( @@ -37,7 +38,7 @@ class _SearchByDoctorState extends State { _onDocTextChanged(content); }, decoration: InputDecoration( - labelText: "Type Doctor Name", + labelText: TranslationBase.of(context).enterDocName, fillColor: Colors.white, prefixIcon: Icon(Icons.search), border: OutlineInputBorder())), @@ -66,7 +67,8 @@ class _SearchByDoctorState extends State { disabledTextColor: Colors.white, disabledColor: new Color(0xFFbcc2c4), onPressed: _isButtonDisabled ? null : _searchDoctor, - child: Text('Search', style: TextStyle(fontSize: 18.0)), + child: Text(TranslationBase.of(context).search, + style: TextStyle(fontSize: 18.0)), ), ); } @@ -86,27 +88,11 @@ class _SearchByDoctorState extends State { } void _searchDoctor() { -// if (doctorNameController.text != "") -// print(doctorNameController.text); navigateToSearchResults(context); -// else -// print("Empty"); } Future navigateToSearchResults(context) async { Navigator.push( context, MaterialPageRoute(builder: (context) => SearchResults())); } - - _isDoctorNameValid() { - if (doctorNameController.text != null || doctorNameController.text != "") { - if (doctorNameController.text.length >= 4) { - return true; - } else { - return false; - } - } else { - return false; - } - } } diff --git a/lib/uitl/date_uitl.dart b/lib/uitl/date_uitl.dart index db735892..c70e05b7 100644 --- a/lib/uitl/date_uitl.dart +++ b/lib/uitl/date_uitl.dart @@ -99,7 +99,7 @@ class DateUtil { return getMonth(dateTime.month) + " " + dateTime.day.toString() + - "," + + ", " + dateTime.year.toString(); else return ""; diff --git a/lib/uitl/translations_delegate_base.dart b/lib/uitl/translations_delegate_base.dart index 96b3565e..92ec2fd5 100644 --- a/lib/uitl/translations_delegate_base.dart +++ b/lib/uitl/translations_delegate_base.dart @@ -40,7 +40,43 @@ class TranslationBase { String get bookAppo => localizedValues['bookAppo'][locale.languageCode]; + String get searchBy => localizedValues['searchBy'][locale.languageCode]; + String get clinic => localizedValues['clinic'][locale.languageCode]; + + String get name => localizedValues['name'][locale.languageCode]; + + String get doctor => localizedValues['doctor'][locale.languageCode]; + + String get clinicName => localizedValues['clinicName'][locale.languageCode]; + + String get doctorName => localizedValues['doctorName'][locale.languageCode]; + + String get nearestAppo => localizedValues['nearestAppo'][locale.languageCode]; + + String get searchByDocText => localizedValues['searchByDocText'][locale.languageCode]; + + String get enterDocName => localizedValues['enterDocName'][locale.languageCode]; + + String get search => localizedValues['search'][locale.languageCode]; + + String get bookNow => localizedValues['bookNow'][locale.languageCode]; + + String get docInfo => localizedValues['docInfo'][locale.languageCode]; + + String get appoInfo => localizedValues['appoInfo'][locale.languageCode]; + + String get availableAppo => localizedValues['availableAppo'][locale.languageCode]; + + String get gender => localizedValues['gender'][locale.languageCode]; + + String get nationality => localizedValues['nationality'][locale.languageCode]; + + String get docQualifications => localizedValues['docQualifications'][locale.languageCode]; + + String get confirmAppoHeading => localizedValues['confirmAppoHeading'][locale.languageCode]; + + String get patientInfo => localizedValues['patientInfo'][locale.languageCode]; } class TranslationBaseDelegate extends LocalizationsDelegate {