feat: open the event details page when a new one is create (#2388)

* style: code style improvement

* chore: open cal event details page upon creation
This commit is contained in:
Richard Shiue 2023-04-29 16:32:29 +08:00 committed by GitHub
parent 28f22e4d61
commit cd1202d3dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 5 deletions

View File

@ -49,7 +49,7 @@ class CalendarDayCard extends StatelessWidget {
return ChangeNotifierProvider( return ChangeNotifierProvider(
create: (_) => _CardEnterNotifier(), create: (_) => _CardEnterNotifier(),
builder: ((context, child) { builder: (context, child) {
final children = events.map((event) { final children = events.map((event) {
return _DayEventCell( return _DayEventCell(
event: event, event: event,
@ -101,7 +101,7 @@ class CalendarDayCard extends StatelessWidget {
), ),
), ),
); );
}), },
); );
} }
@ -247,7 +247,7 @@ class _DayBadge extends StatelessWidget {
dayTextColor = Theme.of(context).disabledColor; dayTextColor = Theme.of(context).disabledColor;
} }
Widget day = Container( return Container(
decoration: BoxDecoration( decoration: BoxDecoration(
color: isToday ? Theme.of(context).colorScheme.primary : null, color: isToday ? Theme.of(context).colorScheme.primary : null,
borderRadius: Corners.s6Border, borderRadius: Corners.s6Border,
@ -258,8 +258,6 @@ class _DayBadge extends StatelessWidget {
color: dayTextColor, color: dayTextColor,
), ),
); );
return day;
} }
} }

View File

@ -9,6 +9,9 @@ import 'package:flowy_infra_ui/flowy_infra_ui.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:flutter_bloc/flutter_bloc.dart';
import '../../application/row/row_data_controller.dart';
import '../../widgets/row/cell_builder.dart';
import '../../widgets/row/row_detail.dart';
import 'calendar_day.dart'; import 'calendar_day.dart';
import 'layout/sizes.dart'; import 'layout/sizes.dart';
import 'toolbar/calendar_toolbar.dart'; import 'toolbar/calendar_toolbar.dart';
@ -88,6 +91,7 @@ class _CalendarPageState extends State<CalendarPage> {
if (state.newEvent != null) { if (state.newEvent != null) {
_eventController.add(state.newEvent!); _eventController.add(state.newEvent!);
} }
_showRowDetailPage(state.newEvent!.event!, context);
}, },
), ),
], ],
@ -208,4 +212,24 @@ class _CalendarPageState extends State<CalendarPage> {
// MonthView places the first day of week on the second column for some reason. // MonthView places the first day of week on the second column for some reason.
return WeekDays.values[(dayOfWeek + 1) % 7]; return WeekDays.values[(dayOfWeek + 1) % 7];
} }
void _showRowDetailPage(CalendarDayEvent event, BuildContext context) {
final dataController = RowController(
rowId: event.cellId.rowId,
viewId: widget.view.id,
rowCache: _calendarBloc.rowCache,
);
FlowyOverlay.show(
context: context,
builder: (BuildContext context) {
return RowDetailPage(
cellBuilder: GridCellBuilder(
cellCache: _calendarBloc.rowCache.cellCache,
),
dataController: dataController,
);
},
);
}
} }