route avatar crop and profile view through AppRoutes
This commit is contained in:
@@ -37,8 +37,10 @@ import '../view/pages/talk/talk_navigator.dart';
|
||||
import '../view/pages/ticker/ticker_page_view.dart';
|
||||
import '../view/pages/timetable/custom_events/custom_events_view.dart';
|
||||
import '../view/pages/timetable/subject_colors/subject_colors_view.dart';
|
||||
import '../widget/avatar_crop_page.dart';
|
||||
import '../widget/debug/cache_view.dart';
|
||||
import '../widget/file_viewer.dart';
|
||||
import '../widget/large_profile_picture_view.dart';
|
||||
import '../widget/user_avatar.dart';
|
||||
|
||||
/// Single entry point for full-page navigations. Dialogs and bottom sheets
|
||||
@@ -95,6 +97,30 @@ class AppRoutes {
|
||||
pushScreen(context, withNavBar: false, screen: const SubjectColorsView());
|
||||
}
|
||||
|
||||
/// Opens the full-screen cropper on [imageBytes] and resolves to the cropped
|
||||
/// bytes (or null if cancelled). [aspectRatio] defaults to 1:1 for avatars;
|
||||
/// pass null for a free-form crop (e.g. chat backgrounds).
|
||||
static Future<Uint8List?> openAvatarCrop(
|
||||
BuildContext context, {
|
||||
required Uint8List imageBytes,
|
||||
double? aspectRatio = 1,
|
||||
}) {
|
||||
return Navigator.of(context).push<Uint8List>(
|
||||
MaterialPageRoute(
|
||||
fullscreenDialog: true,
|
||||
builder: (_) =>
|
||||
AvatarCropPage(imageBytes: imageBytes, aspectRatio: aspectRatio),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// Opens the tappable, zoomable profile-picture viewer for [id].
|
||||
static void openLargeProfilePicture(BuildContext context, String id) {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute<void>(builder: (_) => LargeProfilePictureView(id: id)),
|
||||
);
|
||||
}
|
||||
|
||||
/// Opens the picker for choosing a foreign timetable element and resolves to
|
||||
/// the selected element (or null if dismissed). The timetable view renders
|
||||
/// the chosen plan inline. Gated behind the `viewForeignTimetables`
|
||||
|
||||
Reference in New Issue
Block a user