fix: Minor desktop fixes

This commit is contained in:
Christian Pauly 2021-01-20 20:27:09 +01:00
parent bb537141d7
commit c224993548
5 changed files with 21 additions and 7 deletions

View File

@ -12,19 +12,21 @@ class Avatar extends StatelessWidget {
final double size;
final Function onTap;
static const double defaultSize = 44;
final Client client;
const Avatar(
this.mxContent,
this.name, {
this.size = defaultSize,
this.onTap,
this.client,
Key key,
}) : super(key: key);
@override
Widget build(BuildContext context) {
var thumbnail = mxContent?.getThumbnail(
Matrix.of(context).client,
client ?? Matrix.of(context).client,
width: size * MediaQuery.of(context).devicePixelRatio,
height: size * MediaQuery.of(context).devicePixelRatio,
);

View File

@ -11,12 +11,14 @@ class ContentBanner extends StatelessWidget {
final IconData defaultIcon;
final bool loading;
final Function onEdit;
final Client client;
const ContentBanner(this.mxContent,
{this.height = 400,
this.defaultIcon = Icons.people_outline,
this.loading = false,
this.onEdit,
this.client,
Key key})
: super(key: key);
@ -26,7 +28,7 @@ class ContentBanner extends StatelessWidget {
final bannerSize =
(mediaQuery.size.width * mediaQuery.devicePixelRatio).toInt();
final src = mxContent?.getThumbnail(
Matrix.of(context).client,
client ?? Matrix.of(context).client,
width: bannerSize,
height: bannerSize,
method: ThumbnailMethod.scale,

View File

@ -4,6 +4,7 @@ import 'package:famedlysdk/famedlysdk.dart';
import 'package:flutter_typeahead/flutter_typeahead.dart';
import 'package:cached_network_image/cached_network_image.dart';
import 'avatar.dart';
import 'matrix.dart';
class InputBar extends StatelessWidget {
final Room room;
@ -138,7 +139,11 @@ class InputBar extends StatelessWidget {
return ret;
}
Widget buildSuggestion(BuildContext context, Map<String, String> suggestion) {
Widget buildSuggestion(
BuildContext context,
Map<String, String> suggestion,
Client client,
) {
if (suggestion['type'] == 'emote') {
final size = 30.0;
final ratio = MediaQuery.of(context).devicePixelRatio;
@ -182,8 +187,12 @@ class InputBar extends StatelessWidget {
child: Row(
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
Avatar(url, suggestion['displayname'] ?? suggestion['mxid'],
size: size),
Avatar(
url,
suggestion['displayname'] ?? suggestion['mxid'],
size: size,
client: client,
),
SizedBox(width: 6),
Text(suggestion['displayname'] ?? suggestion['mxid']),
],
@ -283,7 +292,7 @@ class InputBar extends StatelessWidget {
textCapitalization: TextCapitalization.sentences,
),
suggestionsCallback: getSuggestions,
itemBuilder: buildSuggestion,
itemBuilder: (c, s) => buildSuggestion(c, s, Matrix.of(context).client),
onSuggestionSelected: (Map<String, String> suggestion) =>
insertSuggestion(context, suggestion),
errorBuilder: (BuildContext context, Object error) => Container(),

View File

@ -310,7 +310,7 @@ class MatrixState extends State<Matrix> {
final Set verificationMethods = <KeyVerificationMethod>{
KeyVerificationMethod.numbers
};
if (PlatformInfos.isMobile) {
if (PlatformInfos.isMobile || (!kIsWeb && Platform.isLinux)) {
// emojis don't show in web somehow
verificationMethods.add(KeyVerificationMethod.emoji);
}

View File

@ -208,6 +208,7 @@ class UserBottomSheet extends StatelessWidget {
child: ContentBanner(
user.avatarUrl,
defaultIcon: Icons.person_outline,
client: user.room.client,
),
),
ListTile(