refactored HTTP error handling and streamlined UI components by centralizing shared logic and removing redundant parameters

This commit is contained in:
2026-07-13 22:58:02 +02:00
parent d7536ea5d0
commit 8274dd46cd
28 changed files with 284 additions and 447 deletions
+24 -37
View File
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.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
@@ -13,44 +14,30 @@ import 'file_pick.dart';
/// cancelled everything.
Future<Uint8List?> showChatBackgroundPickerSheet(BuildContext context) async {
Uint8List? result;
await showModalBottomSheet<void>(
context: context,
isScrollControlled: true,
showDragHandle: true,
useSafeArea: true,
builder: (sheetContext) => SafeArea(
child: SingleChildScrollView(
padding: EdgeInsets.only(
bottom: 16 + MediaQuery.viewInsetsOf(sheetContext).bottom,
),
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
ListTile(
leading: const Icon(Icons.photo_library_outlined),
title: const Text('Aus Galerie wählen'),
onTap: () async {
final bytes = await _pickRaw(FilePick.singleGalleryPick);
if (bytes == null || !sheetContext.mounted) return;
result = bytes;
Navigator.of(sheetContext).pop();
},
),
ListTile(
leading: const Icon(Icons.photo_camera_outlined),
title: const Text('Foto aufnehmen'),
onTap: () async {
final bytes = await _pickRaw(FilePick.cameraPick);
if (bytes == null || !sheetContext.mounted) return;
result = bytes;
Navigator.of(sheetContext).pop();
},
),
],
),
await showDetailsBottomSheet(
context,
children: (sheetContext) => [
ListTile(
leading: const Icon(Icons.photo_library_outlined),
title: const Text('Aus Galerie wählen'),
onTap: () async {
final bytes = await _pickRaw(FilePick.singleGalleryPick);
if (bytes == null || !sheetContext.mounted) return;
result = bytes;
Navigator.of(sheetContext).pop();
},
),
),
ListTile(
leading: const Icon(Icons.photo_camera_outlined),
title: const Text('Foto aufnehmen'),
onTap: () async {
final bytes = await _pickRaw(FilePick.cameraPick);
if (bytes == null || !sheetContext.mounted) return;
result = bytes;
Navigator.of(sheetContext).pop();
},
),
],
);
return result;
}