Skip to content

Commit

Permalink
lista de disciplinas
Browse files Browse the repository at this point in the history
  • Loading branch information
ErnestoMoraes committed May 10, 2023
1 parent 687b264 commit c7d44f4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 8 additions & 1 deletion lib/app/pages/daily/daily_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@ class _DailyPageState extends BaseState<DailyPage, DailyController> {
@override
void onReady() async {
await controller.loadSemestre();
list = controller.state.semestres[0].disciplinas;
if (controller.state.isNow) {
list = controller.state.semestres[0].disciplinas;
}
}

@override
Expand Down Expand Up @@ -123,6 +125,11 @@ class _DailyPageState extends BaseState<DailyPage, DailyController> {
loaded: () => true,
),
builder: (context, state) {
if (state.isNow) {
list = state.semestres[0].disciplinas;
} else {
list = state.semestres[state.selected].disciplinas;
}
return Expanded(
child: ListView.builder(
shrinkWrap: true,
Expand Down
8 changes: 4 additions & 4 deletions lib/app/pages/daily/widgets/my_switch.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';

class MySwitch extends StatefulWidget {
const MySwitch({super.key});
const MySwitch({
super.key,
});

@override
State<MySwitch> createState() => _MySwitchState();
Expand All @@ -31,9 +33,7 @@ class _MySwitchState extends State<MySwitch> {
borderRadius: BorderRadius.circular(5),
),
child: TextButton(
onPressed: () {
context.read<DailyController>().changeIsNow();
},
onPressed: () => context.read<DailyController>().changeIsNow(),
child: Text(
'Diário atual',
style: TextStyles.instance.texLabelH2.copyWith(
Expand Down
2 changes: 1 addition & 1 deletion lib/app/pages/schedule/schedule_state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ScheduleState extends Equatable {
: status = ScheduleStatus.initial,
schedule = <Horario>[],
errorMessage = null,
selectedDay = DateTime.now().weekday - 1;
selectedDay = DateTime.now().weekday;

@override
List<Object?> get props => [status, schedule, errorMessage, selectedDay];
Expand Down

0 comments on commit c7d44f4

Please sign in to comment.