You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
RSGDoctorApp/lib/widgets/doctor/my_schedule_widget.dart

119 lines
4.7 KiB
Dart

import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/core/viewModel/project_view_model.dart';
import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_model.dart';
import 'package:doctor_app_flutter/util/date-utils.dart';
import 'package:doctor_app_flutter/util/helpers.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
class MyScheduleWidget extends StatelessWidget {
final ListDoctorWorkingHoursTable workingHoursTable;
MyScheduleWidget({Key? key, required this.workingHoursTable});
@override
Widget build(BuildContext context) {
ProjectViewModel projectViewModel = Provider.of(context);
List<WorkingHours> workingHours = Helpers.getWorkingHours(
workingHoursTable.workingHours!,
);
return Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SizedBox(
height: 10,
),
AppText(
projectViewModel.isArabic
? AppDateUtils.getWeekDayArabic(workingHoursTable.date!.weekday)
: AppDateUtils.getWeekDay(workingHoursTable.date!.weekday),
fontSize: 16,
fontFamily: 'Poppins',
// fontSize: 18
),
AppText(
' ${workingHoursTable.date!.day} ${(AppDateUtils.getMonth(workingHoursTable.date!.month).toString().substring(0, 3))}',
fontSize: 14,
fontWeight: FontWeight.w700,
fontFamily: 'Poppins',
// fontSize: 18
),
],
),
),
Container(
width: MediaQuery.of(context).size.width * 0.55,
child: CardWithBgWidget(
bgColor: AppDateUtils.isToday(workingHoursTable.date!) ? Colors.green[500]! : Colors.transparent,
// hasBorder: false,
widget: Container(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
if (AppDateUtils.isToday(workingHoursTable.date!))
AppText(
"Today",
fontSize: 1.8 * SizeConfig.textMultiplier,
fontFamily: 'Poppins',
color: Colors.green[500],
// fontSize: 18
),
SizedBox(
height: 10,
),
Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: workingHours.map((work) {
return Container(
margin: EdgeInsets.only(bottom: workingHours.length > 1 ? 15 : 0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: <Widget>[
SizedBox(
height: 5,
),
if (workingHoursTable!.clinicName != null)
AppText(
workingHoursTable!.clinicName ?? "",
fontSize: 15,
fontWeight: FontWeight.w700,
),
Container(
width: MediaQuery.of(context).size.width * 0.55,
child: AppText(
'${work.from} - ${work.to}',
fontSize: 15,
fontWeight: FontWeight.w300,
),
),
if (workingHoursTable.projectName != null)
AppText(
workingHoursTable.projectName ?? "",
fontSize: 15,
fontWeight: FontWeight.w700,
),
],
),
);
}).toList(),
),
],
),
),
),
),
],
);
}
}