fix schedule

merge-requests/382/head
Elham Rababah 5 years ago
parent 4877bc8f6d
commit f8c14a88ee

@ -284,4 +284,14 @@ class DateUtils {
} }
return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}"; return "$years ${TranslationBase.of(context).years} $months ${TranslationBase.of(context).months} $days ${TranslationBase.of(context).days}";
} }
static bool isToday(DateTime dateTime){
DateTime todayDate = DateTime.now().toUtc();
if(dateTime.day == todayDate.day && dateTime.month == todayDate.month && dateTime.year == todayDate.year) {
return true;
}
return false;
}
} }

@ -1,8 +1,9 @@
import 'package:doctor_app_flutter/config/size_config.dart'; import 'package:doctor_app_flutter/config/size_config.dart';
import 'package:doctor_app_flutter/models/doctor/list_doctor_working_hours_table_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/util/helpers.dart';
import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/app_texts_widget.dart';
import 'package:doctor_app_flutter/widgets/shared/card_with_bgNew_widget.dart'; import 'package:doctor_app_flutter/widgets/shared/card_with_bg_widget.dart';
import 'package:flutter/cupertino.dart'; import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
@ -16,58 +17,82 @@ class MyScheduleWidget extends StatelessWidget {
List<WorkingHours> workingHours = Helpers.getWorkingHours( List<WorkingHours> workingHours = Helpers.getWorkingHours(
workingHoursTable.workingHours, workingHoursTable.workingHours,
); );
return CardWithBgWidgetNew( return Row(
widget: Container( mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Column( crossAxisAlignment: CrossAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start, children: [
children: <Widget>[ Column(
Column( mainAxisAlignment: MainAxisAlignment.start,
children: [ children: [
Divider( SizedBox(
height: 1, height: 10,
color: Colors.grey, ),
thickness: 1.0, AppText(
), workingHoursTable.dayName,
], fontSize: 2.5 * SizeConfig.textMultiplier,
fontFamily: 'Poppins',
// fontSize: 18
), ),
SizedBox( SizedBox(
height: 10, height: 10,
), ),
Row( AppText(
children: <Widget>[ ' ${workingHoursTable.date.day} ${(DateUtils.getMonth(workingHoursTable.date.month).toString().substring(0, 3))}',
AppText( fontSize: 2.5 * SizeConfig.textMultiplier,
workingHoursTable.dayName, fontWeight: FontWeight.w700,
fontSize: 2.5 * SizeConfig.textMultiplier,
), fontFamily: 'Poppins',
AppText( // fontSize: 18
' ${workingHoursTable.date.day}/${workingHoursTable.date.month}/${workingHoursTable.date.year}',
fontSize: 2.2 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w300,
),
],
), ),
Column( ],
crossAxisAlignment: CrossAxisAlignment.start, ),
children: workingHours.map((work) { Container(
return Container( width: MediaQuery.of(context).size.width * 0.55,
child: Column( child: CardWithBgWidget(
children: <Widget>[ bgColor: DateUtils.isToday(workingHoursTable.date)
SizedBox( ? Colors.green[500]
height: 5, : Colors.transparent,
), hasBorder: false,
AppText( widget: Container(
work.from + ' - ' + work.to, child: Column(
fontSize: 2.0 * SizeConfig.textMultiplier, crossAxisAlignment: CrossAxisAlignment.start,
fontWeight: FontWeight.w300, children: <Widget>[
) if (DateUtils.isToday(workingHoursTable.date))
], AppText(
"Today",
fontSize: 2.5 * SizeConfig.textMultiplier,
fontFamily: 'Poppins',
color: Colors.green[500],
// fontSize: 18
),
SizedBox(
height: 10,
), ),
); Column(
}).toList(), crossAxisAlignment: CrossAxisAlignment.start,
children: workingHours.map((work) {
return Container(
child: Column(
children: <Widget>[
SizedBox(
height: 5,
),
AppText(
work.from + ' - ' + work.to,
fontSize: 2.0 * SizeConfig.textMultiplier,
fontWeight: FontWeight.w300,
)
],
),
);
}).toList(),
),
],
),
), ),
], ),
), ),
), ],
); );
} }
} }

@ -24,7 +24,7 @@ class CardWithBgWidget extends StatelessWidget {
ProjectViewModel projectProvider = Provider.of(context); ProjectViewModel projectProvider = Provider.of(context);
return Container( return Container(
margin: EdgeInsets.symmetric(vertical: 10.0), margin: EdgeInsets.symmetric(vertical: 10.0),
width: double.infinity, // width: double.infinity,
decoration: BoxDecoration( decoration: BoxDecoration(
borderRadius: BorderRadius.all( borderRadius: BorderRadius.all(
Radius.circular(10.0), Radius.circular(10.0),

Loading…
Cancel
Save