1
0
Fork 0
forked from Nexus/nexus

treewide: use dot shorthands where possible

Now this feature is stable, we should use it. I might have missed some usecases, but these can be added in future commits.
This commit is contained in:
Henry Hiles 2026-06-02 11:53:14 -04:00
commit d2ec5f035b
Signed by: Henry-Hiles
SSH key fingerprint: SHA256:VKQUdS31Q90KvX7EkKMHMBpUspcmItAh86a+v7PGiIs
67 changed files with 391 additions and 534 deletions

View file

@ -7,8 +7,8 @@ import "package:nexus/src/third_party/gomuks.g.dart";
extension GomuksOwnedBufferToX on GomuksOwnedBuffer {
Uint8List toBytes() {
try {
if (base == nullptr || length <= 0) return Uint8List(0);
return Uint8List.fromList(base.asTypedList(length));
if (base == nullptr || length <= 0) return .new(0);
return .fromList(base.asTypedList(length));
} finally {
calloc.free(base);
}

View file

@ -1,5 +1,4 @@
extension MxcToHttps on Uri {
Uri mxcToHttps(String homeserver) => Uri.parse(
homeserver,
).resolve("_matrix/client/v1/media/download/$host$path");
Uri mxcToHttps(String homeserver) =>
.parse(homeserver).resolve("_matrix/client/v1/media/download/$host$path");
}

View file

@ -1,16 +1,16 @@
import "package:flutter/material.dart";
extension SchemeToTheme on ColorScheme {
ThemeData get theme => ThemeData.from(colorScheme: this).copyWith(
cardTheme: CardThemeData(color: primaryContainer),
ThemeData get theme => .from(colorScheme: this).copyWith(
cardTheme: .new(color: primaryContainer),
popupMenuTheme: .new(
shape: RoundedRectangleBorder(borderRadius: .circular(16)),
color: surfaceContainerHigh,
),
appBarTheme: AppBarTheme(
titleSpacing: 0,
backgroundColor: surfaceContainerLow,
),
popupMenuTheme: PopupMenuThemeData(
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(16)),
color: surfaceContainerHigh,
),
textTheme: ThemeData(
fontFamilyFallback: ["sans", "emoji"],
brightness: brightness,

View file

@ -9,8 +9,8 @@ extension ShowContextMenu on BuildContext {
showMenu(
context: this,
constraints: BoxConstraints.loose(Size.infinite),
position: RelativeRect.fromLTRB(
constraints: .loose(Size.infinite),
position: .fromLTRB(
globalPosition.dx,
globalPosition.dy,
overlay.size.width - globalPosition.dx,

View file

@ -14,9 +14,9 @@ extension ShowUserPopover on BuildContext {
children: [
PopupMenuItem(
enabled: false,
padding: EdgeInsets.symmetric(horizontal: 16, vertical: 8),
padding: .symmetric(horizontal: 16, vertical: 8),
child: IconTheme(
data: IconThemeData(),
data: .new(),
child: UserPopover(member, userId, roomId: roomId),
),
),

View file

@ -2,14 +2,7 @@ import "package:fast_immutable_collections/fast_immutable_collections.dart";
extension SizeToString on int {
String get sizeAsString {
const IListConst<String> suffixes = IListConst([
"B",
"KB",
"MB",
"GB",
"TB",
"PB",
]);
const suffixes = IListConst(["B", "KB", "MB", "GB", "TB", "PB"]);
var i = 0;
var size = toDouble();

View file

@ -10,9 +10,7 @@ class LaunchHelper {
try {
return await ul.launchUrl(
url,
mode: useWebview
? ul.LaunchMode.inAppBrowserView
: ul.LaunchMode.externalApplication,
mode: useWebview ? .inAppBrowserView : .externalApplication,
);
} on PlatformException catch (_) {
return false;