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.
122 lines
4.6 KiB
Dart
122 lines
4.6 KiB
Dart
import 'package:doctor_app_flutter/providers/schedule_provider.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';
|
|
|
|
import '../config/size_config.dart';
|
|
import '../widgets/shared/app_scaffold_widget.dart';
|
|
import '../widgets/shared/card_with_bg_widget.dart';
|
|
|
|
class MyScheduleScreen extends StatelessWidget {
|
|
ScheduleProvider scheduleProvider;
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
scheduleProvider = Provider.of(context);
|
|
return AppScaffold(
|
|
// pageOnly: false,
|
|
showBottomBar: false,
|
|
showAppDrawer: false,
|
|
appBarTitle: 'My Schedule',
|
|
body: scheduleProvider.isLoading
|
|
? DrAppCircularProgressIndeicator()
|
|
: scheduleProvider.isError
|
|
? Center(
|
|
child: AppText(
|
|
scheduleProvider.error,
|
|
color: Theme.of(context).errorColor,
|
|
),
|
|
)
|
|
: scheduleProvider.listDoctorWorkingHoursTable.length == 0
|
|
? Center(
|
|
child: AppText(
|
|
'You don\'t have any Schedule',
|
|
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,
|
|
),
|
|
AppText('My Schedule',
|
|
fontSize:
|
|
2.5 * SizeConfig.textMultiplier),
|
|
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 CardWithBgWidget(
|
|
widget: Container(
|
|
child: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: <Widget>[
|
|
AppText(item.dayName,
|
|
fontSize: 2.5 * SizeConfig.textMultiplier),
|
|
SizedBox(
|
|
height: 8,
|
|
),
|
|
!item.workingHours.contains('and')
|
|
? AppText(item.workingHours,
|
|
fontSize: 2.5 * SizeConfig.textMultiplier)
|
|
: Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
AppText(
|
|
item.workingHours.substring(
|
|
0, item.workingHours.indexOf('a')),
|
|
fontSize: 2.5 * SizeConfig.textMultiplier),
|
|
AppText(
|
|
item.workingHours.substring(
|
|
item.workingHours.indexOf('d') + 2,
|
|
),
|
|
fontSize: 2.5 * SizeConfig.textMultiplier),
|
|
],
|
|
),
|
|
SizedBox(
|
|
width: 8,
|
|
)
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}).toList(),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
|
|
TextStyle textStyle(size, [FontWeight weight]) {
|
|
return TextStyle(
|
|
fontSize: size * SizeConfig.textMultiplier, fontWeight: weight);
|
|
}
|
|
}
|