import 'package:diplomaticquarterapp/config/config.dart'; import 'package:diplomaticquarterapp/core/viewModels/dashboard_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/pharmacyModule/pharmacy_module_view_model.dart'; import 'package:diplomaticquarterapp/core/viewModels/project_view_model.dart'; import 'package:diplomaticquarterapp/locator.dart'; import 'package:diplomaticquarterapp/pages/Covid-DriveThru/covid-drivethru-location.dart'; import 'package:diplomaticquarterapp/pages/base/base_view.dart'; import 'package:diplomaticquarterapp/pages/conference/zoom/call_screen.dart'; import 'package:diplomaticquarterapp/theme/colors.dart'; import 'package:diplomaticquarterapp/uitl/app_shared_preferences.dart'; import 'package:diplomaticquarterapp/uitl/gif_loader_dialog_utils.dart'; import 'package:diplomaticquarterapp/uitl/translations_delegate_base.dart'; import 'package:diplomaticquarterapp/uitl/utils_new.dart'; import 'package:diplomaticquarterapp/vital_signs/vital_sign.dart'; import 'package:diplomaticquarterapp/widgets/buttons/defaultButton.dart'; import 'package:diplomaticquarterapp/widgets/transitions/fade_page.dart'; import 'package:firebase_crashlytics/firebase_crashlytics.dart'; import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_svg/flutter_svg.dart'; import 'package:provider/provider.dart'; import 'package:url_launcher/url_launcher.dart'; import 'package:url_launcher/url_launcher_string.dart'; import 'package:vital_sign_camera/vital_sign_camera.dart'; import 'fragments/home_page_fragment2.dart'; import 'landing_page_pharmcy.dart'; class HomePage2 extends StatefulWidget { final Function? goToMyProfile; VoidCallback? onLoginClick, onMedicalFileClick; HomePage2({Key? key, this.goToMyProfile, this.onLoginClick, this.onMedicalFileClick}); @override _HomePageState2 createState() => _HomePageState2(); } class _HomePageState2 extends State { PharmacyModuleViewModel pharmacyModuleViewModel = locator(); late ProjectViewModel projectViewModel; TextEditingController weightTextController = new TextEditingController(); TextEditingController heightTextController = new TextEditingController(); TextEditingController ageTextController = new TextEditingController(); String radioValue = ""; @override void initState() { super.initState(); } @override Widget build(BuildContext context) { projectViewModel = Provider.of(context); return BaseView( onModelReady: (model) => model.getPatientRadOrders(), builder: (_, model, wi) => Scaffold( resizeToAvoidBottomInset: true, // color: CustomColors.backgroudGreyColor, // color: Colors.yellow, // child: // SingleChildScrollView( // physics: BouncingScrollPhysics(), body: SingleChildScrollView( child: Material( color: CustomColors.backgroudGreyColor, child: Padding( padding: const EdgeInsets.all(16.0), child: Column( mainAxisAlignment: MainAxisAlignment.center, // crossAxisAlignment: CrossAxisAlignment.start, children: [ SvgPicture.asset( 'assets/images/new/cloud_logo.svg', width: 150, height: 150, ), mHeight(16.0), Text( "Contact-Less Vitals", style: TextStyle(color: Colors.black, fontSize: 22, letterSpacing: -0.68, fontWeight: FontWeight.bold), ), mHeight(16.0), Text( "Select Gender:", textAlign: TextAlign.start, style: TextStyle(color: Colors.black, fontSize: 14, letterSpacing: -0.68, fontWeight: FontWeight.bold), ), mHeight(8.0), Container( padding: EdgeInsets.only(left: 6, right: 6), child: Row( children: [ Flexible( child: Row( children: [ Radio( value: TranslationBase.of(context).male, groupValue: radioValue, onChanged: (v) { setState(() { radioValue = v!; }); }, ), Text( TranslationBase.of(context).male, style: TextStyle( fontSize: 12, letterSpacing: -0.48, fontWeight: FontWeight.w600, ), ), ], ), ), Flexible( child: Row( children: [ Radio( value: TranslationBase.of(context).female, groupValue: radioValue, onChanged: (v) { setState(() { radioValue = v!; }); }, ), Text( TranslationBase.of(context).female, style: TextStyle( fontSize: 12, letterSpacing: -0.48, fontWeight: FontWeight.w600, ), ), ], ), ), ], ), ), mHeight(16.0), inputWidget(TranslationBase.of(context).age, "0", ageTextController), mHeight(16.0), inputWidget(TranslationBase.of(context).weightAdd + " (kg)", "0", weightTextController), mHeight(16.0), inputWidget(TranslationBase.of(context).height + " (cm)", "0", heightTextController), mHeight(16.0), DefaultButton( TranslationBase.of(context).start, (ageTextController.text == "" || weightTextController.text == "" || heightTextController.text == "") ? null : () { final UserInfo userInfo = UserInfo( age: double.parse(ageTextController.text), gender: radioValue == TranslationBase.of(context).male ? Gender.male : Gender.female, weight: double.parse(weightTextController.text), // kg, Optional height: double.parse(heightTextController.text), // cm, Optional waistCircumference: 0, // cm Optional userId: 'dbd13e86-47f4-4a43-85f6-cf62fa750117'); Navigator.push(context, FadePage(page: VitalSigns(userInfo: userInfo))); }, color: CustomColors.green, disabledColor: CustomColors.grey, ), // HomePageFragment2( // model, // onLoginClick: () { // widget.onLoginClick!(); // // FirebaseCrashlytics.instance.crash(); // // Navigator.pushNamed( // // context, // // "zoom_call_page", // // arguments: CallArguments("h9qkpf02", "123", "Patient", "40", "1", false), // // ); // }, // onPharmacyClick: () { // // getPharmacyToken(model); // Uri uri = Uri.parse(PHARMACY_REDIRECT_URL); // launchUrl(uri, mode: LaunchMode.externalApplication); // }, // onMedicalFileClick: () { // widget.onMedicalFileClick!(); // }, // ) ], ), ), ), ), // ), ), ); } getPharmacyToken(DashboardViewModel model) async { if (!model.isLogin) { Navigator.push(context, FadePage(page: LandingPagePharmacy())); } else { GifLoaderDialogUtils.showMyDialog(context); await pharmacyModuleViewModel.generatePharmacyToken().then((value) async { if (!pharmacyModuleViewModel.error.isNotEmpty) { await pharmacyModuleViewModel.createUser().then((value) { GifLoaderDialogUtils.hideDialog(context); Navigator.push(context, FadePage(page: LandingPagePharmacy())); }); } else { GifLoaderDialogUtils.hideDialog(context); Navigator.push(context, FadePage(page: LandingPagePharmacy())); } }); } } navigateToCovidDriveThru() { Navigator.push(context, FadePage(page: CovidDrivethruLocation())); } Widget inputWidget(String _labelText, String _hintText, TextEditingController _controller, {String? prefix, bool isEnable = true, bool hasSelection = false}) { return Container( padding: EdgeInsets.only(left: 16, right: 16, bottom: 15, top: 15), alignment: Alignment.center, decoration: BoxDecoration( borderRadius: BorderRadius.circular(15), color: Colors.white, border: Border.all( color: Color(0xffefefef), width: 1, ), ), child: InkWell( onTap: hasSelection ? () {} : null, child: Row( children: [ Expanded( child: Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ Text( _labelText, style: TextStyle( fontSize: 11, fontWeight: FontWeight.w600, color: Color(0xff2B353E), letterSpacing: -0.44, ), ), TextField( enabled: isEnable, scrollPadding: EdgeInsets.zero, keyboardType: TextInputType.number, controller: _controller, onChanged: (value) => {}, style: TextStyle( fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w400, color: Color(0xff2B353E), letterSpacing: -0.44, ), decoration: InputDecoration( isDense: true, hintText: _hintText, hintStyle: TextStyle( fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w400, color: Color(0xff575757), letterSpacing: -0.56, ), prefixIconConstraints: BoxConstraints(minWidth: 50), prefixIcon: prefix == null ? null : Text( "+" + prefix, style: TextStyle( fontSize: 14, height: 21 / 14, fontWeight: FontWeight.w500, color: Color(0xff2E303A), letterSpacing: -0.56, ), ), contentPadding: EdgeInsets.zero, border: InputBorder.none, focusedBorder: InputBorder.none, enabledBorder: InputBorder.none, ), ), ], ), ), if (hasSelection) Icon(Icons.keyboard_arrow_down_outlined), ], ), ), ); } }