mirror of
https://gitlab.com/famedly/fluffychat.git
synced 2024-11-27 23:09:35 +01:00
fix: Minor desktop fixes
This commit is contained in:
parent
bb537141d7
commit
c224993548
@ -12,19 +12,21 @@ class Avatar extends StatelessWidget {
|
|||||||
final double size;
|
final double size;
|
||||||
final Function onTap;
|
final Function onTap;
|
||||||
static const double defaultSize = 44;
|
static const double defaultSize = 44;
|
||||||
|
final Client client;
|
||||||
|
|
||||||
const Avatar(
|
const Avatar(
|
||||||
this.mxContent,
|
this.mxContent,
|
||||||
this.name, {
|
this.name, {
|
||||||
this.size = defaultSize,
|
this.size = defaultSize,
|
||||||
this.onTap,
|
this.onTap,
|
||||||
|
this.client,
|
||||||
Key key,
|
Key key,
|
||||||
}) : super(key: key);
|
}) : super(key: key);
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
var thumbnail = mxContent?.getThumbnail(
|
var thumbnail = mxContent?.getThumbnail(
|
||||||
Matrix.of(context).client,
|
client ?? Matrix.of(context).client,
|
||||||
width: size * MediaQuery.of(context).devicePixelRatio,
|
width: size * MediaQuery.of(context).devicePixelRatio,
|
||||||
height: size * MediaQuery.of(context).devicePixelRatio,
|
height: size * MediaQuery.of(context).devicePixelRatio,
|
||||||
);
|
);
|
||||||
|
@ -11,12 +11,14 @@ class ContentBanner extends StatelessWidget {
|
|||||||
final IconData defaultIcon;
|
final IconData defaultIcon;
|
||||||
final bool loading;
|
final bool loading;
|
||||||
final Function onEdit;
|
final Function onEdit;
|
||||||
|
final Client client;
|
||||||
|
|
||||||
const ContentBanner(this.mxContent,
|
const ContentBanner(this.mxContent,
|
||||||
{this.height = 400,
|
{this.height = 400,
|
||||||
this.defaultIcon = Icons.people_outline,
|
this.defaultIcon = Icons.people_outline,
|
||||||
this.loading = false,
|
this.loading = false,
|
||||||
this.onEdit,
|
this.onEdit,
|
||||||
|
this.client,
|
||||||
Key key})
|
Key key})
|
||||||
: super(key: key);
|
: super(key: key);
|
||||||
|
|
||||||
@ -26,7 +28,7 @@ class ContentBanner extends StatelessWidget {
|
|||||||
final bannerSize =
|
final bannerSize =
|
||||||
(mediaQuery.size.width * mediaQuery.devicePixelRatio).toInt();
|
(mediaQuery.size.width * mediaQuery.devicePixelRatio).toInt();
|
||||||
final src = mxContent?.getThumbnail(
|
final src = mxContent?.getThumbnail(
|
||||||
Matrix.of(context).client,
|
client ?? Matrix.of(context).client,
|
||||||
width: bannerSize,
|
width: bannerSize,
|
||||||
height: bannerSize,
|
height: bannerSize,
|
||||||
method: ThumbnailMethod.scale,
|
method: ThumbnailMethod.scale,
|
||||||
|
@ -4,6 +4,7 @@ import 'package:famedlysdk/famedlysdk.dart';
|
|||||||
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
import 'package:flutter_typeahead/flutter_typeahead.dart';
|
||||||
import 'package:cached_network_image/cached_network_image.dart';
|
import 'package:cached_network_image/cached_network_image.dart';
|
||||||
import 'avatar.dart';
|
import 'avatar.dart';
|
||||||
|
import 'matrix.dart';
|
||||||
|
|
||||||
class InputBar extends StatelessWidget {
|
class InputBar extends StatelessWidget {
|
||||||
final Room room;
|
final Room room;
|
||||||
@ -138,7 +139,11 @@ class InputBar extends StatelessWidget {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Widget buildSuggestion(BuildContext context, Map<String, String> suggestion) {
|
Widget buildSuggestion(
|
||||||
|
BuildContext context,
|
||||||
|
Map<String, String> suggestion,
|
||||||
|
Client client,
|
||||||
|
) {
|
||||||
if (suggestion['type'] == 'emote') {
|
if (suggestion['type'] == 'emote') {
|
||||||
final size = 30.0;
|
final size = 30.0;
|
||||||
final ratio = MediaQuery.of(context).devicePixelRatio;
|
final ratio = MediaQuery.of(context).devicePixelRatio;
|
||||||
@ -182,8 +187,12 @@ class InputBar extends StatelessWidget {
|
|||||||
child: Row(
|
child: Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Avatar(url, suggestion['displayname'] ?? suggestion['mxid'],
|
Avatar(
|
||||||
size: size),
|
url,
|
||||||
|
suggestion['displayname'] ?? suggestion['mxid'],
|
||||||
|
size: size,
|
||||||
|
client: client,
|
||||||
|
),
|
||||||
SizedBox(width: 6),
|
SizedBox(width: 6),
|
||||||
Text(suggestion['displayname'] ?? suggestion['mxid']),
|
Text(suggestion['displayname'] ?? suggestion['mxid']),
|
||||||
],
|
],
|
||||||
@ -283,7 +292,7 @@ class InputBar extends StatelessWidget {
|
|||||||
textCapitalization: TextCapitalization.sentences,
|
textCapitalization: TextCapitalization.sentences,
|
||||||
),
|
),
|
||||||
suggestionsCallback: getSuggestions,
|
suggestionsCallback: getSuggestions,
|
||||||
itemBuilder: buildSuggestion,
|
itemBuilder: (c, s) => buildSuggestion(c, s, Matrix.of(context).client),
|
||||||
onSuggestionSelected: (Map<String, String> suggestion) =>
|
onSuggestionSelected: (Map<String, String> suggestion) =>
|
||||||
insertSuggestion(context, suggestion),
|
insertSuggestion(context, suggestion),
|
||||||
errorBuilder: (BuildContext context, Object error) => Container(),
|
errorBuilder: (BuildContext context, Object error) => Container(),
|
||||||
|
@ -310,7 +310,7 @@ class MatrixState extends State<Matrix> {
|
|||||||
final Set verificationMethods = <KeyVerificationMethod>{
|
final Set verificationMethods = <KeyVerificationMethod>{
|
||||||
KeyVerificationMethod.numbers
|
KeyVerificationMethod.numbers
|
||||||
};
|
};
|
||||||
if (PlatformInfos.isMobile) {
|
if (PlatformInfos.isMobile || (!kIsWeb && Platform.isLinux)) {
|
||||||
// emojis don't show in web somehow
|
// emojis don't show in web somehow
|
||||||
verificationMethods.add(KeyVerificationMethod.emoji);
|
verificationMethods.add(KeyVerificationMethod.emoji);
|
||||||
}
|
}
|
||||||
|
@ -208,6 +208,7 @@ class UserBottomSheet extends StatelessWidget {
|
|||||||
child: ContentBanner(
|
child: ContentBanner(
|
||||||
user.avatarUrl,
|
user.avatarUrl,
|
||||||
defaultIcon: Icons.person_outline,
|
defaultIcon: Icons.person_outline,
|
||||||
|
client: user.room.client,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
|
Loading…
Reference in New Issue
Block a user