@ -1,17 +1,17 @@
import ' package:diplomaticquarterapp/core/viewModels/project_view_model.dart ' ;
import ' package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/body_fat/body_fat.dart ' ;
import ' package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/bmi_calculator/bmi_calculator.dart ' ;
import ' package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/calorie_calculator/calorie_calculator.dart ' ;
import ' package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/carbs/carbs.dart ' ;
import ' package:diplomaticquarterapp/pages/AlHabibMedicalService/health_calculator/ovulation_period/ovulation_period.dart ' ;
import ' package:diplomaticquarterapp/uitl/translations_delegate_base.dart ' ;
import ' package:diplomaticquarterapp/widgets/data_display/medical/medical_profile_item.dart ' ;
import ' package:diplomaticquarterapp/widgets/ data_display/tex t.dart' ;
import ' package:diplomaticquarterapp/widgets/ others/app_scaffold_widge t.dart' ;
import ' package:diplomaticquarterapp/widgets/transitions/fade_page.dart ' ;
import ' package:flutter/material.dart ' ;
import ' package:diplomaticquarterapp/widgets/others/app_scaffold_widget.dart ' ;
import ' package:provider/provider.dart ' ;
import ' health_calculator/bmi_calculator/bmi_calculator.dart ' ;
import ' health_calculator/bmr_calculator/bmr_calculator.dart ' ;
import ' health_calculator/calorie_calculator/calorie_calculator.dart ' ;
import ' health_calculator/delivery_due/delivery_due.dart ' ;
import ' health_calculator/ideal_body/ideal_body.dart ' ;
@ -22,6 +22,7 @@ class HealthCalculators extends StatefulWidget {
class _HealthCalculatorsState extends State < HealthCalculators > with SingleTickerProviderStateMixin {
TabController _tabController ;
void initState ( ) {
super . initState ( ) ;
_tabController = TabController ( length: 2 , vsync: this ) ;
@ -34,249 +35,427 @@ class _HealthCalculatorsState extends State<HealthCalculators> with SingleTicker
@ override
Widget build ( BuildContext context ) {
ProjectViewModel projectViewModel = Provider . of ( context ) ;
List < Widget > generalHealthList = getGeneralHealthList ( context ) ;
List < Widget > womenHealthList = getWomenHealthList ( context ) ;
return AppScaffold (
isShowAppBar: true ,
isShowDecPage: false ,
showNewAppBar: true ,
showNewAppBarTitle: true ,
appBarTitle: TranslationBase . of ( context ) . calculators ,
body: Scaffold (
extendBodyBehindAppBar: true ,
appBar: PreferredSize (
preferredSize: Size . fromHeight ( 70.0 ) ,
child: Stack (
children: [
Center (
child: Container (
height: 60.0 ,
margin: EdgeInsets . only ( top: 10.0 ) ,
width: MediaQuery . of ( context ) . size . width * 1.9 ,
decoration: BoxDecoration (
border: Border (
bottom: BorderSide (
color: Theme . of ( context ) . dividerColor ,
width: 5.7 ,
) ,
) ,
color: Colors . white ,
) ,
child: Center (
child: TabBar (
controller: _tabController ,
isScrollable: true ,
indicatorWeight: 4.0 ,
indicatorColor: Colors . red ,
labelColor: Theme . of ( context ) . buttonColor ,
labelPadding: EdgeInsets . symmetric ( horizontal: 13.0 , vertical: 2.0 ) ,
unselectedLabelColor: Colors . grey ,
tabs: < Widget > [
Container (
width: MediaQuery . of ( context ) . size . width * 0.35 ,
child: Center (
child: Texts ( TranslationBase . of ( context ) . generalHealth ) ,
) ,
) ,
Container (
width: MediaQuery . of ( context ) . size . width * 0.35 ,
child: Center (
child: Texts ( TranslationBase . of ( context ) . womanHealth ) ,
) ,
) ,
] ,
) ,
) ,
body: Column (
children: [
TabBar (
controller: _tabController ,
isScrollable: true ,
indicatorWeight: 4.0 ,
indicatorColor: Colors . red ,
labelColor: Theme . of ( context ) . buttonColor ,
labelPadding: EdgeInsets . only ( top: 15 , bottom: 13 , left: 20 , right: 20 ) ,
unselectedLabelColor: Colors . grey ,
labelStyle: TextStyle (
fontFamily: projectViewModel . isArabic ? ' Cairo ' : ' Poppins ' ,
fontSize: 16 ,
fontWeight: FontWeight . w600 ,
letterSpacing: - 0.48 ,
) ,
tabs: < Widget > [
Container (
width: MediaQuery . of ( context ) . size . width * 0.35 ,
child: Center (
child: Text ( TranslationBase . of ( context ) . generalHealth ) ,
) ,
)
) ,
Container (
width: MediaQuery . of ( context ) . size . width * 0.35 ,
child: Center (
child: Text ( TranslationBase . of ( context ) . womanHealth ) ,
) ,
) ,
] ,
) ,
) ,
body: Column (
children: [
Expanded (
child: TabBarView (
physics: BouncingScrollPhysics ( ) ,
controller: _tabController ,
children: [
Container (
child: Column (
children: [
Container (
width: double . infinity ,
height: 80 ,
Expanded (
child: TabBarView (
physics: NeverScrollableScrollPhysics ( ) ,
controller: _tabController ,
children: [
Container (
margin: EdgeInsets . all ( 20.0 ) ,
child: Column (
children: [
Padding (
padding: EdgeInsets . only ( left: 12 , right: 12 ) ,
child: GridView . builder (
shrinkWrap: true ,
primary: false ,
physics: NeverScrollableScrollPhysics ( ) ,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount ( crossAxisCount: 3 , childAspectRatio: 2 / 2 , crossAxisSpacing: 12 , mainAxisSpacing: 12 ) ,
padding: EdgeInsets . zero ,
itemCount: generalHealthList . length ,
itemBuilder: ( BuildContext context , int index ) {
return generalHealthList [ index ] ;
} ,
) ,
Row (
children: [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . push (
context ,
FadePage ( page: BMICalculator ( ) ) ,
) ;
} ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . bmi ,
imagePath: ' bmi_health_calculator.png ' ,
subTitle: TranslationBase . of ( context ) . calcHealth ,
) ,
) ,
) ,
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . push (
context ,
FadePage (
page: CalorieCalculator ( ) ,
) ,
) ;
} ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . calories ,
imagePath: ' calories-calculator.png ' ,
subTitle: TranslationBase . of ( context ) . calcHealth ,
) ,
) ,
) ,
] ,
) ,
Row (
children: [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . push (
context ,
FadePage (
page: BmrCalculator ( ) ,
) ,
) ;
} ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . bmr ,
imagePath: ' BMR_calculator.png ' ,
subTitle: TranslationBase . of ( context ) . calcHealth ,
) ,
) ,
) ,
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . push (
context ,
FadePage (
page: IdealBody ( ) ,
) ,
) ;
} ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . idealBody ,
imagePath: ' body_weight.png ' ,
subTitle: TranslationBase . of ( context ) . weight ,
) ,
) ,
) ,
] ,
) ,
Row (
children: [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . push (
context ,
FadePage (
page: BodyFat ( ) ,
) ,
) ;
} ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . bodyWord ,
imagePath: ' body_fat.png ' ,
subTitle: TranslationBase . of ( context ) . fat ,
) ,
) ,
) ,
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . push (
context ,
FadePage (
page: Carbs ( ) ,
) ,
) ;
} ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . carbohydrate ,
imagePath: ' carb_protein.png ' ,
subTitle: TranslationBase . of ( context ) . proteinFat ,
) ,
) ,
) ,
] ,
) ,
] ,
) ,
) ,
] ,
) ,
Container (
child: Column (
children: [
Container (
width: double . infinity ,
height: 80 ,
) ,
Row (
children: [
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . push (
context ,
FadePage ( page: OvulationPeriod ( ) ) ,
) ;
} ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . ovulation ,
imagePath: ' ovulation_period_icon.png ' ,
subTitle: TranslationBase . of ( context ) . period ,
) ,
) ,
) ,
Expanded (
flex: 1 ,
child: InkWell (
onTap: ( ) {
Navigator . push (
context ,
FadePage (
page: DeliveryDue ( ) ,
) ,
) ;
} ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . delivery ,
imagePath: ' delivery_date_icon.png ' ,
subTitle: TranslationBase . of ( context ) . dueDate ,
) ,
) ,
) ,
] ,
) ,
Container (
margin: EdgeInsets . all ( 20.0 ) ,
child: Column (
children: [
Padding (
padding: EdgeInsets . only ( left: 12 , right: 12 ) ,
child: GridView . builder (
shrinkWrap: true ,
primary: false ,
physics: NeverScrollableScrollPhysics ( ) ,
gridDelegate: SliverGridDelegateWithFixedCrossAxisCount ( crossAxisCount: 3 , childAspectRatio: 2 / 2 , crossAxisSpacing: 12 , mainAxisSpacing: 12 ) ,
padding: EdgeInsets . zero ,
itemCount: womenHealthList . length ,
itemBuilder: ( BuildContext context , int index ) {
return womenHealthList [ index ] ;
} ,
) ,
] ,
) ,
) ,
] ,
) ,
] ,
) ,
)
] ,
) ,
) ,
] ,
) ,
) ,
] ,
) ,
/ / Scaffold (
/ / extendBodyBehindAppBar: true ,
/ / appBar: PreferredSize (
/ / preferredSize: Size . fromHeight ( 70.0 ) ,
/ / child: Column (
/ / children: [
/ / Center (
/ / child: Container (
/ / height: 60.0 ,
/ / margin: EdgeInsets . only ( top: 10.0 ) ,
/ / width: MediaQuery . of ( context ) . size . width * 1.9 ,
/ / decoration: BoxDecoration (
/ / border: Border (
/ / bottom: BorderSide (
/ / color: Theme . of ( context ) . dividerColor ,
/ / width: 5.7 ,
/ / ) ,
/ / ) ,
/ / color: Colors . white ,
/ / ) ,
/ / child: Center (
/ / child: TabBar (
/ / controller: _tabController ,
/ / isScrollable: true ,
/ / indicatorWeight: 4.0 ,
/ / indicatorColor: Colors . red ,
/ / labelColor: Theme . of ( context ) . buttonColor ,
/ / labelPadding: EdgeInsets . symmetric ( horizontal: 13.0 , vertical: 2.0 ) ,
/ / unselectedLabelColor: Colors . grey ,
/ / tabs: < Widget > [
/ / Container (
/ / width: MediaQuery . of ( context ) . size . width * 0.35 ,
/ / child: Center (
/ / child: Texts ( TranslationBase . of ( context ) . generalHealth ) ,
/ / ) ,
/ / ) ,
/ / Container (
/ / width: MediaQuery . of ( context ) . size . width * 0.35 ,
/ / child: Center (
/ / child: Texts ( TranslationBase . of ( context ) . womanHealth ) ,
/ / ) ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / )
/ / ] ,
/ / ) ,
/ / ) ,
/ / body: Column (
/ / children: [
/ / Expanded (
/ / child: TabBarView (
/ / physics: BouncingScrollPhysics ( ) ,
/ / controller: _tabController ,
/ / children: [
/ / Container (
/ / child: Column (
/ / children: [
/ / Container (
/ / width: double . infinity ,
/ / height: 80 ,
/ / ) ,
/ / Row (
/ / children: [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) {
/ / Navigator . push (
/ / context ,
/ / FadePage ( page: BMICalculator ( ) ) ,
/ / ) ;
/ / } ,
/ / child: MedicalProfileItem (
/ / title: TranslationBase . of ( context ) . bmi ,
/ / imagePath: ' bmi_health_calculator.png ' ,
/ / subTitle: TranslationBase . of ( context ) . calcHealth ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) {
/ / Navigator . push (
/ / context ,
/ / FadePage (
/ / page: CalorieCalculator ( ) ,
/ / ) ,
/ / ) ;
/ / } ,
/ / child: MedicalProfileItem (
/ / title: TranslationBase . of ( context ) . calories ,
/ / imagePath: ' calories-calculator.png ' ,
/ / subTitle: TranslationBase . of ( context ) . calcHealth ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / Row (
/ / children: [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) {
/ / Navigator . push (
/ / context ,
/ / FadePage (
/ / page: BmrCalculator ( ) ,
/ / ) ,
/ / ) ;
/ / } ,
/ / child: MedicalProfileItem (
/ / title: TranslationBase . of ( context ) . bmr ,
/ / imagePath: ' BMR_calculator.png ' ,
/ / subTitle: TranslationBase . of ( context ) . calcHealth ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) {
/ / Navigator . push (
/ / context ,
/ / FadePage (
/ / page: IdealBody ( ) ,
/ / ) ,
/ / ) ;
/ / } ,
/ / child: MedicalProfileItem (
/ / title: TranslationBase . of ( context ) . idealBody ,
/ / imagePath: ' body_weight.png ' ,
/ / subTitle: TranslationBase . of ( context ) . weight ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / Row (
/ / children: [
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) {
/ / Navigator . push (
/ / context ,
/ / FadePage (
/ / page: BodyFat ( ) ,
/ / ) ,
/ / ) ;
/ / } ,
/ / child: MedicalProfileItem (
/ / title: TranslationBase . of ( context ) . bodyWord ,
/ / imagePath: ' body_fat.png ' ,
/ / subTitle: TranslationBase . of ( context ) . fat ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / Expanded (
/ / flex: 1 ,
/ / child: InkWell (
/ / onTap: ( ) {
/ / Navigator . push (
/ / context ,
/ / FadePage (
/ / page: Carbs ( ) ,
/ / ) ,
/ / ) ;
/ / } ,
/ / child: MedicalProfileItem (
/ / title: TranslationBase . of ( context ) . carbohydrate ,
/ / imagePath: ' carb_protein.png ' ,
/ / subTitle: TranslationBase . of ( context ) . proteinFat ,
/ / ) ,
/ / ) ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ,
/ / Container (
/ / child: Column (
/ / children: [
/ / Padding (
/ / padding: EdgeInsets . only ( left: 12 , right: 12 ) ,
/ / child: GridView . builder (
/ / shrinkWrap: true ,
/ / primary: false ,
/ / physics: NeverScrollableScrollPhysics ( ) ,
/ / gridDelegate: SliverGridDelegateWithFixedCrossAxisCount ( crossAxisCount: 3 , childAspectRatio: 2 / 2 , crossAxisSpacing: 12 , mainAxisSpacing: 12 ) ,
/ / padding: EdgeInsets . zero ,
/ / itemCount: womenHealthList . length ,
/ / itemBuilder: ( BuildContext context , int index ) {
/ / return womenHealthList [ index ] ;
/ / } ,
/ / ) ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / ) ,
/ / ] ,
/ / ) ,
/ / )
/ / ] ,
/ / ) ,
) ;
}
List < Widget > getGeneralHealthList ( BuildContext context ) {
List < Widget > medical = List ( ) ;
medical . add ( InkWell (
onTap: ( ) = > Navigator . push (
context ,
FadePage ( page: BMICalculator ( ) ) ,
) ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . bmi ,
imagePath: ' assets/images/new-design/bmi_health_calculator.png ' ,
subTitle: TranslationBase . of ( context ) . calcHealth ,
isPngImage: true ,
) ,
) ) ;
medical . add ( InkWell (
onTap: ( ) = > Navigator . push (
context ,
FadePage ( page: CalorieCalculator ( ) ) ,
) ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . calories ,
imagePath: ' assets/images/new-design/ovulation_period_icon.png ' ,
subTitle: TranslationBase . of ( context ) . calcHealth ,
isPngImage: true ,
) ,
) ) ;
medical . add ( InkWell (
onTap: ( ) = > Navigator . push (
context ,
FadePage ( page: BmrCalculator ( ) ) ,
) ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . bmr ,
imagePath: ' assets/images/new-design/ovulation_period_icon.png ' ,
subTitle: TranslationBase . of ( context ) . calcHealth ,
isPngImage: true ,
) ,
) ) ;
medical . add ( InkWell (
onTap: ( ) = > Navigator . push (
context ,
FadePage ( page: IdealBody ( ) ) ,
) ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . idealBody ,
imagePath: ' assets/images/new-design/ovulation_period_icon.png ' ,
subTitle: TranslationBase . of ( context ) . weight ,
isPngImage: true ,
) ,
) ) ;
medical . add ( InkWell (
onTap: ( ) = > Navigator . push (
context ,
FadePage ( page: BodyFat ( ) ) ,
) ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . bodyWord ,
imagePath: ' assets/images/new-design/ovulation_period_icon.png ' ,
subTitle: TranslationBase . of ( context ) . fat ,
isPngImage: true ,
) ,
) ) ;
medical . add ( InkWell (
onTap: ( ) = > Navigator . push (
context ,
FadePage ( page: Carbs ( ) ) ,
) ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . carbohydrate ,
imagePath: ' assets/images/new-design/ovulation_period_icon.png ' ,
subTitle: TranslationBase . of ( context ) . proteinFat ,
isPngImage: true ,
) ,
) ) ;
return medical ;
}
List < Widget > getWomenHealthList ( BuildContext context ) {
List < Widget > medical = List ( ) ;
medical . add ( InkWell (
onTap: ( ) = > Navigator . push (
context ,
FadePage ( page: OvulationPeriod ( ) ) ,
) ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . ovulation ,
imagePath: ' assets/images/new-design/ovulation_period_icon.png ' ,
subTitle: TranslationBase . of ( context ) . period ,
isPngImage: true ,
) ,
) ) ;
medical . add ( InkWell (
onTap: ( ) = > Navigator . push (
context ,
FadePage ( page: DeliveryDue ( ) ) ,
) ,
child: MedicalProfileItem (
title: TranslationBase . of ( context ) . delivery ,
imagePath: ' assets/images/new-design/delivery_date_icon.png ' ,
subTitle: TranslationBase . of ( context ) . dueDate ,
isPngImage: true ,
) ,
) ) ;
return medical ;
}
}