Skip to content

Commit 85dcd12

Browse files
committed
feat: implement modal bottom sheet for schedule editing in CalendarScreen
1 parent 3bcc47b commit 85dcd12

File tree

2 files changed

+29
-12
lines changed

2 files changed

+29
-12
lines changed

lib/presentation/calendar/screens/calendar_screen.dart

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import 'package:on_time_front/core/di/di_setup.dart';
77
import 'package:on_time_front/l10n/app_localizations.dart';
88
import 'package:on_time_front/presentation/calendar/bloc/monthly_schedules_bloc.dart';
99
import 'package:on_time_front/presentation/calendar/component/schedule_detail.dart';
10+
import 'package:on_time_front/presentation/schedule_create/screens/schedule_edit_screen.dart';
1011
import 'package:on_time_front/presentation/shared/components/calendar/centered_calendar_header.dart';
1112
import 'package:on_time_front/presentation/shared/theme/calendar_theme.dart';
1213
import 'package:table_calendar/table_calendar.dart';
@@ -163,8 +164,13 @@ class _CalendarScreenState extends ConsumerState<CalendarScreen> {
163164
return ScheduleDetail(
164165
schedule: schedule,
165166
onEdit: () {
166-
context.go(
167-
'/scheduleEdit/${schedule.id}',
167+
showModalBottomSheet(
168+
context: context,
169+
isScrollControlled: true,
170+
backgroundColor: Colors.transparent,
171+
builder: (context) => ScheduleEditScreen(
172+
scheduleId: schedule.id,
173+
),
168174
);
169175
},
170176
onDeleted: () {

lib/presentation/schedule_create/screens/schedule_edit_screen.dart

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,28 @@ class ScheduleEditScreen extends StatelessWidget {
1212
@override
1313
Widget build(BuildContext context) {
1414
return Material(
15+
color: Colors.transparent,
1516
child: SafeArea(
16-
child: BlocProvider<ScheduleFormBloc>(
17-
create: (context) => getIt.get<ScheduleFormBloc>()
18-
..add(ScheduleFormEditRequested(scheduleId: scheduleId)),
19-
child: BlocBuilder<ScheduleFormBloc, ScheduleFormState>(
20-
builder: (context, state) {
21-
return ScheduleMultiPageForm(
22-
onSaved: () => context.read<ScheduleFormBloc>().add(
23-
const ScheduleFormUpdated(),
24-
));
25-
},
17+
child: FractionallySizedBox(
18+
heightFactor: 0.85,
19+
child: Container(
20+
decoration: BoxDecoration(
21+
color: Colors.white,
22+
borderRadius:
23+
const BorderRadius.vertical(top: Radius.circular(24)),
24+
),
25+
child: BlocProvider<ScheduleFormBloc>(
26+
create: (context) => getIt.get<ScheduleFormBloc>()
27+
..add(ScheduleFormEditRequested(scheduleId: scheduleId)),
28+
child: BlocBuilder<ScheduleFormBloc, ScheduleFormState>(
29+
builder: (context, state) {
30+
return ScheduleMultiPageForm(
31+
onSaved: () => context.read<ScheduleFormBloc>().add(
32+
const ScheduleFormUpdated(),
33+
));
34+
},
35+
),
36+
),
2637
),
2738
),
2839
),

0 commit comments

Comments
 (0)