mirror of
https://github.com/DungeonPaper/dungeon-paper-app.git
synced 2026-05-17 17:58:11 +00:00
fix: upload user photo
This commit is contained in:
@@ -144,7 +144,6 @@
|
||||
9705A1C41CF9048500538489 /* Embed Frameworks */,
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
|
||||
B54558D7219BDB53CF8F1DF8 /* [CP] Embed Pods Frameworks */,
|
||||
351AF4505EF5FEC645BE8536 /* [firebase_crashlytics] Crashlytics Upload Symbols */,
|
||||
241C12F89903BB281FE5F4F3 /* [CP] Copy Pods Resources */,
|
||||
);
|
||||
buildRules = (
|
||||
@@ -222,26 +221,6 @@
|
||||
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
|
||||
showEnvVarsInLog = 0;
|
||||
};
|
||||
351AF4505EF5FEC645BE8536 /* [firebase_crashlytics] Crashlytics Upload Symbols */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
);
|
||||
inputFileListPaths = (
|
||||
);
|
||||
inputPaths = (
|
||||
"\"${DWARF_DSYM_FOLDER_PATH}/${DWARF_DSYM_FILE_NAME}/Contents/Resources/DWARF/${TARGET_NAME}\"",
|
||||
"\"$(SRCROOT)/$(BUILT_PRODUCTS_DIR)/$(INFOPLIST_PATH)\"",
|
||||
);
|
||||
name = "[firebase_crashlytics] Crashlytics Upload Symbols";
|
||||
outputFileListPaths = (
|
||||
);
|
||||
outputPaths = (
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "\"$PODS_ROOT/FirebaseCrashlytics/upload-symbols\" --flutter-project \"$PROJECT_DIR/firebase_app_id_file.json\" ";
|
||||
};
|
||||
3B06AD1E1E4923F5004D2608 /* Thin Binary */ = {
|
||||
isa = PBXShellScriptBuildPhase;
|
||||
alwaysOutOfDate = 1;
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:dungeon_paper/core/utils/builder_utils.dart';
|
||||
import 'package:dungeon_paper/core/utils/email_address_validator.dart';
|
||||
import 'package:dungeon_paper/core/utils/password_validator.dart';
|
||||
import 'package:dungeon_paper/core/utils/string_validator.dart';
|
||||
import 'package:dungeon_paper/core/utils/upload_utils.dart';
|
||||
import 'package:dungeon_paper/i18n.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
@@ -68,7 +69,7 @@ class AccountView extends StatelessWidget {
|
||||
: const Icon(Icons.image),
|
||||
enabled: !controller.uploading,
|
||||
onTap:
|
||||
!controller.uploading ? () => _uploadImage(context) : null,
|
||||
!controller.uploading ? () => _uploadImage(controller, context) : null,
|
||||
),
|
||||
),
|
||||
() => Consumer<AccountController>(
|
||||
@@ -151,7 +152,8 @@ class AccountView extends StatelessWidget {
|
||||
username: controller.user.username,
|
||||
);
|
||||
// A deletion request for your account was sent successfully
|
||||
CustomSnackBar.show(content: tr.account.deleteAccount.success);
|
||||
CustomSnackBar.show(
|
||||
content: tr.account.deleteAccount.success);
|
||||
},
|
||||
),
|
||||
),
|
||||
@@ -240,7 +242,9 @@ class AccountView extends StatelessWidget {
|
||||
);
|
||||
}
|
||||
|
||||
void _uploadImage(BuildContext context) {}
|
||||
void _uploadImage(AccountController controller, BuildContext context) {
|
||||
controller.uploadPhoto(context);
|
||||
}
|
||||
|
||||
Future<void> Function() unlinkProvider(BuildContext context,
|
||||
AccountController controller, ProviderName provider) =>
|
||||
|
||||
@@ -137,14 +137,14 @@ ThemeData createTheme(
|
||||
),
|
||||
checkboxTheme: base.checkboxTheme.copyWith(
|
||||
fillColor:
|
||||
MaterialStateProperty.resolveWith((states) => colorScheme.secondary),
|
||||
checkColor: MaterialStateProperty.resolveWith(
|
||||
WidgetStateProperty.resolveWith((states) => colorScheme.secondary),
|
||||
checkColor: WidgetStateProperty.resolveWith(
|
||||
(states) => colorScheme.onSecondary),
|
||||
),
|
||||
switchTheme: base.switchTheme.copyWith(
|
||||
thumbColor:
|
||||
MaterialStateProperty.resolveWith((states) => colorScheme.secondary),
|
||||
trackColor: MaterialStateProperty.resolveWith(
|
||||
WidgetStateProperty.resolveWith((states) => colorScheme.secondary),
|
||||
trackColor: WidgetStateProperty.resolveWith(
|
||||
(states) => colorScheme.secondaryContainer),
|
||||
),
|
||||
dialogTheme: base.dialogTheme.copyWith(
|
||||
|
||||
@@ -41,6 +41,14 @@ class UploadResponse {
|
||||
|
||||
Future<CroppedFile?> _pickAndCrop(BuildContext context) async {
|
||||
final theme = Theme.of(context);
|
||||
final colorScheme = theme.colorScheme;
|
||||
final settings = [
|
||||
AndroidUiSettings(
|
||||
backgroundColor: theme.scaffoldBackgroundColor,
|
||||
toolbarWidgetColor: colorScheme.secondary,
|
||||
),
|
||||
WebUiSettings(context: context),
|
||||
];
|
||||
final res = await FlutterFileDialog.pickFile(
|
||||
params: const OpenFileDialogParams(
|
||||
dialogType: OpenFileDialogType.image,
|
||||
@@ -48,21 +56,16 @@ Future<CroppedFile?> _pickAndCrop(BuildContext context) async {
|
||||
mimeTypesFilter: ['image/*'],
|
||||
),
|
||||
);
|
||||
|
||||
if (res == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
final colorScheme = theme.colorScheme;
|
||||
final cropped = await ImageCropper().cropImage(
|
||||
sourcePath: res,
|
||||
aspectRatio: const CropAspectRatio(ratioX: 1, ratioY: 1),
|
||||
uiSettings: [
|
||||
AndroidUiSettings(
|
||||
backgroundColor: theme.scaffoldBackgroundColor,
|
||||
toolbarWidgetColor: colorScheme.secondary,
|
||||
),
|
||||
],
|
||||
compressQuality: 100,
|
||||
compressFormat: ImageCompressFormat.png,
|
||||
uiSettings: settings,
|
||||
);
|
||||
|
||||
return cropped;
|
||||
|
||||
Reference in New Issue
Block a user