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:
parent
6281c1d13a
commit
d2ec5f035b
67 changed files with 391 additions and 534 deletions
|
|
@ -11,20 +11,20 @@ class CodeBlock extends StatelessWidget {
|
|||
Widget build(BuildContext context) {
|
||||
final theme = Theme.of(context);
|
||||
return ClipRRect(
|
||||
borderRadius: BorderRadius.all(Radius.circular(16)),
|
||||
borderRadius: .all(.circular(16)),
|
||||
child: ColoredBox(
|
||||
color: theme.colorScheme.surfaceContainerHighest,
|
||||
child: IntrinsicWidth(
|
||||
child: Column(
|
||||
children: [
|
||||
Row(
|
||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||
mainAxisAlignment: .spaceBetween,
|
||||
children: [
|
||||
Padding(
|
||||
padding: EdgeInsets.symmetric(horizontal: 8),
|
||||
padding: .symmetric(horizontal: 8),
|
||||
child: Text(
|
||||
lang.substring(0, min(lang.length, 15)),
|
||||
style: TextStyle(fontFamily: "monospace"),
|
||||
style: .new(fontFamily: "monospace"),
|
||||
),
|
||||
),
|
||||
TextButton.icon(
|
||||
|
|
@ -37,13 +37,13 @@ class CodeBlock extends StatelessWidget {
|
|||
ColoredBox(
|
||||
color: theme.colorScheme.surfaceContainerHigh,
|
||||
child: Container(
|
||||
constraints: BoxConstraints(minWidth: 250),
|
||||
padding: EdgeInsets.all(8),
|
||||
constraints: .new(minWidth: 250),
|
||||
padding: .all(8),
|
||||
child: SelectableText(
|
||||
code,
|
||||
minLines: 1,
|
||||
maxLines: 99,
|
||||
style: TextStyle(fontFamily: "monospace"),
|
||||
style: .new(fontFamily: "monospace"),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -86,9 +86,7 @@ class Html extends ConsumerWidget {
|
|||
),
|
||||
errorBuilder: (_, error, _) => Text(
|
||||
"Image Failed to Load",
|
||||
style: TextStyle(
|
||||
color: Theme.of(context).colorScheme.error,
|
||||
),
|
||||
style: .new(color: Theme.of(context).colorScheme.error),
|
||||
),
|
||||
height: height.toDouble(),
|
||||
width: width?.toDouble(),
|
||||
|
|
@ -146,15 +144,14 @@ class Html extends ConsumerWidget {
|
|||
element.attributes
|
||||
.mapTo<MapEntry<String, String>?>(
|
||||
(key, value) => switch (key) {
|
||||
"data-mx-color" => MapEntry("color", value),
|
||||
"data-mx-bg-color" => MapEntry("background-color", value),
|
||||
"data-mx-color" => .new("color", value),
|
||||
"data-mx-bg-color" => .new("background-color", value),
|
||||
_ => null,
|
||||
},
|
||||
)
|
||||
.nonNulls,
|
||||
),
|
||||
},
|
||||
onTapUrl: (url) =>
|
||||
ref.watch(LaunchHelper.provider).launchUrl(Uri.parse(url)),
|
||||
onTapUrl: (url) => ref.watch(LaunchHelper.provider).launchUrl(.parse(url)),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import "package:flutter_riverpod/flutter_riverpod.dart";
|
|||
import "package:nexus/controllers/user_controller.dart";
|
||||
import "package:nexus/helpers/extensions/link_to_mention.dart";
|
||||
import "package:nexus/helpers/extensions/show_user_popover.dart";
|
||||
import "package:nexus/models/configs/user_config.dart";
|
||||
|
||||
class MentionChip extends ConsumerWidget {
|
||||
final String? roomId;
|
||||
|
|
@ -16,9 +15,7 @@ class MentionChip extends ConsumerWidget {
|
|||
final membership = mention?.startsWith("@") == true
|
||||
? ref
|
||||
.watch(
|
||||
UserController.provider(
|
||||
UserConfig(roomId: roomId, userId: mention!),
|
||||
),
|
||||
UserController.provider(.new(roomId: roomId, userId: mention!)),
|
||||
)
|
||||
.whenOrNull(data: (data) => data)
|
||||
: null;
|
||||
|
|
@ -41,8 +38,8 @@ class MentionChip extends ConsumerWidget {
|
|||
label: Text(
|
||||
(membership == null ? null : "@${membership.displayName}") ??
|
||||
mention,
|
||||
style: TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
style: .new(
|
||||
fontWeight: .bold,
|
||||
color: Theme.of(context).colorScheme.onPrimary,
|
||||
),
|
||||
),
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@ class Quoted extends StatelessWidget {
|
|||
Widget build(BuildContext context) => Container(
|
||||
decoration: BoxDecoration(
|
||||
border: Border(
|
||||
left: BorderSide(width: 4, color: Theme.of(context).dividerColor),
|
||||
left: .new(width: 4, color: Theme.of(context).dividerColor),
|
||||
),
|
||||
),
|
||||
child: Padding(padding: EdgeInsets.only(left: 8), child: child),
|
||||
child: Padding(padding: .only(left: 8), child: child),
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,15 +13,15 @@ class SpoilerText extends HookWidget {
|
|||
return InkWell(
|
||||
onTap: () => revealed.value = !revealed.value,
|
||||
child: AnimatedContainer(
|
||||
duration: const Duration(milliseconds: 100),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 4, vertical: 2),
|
||||
duration: const .new(milliseconds: 100),
|
||||
padding: const .symmetric(horizontal: 4, vertical: 2),
|
||||
decoration: BoxDecoration(
|
||||
color: revealed.value ? Colors.transparent : Colors.blueGrey,
|
||||
borderRadius: BorderRadius.circular(4),
|
||||
borderRadius: .circular(4),
|
||||
),
|
||||
child: Text(
|
||||
text,
|
||||
style: TextStyle(color: revealed.value ? null : Colors.transparent),
|
||||
style: .new(color: revealed.value ? null : Colors.transparent),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue