1
0
mirror of https://gitlab.com/comunic/comunicmobile synced 2025-06-19 08:15:16 +00:00

Force square account image

This commit is contained in:
2021-03-13 18:11:28 +01:00
parent e70aaabbc9
commit f8910c8f8b
5 changed files with 14 additions and 6 deletions

View File

@ -17,8 +17,8 @@ import '../../utils/files_utils.dart';
/// Attempt to crop image
///
/// Return original image in case of error / if the user did not crop the image
Future<BytesFile> showImageCropper(
BuildContext context, BytesFile source) async {
Future<BytesFile> showImageCropper(BuildContext context, BytesFile source,
{CropAspectRatio aspectRatio}) async {
assert(context != null);
assert(source != null);
@ -32,6 +32,7 @@ Future<BytesFile> showImageCropper(
File cropped = await ImageCropper.cropImage(
sourcePath: file.absolute.path,
compressFormat: ImageCompressFormat.png,
aspectRatio: aspectRatio,
androidUiSettings: AndroidUiSettings(
toolbarColor: Colors.black,
toolbarTitle: tr("Crop Photo"),

View File

@ -12,6 +12,7 @@ import 'package:comunic/utils/intl_utils.dart';
import 'package:comunic/utils/ui_utils.dart';
import 'package:flutter/material.dart';
import 'package:identicon/identicon.dart';
import 'package:image_cropper/image_cropper.dart';
import 'package:random_string/random_string.dart';
import 'package:settings_ui/settings_ui.dart';
@ -160,7 +161,8 @@ class _AccountImageSettingsScreenState
/// Upload a new account image
void _uploadAccountImage() async {
try {
final image = await pickImage(context);
final image = await pickImage(context,
aspectRatio: CropAspectRatio(ratioX: 5, ratioY: 5));
if (image == null) return;