Skip to content

Commit

Permalink
Edit Schedule Bugs Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusrmatias committed Nov 7, 2023
1 parent ab210a2 commit 2b0fcb9
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lib/src/pages/tabs/schedule_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,20 @@ class _ScheduleTabState extends State<ScheduleTab> {
backgroundColor: MainTheme.white,
color: MainTheme.orange,
onRefresh: ()async{await widget.onPressed();},
child: ListView.builder(
child: schedule.isNotEmpty?ListView.builder(
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
itemCount: schedule.length+1,
itemBuilder: (context, index){
if(index==0)return Row(mainAxisAlignment: MainAxisAlignment.center,children: [Flexible(child: Text(setting.lastInfoUpdate))]);
return ScheduleCard(schedule: schedule[index-1]);
},
):ListView(
physics: const BouncingScrollPhysics(parent: AlwaysScrollableScrollPhysics()),
children: [
Row(mainAxisAlignment: MainAxisAlignment.center,children: [Flexible(child: Text(setting.lastInfoUpdate))]),
const SizedBox(height: 16),
const Row(mainAxisAlignment: MainAxisAlignment.center,children: [Flexible(child: Text('Ocorreu um erro, atualize os dados para corrigir.'))]),
],
),
),
);
Expand Down
5 changes: 4 additions & 1 deletion lib/src/widgets/schedule_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import 'package:fluttertoast/fluttertoast.dart';
import 'package:provider/provider.dart';
import 'package:sigalogin/src/controllers/student_controller.dart';
import 'package:sigalogin/src/models/schedule.dart';
import 'package:sigalogin/src/repositories/settings_repository.dart';
import 'package:sigalogin/src/repositories/student_repository.dart';
import 'package:sigalogin/src/themes/main_theme.dart';

Expand All @@ -16,6 +17,7 @@ class ScheduleCard extends StatefulWidget {

class _ScheduleCardState extends State<ScheduleCard> {
late StudentRepository repository;
late SettingRepository setting;
bool inEdit = false;
bool inSave = false;
Map<String,String> hours = {
Expand All @@ -37,7 +39,7 @@ class _ScheduleCardState extends State<ScheduleCard> {
@override
Widget build(BuildContext context) {
repository = Provider.of<StudentRepository>(context);

setting = Provider.of<SettingRepository>(context);
return AnimatedSize(
duration: const Duration(milliseconds: 300),
curve: Curves.easeInOut,
Expand Down Expand Up @@ -148,6 +150,7 @@ class _ScheduleCardState extends State<ScheduleCard> {
await controller.updateOnlySchedule(newSchedule);
repository.schedule = await controller.querySchedule();
setState(()=>inEdit=false);
setting.updateSchedule=false;
Fluttertoast.showToast(msg: 'Horário salvo com sucesso');
}catch (e){
debugPrint('Error: $e');
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ publish_to: 'none' # Remove this line if you wish to publish to pub.dev
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
# In Windows, build-name is used as the major, minor, and patch parts
# of the product and file versions while build-number is used as the build suffix.
version: 2.3.0+32
version: 2.3.1+33

environment:
sdk: '>=3.0.5 <4.0.0'
Expand Down

0 comments on commit 2b0fcb9

Please sign in to comment.