import 'dart:io'; import 'package:easy_localization/easy_localization.dart'; import 'package:flutter/material.dart'; import 'package:hmg_patient_app_new/core/app_assets.dart'; import 'package:hmg_patient_app_new/core/utils/size_utils.dart'; import 'package:hmg_patient_app_new/extensions/string_extensions.dart'; import 'package:hmg_patient_app_new/extensions/widget_extensions.dart'; import 'package:hmg_patient_app_new/features/smartwatch_health_data/health_provider.dart'; import 'package:hmg_patient_app_new/generated/locale_keys.g.dart'; import 'package:hmg_patient_app_new/presentation/smartwatches/widgets/supported_watches_list.dart'; import 'package:hmg_patient_app_new/theme/colors.dart'; import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart'; import 'package:hmg_patient_app_new/widgets/buttons/custom_button.dart'; import 'package:hmg_patient_app_new/widgets/common_bottom_sheet.dart'; import 'package:provider/provider.dart'; class SmartwatchHomePage extends StatelessWidget { const SmartwatchHomePage({super.key}); @override Widget build(BuildContext context) { return Scaffold( backgroundColor: AppColors.bgScaffoldColor, body: CollapsingListView( title: LocaleKeys.smartWatches.tr(), bottomChild: Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.r, ), child: CustomButton( text: LocaleKeys.supportedSmartWatches.tr(context: context), onPressed: () { showCommonBottomSheetWithoutHeight( title: LocaleKeys.supportedSmartWatches.tr(context: context), context, child: SupportedWatchesList(), callBackFunc: () {}, isFullScreen: false, isCloseButtonVisible: true, ); }, backgroundColor: AppColors.infoColor.withAlpha(40), borderColor: AppColors.infoColor.withAlpha(0), textColor: AppColors.infoColor, fontSize: 16.f, fontWeight: FontWeight.w500, borderRadius: 12.r, height: 50.h, icon: AppAssets.ask_doctor_icon, iconColor: AppColors.infoColor, iconSize: 18.h, ).paddingSymmetrical(24.w, 30.h), ), child: SingleChildScrollView( child: Column( children: [ Padding( padding: EdgeInsets.symmetric(horizontal: 24.w, vertical: 24.h), child: GridView( padding: EdgeInsets.zero, shrinkWrap: true, gridDelegate: SliverGridDelegateWithFixedCrossAxisCount( crossAxisCount: 2, crossAxisSpacing: 16.h, mainAxisSpacing: 16.w, mainAxisExtent: 240.h, ), children: [ Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.r, ), child: Column( children: [ Image.asset("assets/images/png/smartwatches/apple-watch-5.jpg", width: 136.w, height: 136.h).paddingSymmetrical(24.w, 8.h), "Apple Watch".needTranslation.toText16(isBold: true), CustomButton( text: LocaleKeys.select.tr(context: context), onPressed: () { context.read().setSelectedWatchType("apple", "assets/images/png/smartwatches/apple-watch-5.jpg"); }, backgroundColor: AppColors.primaryRedColor.withAlpha(40), borderColor: AppColors.primaryRedColor.withAlpha(0), textColor: AppColors.primaryRedColor, fontSize: 16.f, fontWeight: FontWeight.w500, borderRadius: 12.r, height: 40.h, ).paddingSymmetrical(16.w, 12.h), ], ), ), Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.r, ), child: Column( children: [ Image.asset("assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg", fit: BoxFit.contain, width: 136.w, height: 136.h).paddingSymmetrical(24.w, 8.h), "Samsung Watch".needTranslation.toText16(isBold: true), CustomButton( text: LocaleKeys.select.tr(context: context), onPressed: () { context.read().setSelectedWatchType("samsung", "assets/images/png/smartwatches/galaxy_watch_8_classic.jpeg"); }, backgroundColor: AppColors.primaryRedColor.withAlpha(40), borderColor: AppColors.primaryRedColor.withAlpha(0), textColor: AppColors.primaryRedColor, fontSize: 16.f, fontWeight: FontWeight.w500, borderRadius: 12.r, height: 40.h, ).paddingSymmetrical(16.w, 12.h), ], ), ), Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.r, ), child: Column( children: [ Image.asset("assets/images/png/smartwatches/Huawei_Watch.png", width: 136.w, height: 136.h).paddingSymmetrical(24.w, 8.h), "Huawei Watch".needTranslation.toText16(isBold: true), CustomButton( text: LocaleKeys.select.tr(context: context), onPressed: () { context.read().setSelectedWatchType("huawei", "assets/images/png/smartwatches/Huawei_Watch.png"); }, backgroundColor: AppColors.primaryRedColor.withAlpha(40), borderColor: AppColors.primaryRedColor.withAlpha(0), textColor: AppColors.primaryRedColor, fontSize: 16.f, fontWeight: FontWeight.w500, borderRadius: 12.r, height: 40.h, ).paddingSymmetrical(16.w, 12.h), ], ), ), Container( decoration: RoundedRectangleBorder().toSmoothCornerDecoration( color: AppColors.whiteColor, borderRadius: 24.r, ), child: Column( children: [ Image.asset("assets/images/png/smartwatches/Whoop_Watch.png", width: 136.w, height: 136.h).paddingSymmetrical(24.w, 8.h), "Whoop Watch".needTranslation.toText16(isBold: true), CustomButton( text: LocaleKeys.select.tr(context: context), onPressed: () { context.read().setSelectedWatchType("whoop", "assets/images/png/smartwatches/Whoop_Watch.png"); }, backgroundColor: AppColors.primaryRedColor.withAlpha(40), borderColor: AppColors.primaryRedColor.withAlpha(0), textColor: AppColors.primaryRedColor, fontSize: 16.f, fontWeight: FontWeight.w500, borderRadius: 12.r, height: 40.h, ).paddingSymmetrical(16.w, 12.h), ], ), ), ], ), ), ], ), ), ), ); } }