import 'dart:typed_data'; import 'package:flutter/material.dart'; import '../routing/app_routes.dart'; import 'details_bottom_sheet.dart'; import 'file_pick.dart'; /// Bottom sheet with "from gallery" and "take photo" actions for choosing a /// chat background. Returns the picked image bytes **as-is** — cropping is a /// separate, explicit step (see [cropChatBackgroundImage]) so the user isn't /// forced through a cropper after every pick. Returns `null` if the user /// cancelled everything. Future showChatBackgroundPickerSheet(BuildContext context) async { Uint8List? result; await showDetailsBottomSheet( context, children: (sheetContext) => imageSourceTiles(sheetContext, onPicked: (bytes) => result = bytes), ); return result; } /// Opens the free-form cropper on [bytes] and returns the cropped result, or /// `null` if the user cancelled. Free aspect ratio since the background fills /// the whole screen. Future cropChatBackgroundImage( BuildContext context, Uint8List bytes, ) => AppRoutes.openAvatarCrop(context, imageBytes: bytes, aspectRatio: null);