implemented support for viewing large group profile pictures
This commit is contained in:
@@ -1,20 +1,36 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
|
||||
import '../model/account_data.dart';
|
||||
import '../model/endpoint_data.dart';
|
||||
|
||||
class LargeProfilePictureView extends StatelessWidget {
|
||||
final String username;
|
||||
const LargeProfilePictureView(this.username, {super.key});
|
||||
final String id;
|
||||
final bool isGroup;
|
||||
|
||||
const LargeProfilePictureView({
|
||||
required this.id,
|
||||
this.isGroup = false,
|
||||
super.key,
|
||||
});
|
||||
|
||||
String _imageUrl() {
|
||||
final host = EndpointData().nextcloud().full();
|
||||
if (isGroup) {
|
||||
return 'https://$host/ocs/v2.php/apps/spreed/api/v1/room/$id/avatar';
|
||||
}
|
||||
return 'https://$host/avatar/$id/1024';
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) => Scaffold(
|
||||
appBar: AppBar(title: const Text('Profilbild')),
|
||||
appBar: AppBar(title: Text(isGroup ? 'Gruppenbild' : 'Profilbild')),
|
||||
body: PhotoView(
|
||||
minScale: 0.5,
|
||||
maxScale: 3.0,
|
||||
imageProvider: Image.network(
|
||||
'https://${EndpointData().nextcloud().full()}/avatar/$username/1024',
|
||||
_imageUrl(),
|
||||
headers: {'Authorization': AccountData().getBasicAuthHeader()},
|
||||
).image,
|
||||
backgroundDecoration: BoxDecoration(
|
||||
color: Theme.of(context).colorScheme.surface,
|
||||
|
||||
Reference in New Issue
Block a user