import 'package:doctor_app_flutter/providers/schedule_provider.dart';
import 'package:doctor_app_flutter/util/translations_delegate_base.dart';
import 'package:doctor_app_flutter/widgets/doctor/my_schedule_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_scaffold_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/dr_app_circular_progress_Indeicator.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';


class MyScheduleScreen extends StatelessWidget {
  ScheduleProvider scheduleProvider;

  @override
  Widget build(BuildContext context) {
    scheduleProvider = Provider.of(context);
    return AppScaffold(
      isShowAppBar: false,
      body: scheduleProvider.isLoading
          ? DrAppCircularProgressIndeicator()
          : scheduleProvider.isError
              ? Center(
                  child: AppText(
                    scheduleProvider.error,
                    color: Theme.of(context).errorColor,
                  ),
                )
              : scheduleProvider.listDoctorWorkingHoursTable.length == 0
                  ? Center(
                      child: AppText(
                        TranslationBase.of(context).errorNoSchedule,
                        color: Theme.of(context).errorColor,
                      ),
                    )
                  : Container(
                      padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0),
                      child: ListView(
                        children: <Widget>[
                          Column(
                            crossAxisAlignment: CrossAxisAlignment.start,
                            children: <Widget>[
                              Column(
                                crossAxisAlignment: CrossAxisAlignment.start,
                                children: <Widget>[
                                  SizedBox(
                                    height: 20,
                                  ),

                                  scheduleListByDate(),
                                  //   scheduleListByDate('Wednesday, 8 April '),
                                ],
                              ),
                            ],
                          ),
                        ],
                      ),
                    ),
    );
  }

  Column scheduleListByDate() {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: <Widget>[
        SizedBox(
          height: 10,
        ),
        Container(
          child: Column(
            children: scheduleProvider.listDoctorWorkingHoursTable.map((item) {
              return MyScheduleWidget(workingHoursTable: item,);
            }).toList(),
          ),
        ),
      ],
    );
  }

}
