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:
parent
6281c1d13a
commit
d2ec5f035b
67 changed files with 391 additions and 534 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue