import 'package:hmg_patient_app/models/FamilyFiles/PatientERVirtualHistoryResponse.dart';
import 'package:hmg_patient_app/pages/livecare/widgets/LiveCareHistoryCard.dart';
import 'package:hmg_patient_app/uitl/utils_new.dart';
import 'package:flutter/material.dart';

class LiveCareLogs extends StatefulWidget {
  List<ErRequestHistoryList> erRequestHistoryList;

  LiveCareLogs({required this.erRequestHistoryList});

  @override
  _LiveCareLogsState createState() => _LiveCareLogsState();
}

class _LiveCareLogsState extends State<LiveCareLogs> {
  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return SingleChildScrollView(
      child: widget.erRequestHistoryList.length > 0
          ? Container(
              child: ListView.builder(
                scrollDirection: Axis.vertical,
                shrinkWrap: true,
                physics: ScrollPhysics(),
                padding: EdgeInsets.all(0.0),
                itemCount: widget.erRequestHistoryList.length,
                itemBuilder: (context, index) {
                  return widget.erRequestHistoryList[index].callStatus! < 4
                      ? Container()
                      : LiveCareHistoryCard(
                          erRequestHistoryList: widget.erRequestHistoryList[index],
                          isFirstOrLast: index==0?0:(index==widget.erRequestHistoryList.length-1)?1:2,
                        );
                },
              ),
            )
          : Container(margin: EdgeInsets.only(top: 200.0), child: getNoDataWidget(context)),
    );
  }
}
