import 'package:easy_localization/easy_localization.dart';
import 'package:flutter/material.dart';
import 'package:hmg_patient_app_new/core/utils/size_utils.dart';
import 'package:hmg_patient_app_new/generated/locale_keys.g.dart';
import 'package:hmg_patient_app_new/presentation/book_appointment/widgets/doctor_schedule_bottom_sheet.dart';
import 'package:hmg_patient_app_new/widgets/appbar/collapsing_list_view.dart';

class DoctorSchedulePage extends StatelessWidget {
  const DoctorSchedulePage({super.key});

  @override
  Widget build(BuildContext context) {
    return CollapsingListView(
      title: LocaleKeys.doctorSchedule.tr(),
      isClose: true,
      child: Builder(
        builder: (ctx) {
          final mq = MediaQuery.of(ctx);
          // SliverToBoxAdapter is unbounded — give explicit height so
          // the PageView (Expanded) inside DoctorScheduleBottomSheet works.
          final height = mq.size.height - mq.padding.top - 56.h;
          return SizedBox(
            height: height,
            child: Padding(
              padding: EdgeInsets.symmetric(horizontal: 24.w),
              // Stop scroll notifications from bubbling up to CollapsingListView's
              // outer CustomScrollView, which would steal vertical scroll gestures.
              child: NotificationListener<ScrollNotification>(
                onNotification: (_) => true,
                child: const DoctorScheduleBottomSheet(),
              ),
            ),
          );
        },
      ),
    );
  }
}

