import 'package:doctor_app_flutter/providers/schedule_provider.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, appBarTitle: 'My Schedule', body: scheduleProvider.isLoading ? Center( child: CircularProgressIndicator(), ) : scheduleProvider.isError ? Center( child: Text( scheduleProvider.error, style: TextStyle(color: Theme.of(context).errorColor), ), ) : scheduleProvider.listDoctorWorkingHoursTable.length == 0 ? Center( child: Text( 'You don\'t have any Schedule', style: TextStyle(color: Theme.of(context).errorColor), ), ) : Container( padding: EdgeInsetsDirectional.fromSTEB(30, 0, 30, 0), child: ListView( children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 20, ), Text('My Schedule', style: textStyle(2.5, FontWeight.w700)), scheduleListByDate(), // scheduleListByDate('Wednesday, 8 April '), ], ), ], ), ], ), ), ); } Column scheduleListByDate() { return Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 10, ), Container( child: Column( children: scheduleProvider.listDoctorWorkingHoursTable.map((item) { return CardWithBgWidget( line1Text: item.dayName, line2Text: item.workingHours, heightPercentage: 0.18, widthPercentage: 0.80, ); }).toList(), ), ), ], ); } TextStyle textStyle(size, [FontWeight weight]) { return TextStyle( fontSize: size * SizeConfig.textMultiplier, fontWeight: weight); } }