You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			256 lines
		
	
	
		
			8.8 KiB
		
	
	
	
		
			Dart
		
	
			
		
		
	
	
			256 lines
		
	
	
		
			8.8 KiB
		
	
	
	
		
			Dart
		
	
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/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/others/app_scaffold_widget.dart';
 | 
						|
import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart';
 | 
						|
import 'package:flutter/material.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/delivery_due/delivery_due.dart';
 | 
						|
import 'health_calculator/ideal_body/ideal_body.dart';
 | 
						|
 | 
						|
class HealthCalculators extends StatefulWidget {
 | 
						|
  @override
 | 
						|
  _HealthCalculatorsState createState() => _HealthCalculatorsState();
 | 
						|
}
 | 
						|
 | 
						|
class _HealthCalculatorsState extends State<HealthCalculators> with SingleTickerProviderStateMixin {
 | 
						|
  TabController _tabController;
 | 
						|
 | 
						|
  void initState() {
 | 
						|
    super.initState();
 | 
						|
    _tabController = TabController(length: 2, vsync: this);
 | 
						|
  }
 | 
						|
 | 
						|
  void dispose() {
 | 
						|
    super.dispose();
 | 
						|
    _tabController.dispose();
 | 
						|
  }
 | 
						|
 | 
						|
  @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: Column(
 | 
						|
        children: [
 | 
						|
          TabBar(
 | 
						|
            controller: _tabController,
 | 
						|
            indicatorWeight: 3.0,
 | 
						|
            indicatorSize: TabBarIndicatorSize.tab,
 | 
						|
            labelColor: Color(0xff2B353E),
 | 
						|
            unselectedLabelColor: Color(0xff575757),
 | 
						|
            labelPadding: EdgeInsets.only(top: 15, bottom: 13, left: 20, right: 20),
 | 
						|
            labelStyle: TextStyle(
 | 
						|
              fontFamily: projectViewModel.isArabic ? 'Cairo' : 'Poppins',
 | 
						|
              fontSize: 16,
 | 
						|
              fontWeight: FontWeight.w600,
 | 
						|
              letterSpacing: -0.48,
 | 
						|
            ),
 | 
						|
            unselectedLabelStyle: 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),
 | 
						|
                ),
 | 
						|
              ),
 | 
						|
            ],
 | 
						|
          ),
 | 
						|
          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, top: 20.0),
 | 
						|
                        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];
 | 
						|
                          },
 | 
						|
                        ),
 | 
						|
                      ),
 | 
						|
                    ],
 | 
						|
                  ),
 | 
						|
                ),
 | 
						|
                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];
 | 
						|
                          },
 | 
						|
                        ),
 | 
						|
                      ),
 | 
						|
                    ],
 | 
						|
                  ),
 | 
						|
                ),
 | 
						|
              ],
 | 
						|
            ),
 | 
						|
          ),
 | 
						|
        ],
 | 
						|
      ),
 | 
						|
    );
 | 
						|
  }
 | 
						|
 | 
						|
  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/calories-calculator.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/BMR_calculator.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/body_weight.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/body_fat.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/carb_protein.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;
 | 
						|
  }
 | 
						|
}
 |