9dfa06ffee
Docker image / Build (linux/amd64) (push) Has been cancelled
Docker image / Build (linux/arm64) (push) Has been cancelled
Docker image / Merge release multi-arch manifest (push) Has been cancelled
Docker image / Merge debug multi-arch manifest (push) Has been cancelled
Docker image / Build public push gateway (linux/amd64) (push) Has been cancelled
Docker image / Build public push gateway (linux/arm64) (push) Has been cancelled
Docker image / Publish public push gateway image (push) Has been cancelled
Sprig image / Build (linux/amd64) (push) Has been cancelled
Sprig image / Build (linux/arm64) (push) Has been cancelled
Sprig image / Merge multi-arch manifest (push) Has been cancelled
Harbor Buzz Orchestra / Python tests and lint (push) Has been cancelled
CI / Detect Changed Paths (push) Has been cancelled
CI / Rust Lint (push) Has been cancelled
CI / Unit Tests (push) Has been cancelled
CI / Desktop Core (push) Has been cancelled
CI / Desktop Smoke E2E (1) (push) Has been cancelled
CI / Desktop Smoke E2E (2) (push) Has been cancelled
CI / Desktop Smoke E2E (3) (push) Has been cancelled
CI / Desktop Smoke E2E (4) (push) Has been cancelled
CI / Desktop (push) Has been cancelled
CI / Desktop E2E Relay (push) Has been cancelled
CI / Desktop E2E Integration (1/2) (push) Has been cancelled
CI / Desktop E2E Integration (2/2) (push) Has been cancelled
CI / Desktop E2E Integration (push) Has been cancelled
CI / Backend Integration (relay e2e) (push) Has been cancelled
CI / Relay E2E (push) Has been cancelled
CI / Web (push) Has been cancelled
CI / Mobile (push) Has been cancelled
CI / Security (push) Has been cancelled
CI / Dead Token Reference Guard (push) Has been cancelled
CI / Server Cross-Compile (aarch64-unknown-linux-musl) (push) Has been cancelled
CI / Server Cross-Compile (x86_64-unknown-linux-musl) (push) Has been cancelled
CI / Windows Rust (x86_64-pc-windows-msvc) (push) Has been cancelled
CI / Desktop Build (macOS) (push) Has been cancelled
helm chart / lint + unittest + render matrix (push) Has been cancelled
helm chart / install on kind (gated) (push) Has been cancelled
helm chart / publish chart to GHCR (push) Has been cancelled
Mesh Lifecycle / Relay-Driven Mesh Lifecycle Smoke (push) Has been cancelled
Sprig / Build (aarch64-unknown-linux-musl) (push) Has been cancelled
Sprig / Build (x86_64-unknown-linux-musl) (push) Has been cancelled
Sprig / Publish rolling release (push) Has been cancelled
Sprig / Publish tagged release (push) Has been cancelled
Signed-off-by: cls_宁波本机 <908705107@qq.com>
138 lines
4.0 KiB
Dart
138 lines
4.0 KiB
Dart
part of '../channels_page.dart';
|
|
|
|
class _ChannelsSkeleton extends StatelessWidget {
|
|
final List<Channel>? channels;
|
|
final double topInset;
|
|
final SessionStatus status;
|
|
|
|
const _ChannelsSkeleton({
|
|
required this.channels,
|
|
required this.topInset,
|
|
required this.status,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final visibleChannels =
|
|
channels
|
|
?.where((channel) => channel.isMember && !channel.isArchived)
|
|
.take(8)
|
|
.toList() ??
|
|
const <Channel>[];
|
|
final widths = visibleChannels
|
|
.map(
|
|
(channel) => min(
|
|
240,
|
|
max(
|
|
88,
|
|
24 +
|
|
(resolveDmChannelDisplayLabel(
|
|
channel,
|
|
currentPubkey: null,
|
|
).length *
|
|
8),
|
|
),
|
|
).toDouble(),
|
|
)
|
|
.toList();
|
|
const fallbackWidths = <double>[136, 184, 112, 160, 208, 128];
|
|
while (widths.length < 6) {
|
|
widths.add(fallbackWidths[widths.length % fallbackWidths.length]);
|
|
}
|
|
final splitAt = min(4, widths.length);
|
|
final firstSection = widths.take(splitAt).toList();
|
|
final secondSection = widths.skip(splitAt).toList();
|
|
|
|
final semanticsLabel = switch (status) {
|
|
SessionStatus.connecting => context.l10n.connecting,
|
|
SessionStatus.reconnecting => context.l10n.reconnecting,
|
|
SessionStatus.connected || SessionStatus.disconnected =>
|
|
context.l10n.loading,
|
|
};
|
|
return Semantics(
|
|
key: const Key('channels-connection-skeleton'),
|
|
liveRegion: true,
|
|
label: semanticsLabel,
|
|
child: ExcludeSemantics(
|
|
child: ListView(
|
|
physics: const NeverScrollableScrollPhysics(),
|
|
padding: EdgeInsets.fromLTRB(
|
|
Grid.gutter,
|
|
topInset + Grid.twelve,
|
|
Grid.gutter,
|
|
80,
|
|
),
|
|
children: [
|
|
_ChannelSkeletonSection(widths: firstSection),
|
|
const SizedBox(height: Grid.xs),
|
|
_ChannelSkeletonSection(widths: secondSection),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
|
|
class _ChannelSkeletonSection extends StatelessWidget {
|
|
final List<double> widths;
|
|
|
|
const _ChannelSkeletonSection({required this.widths});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
children: [
|
|
const Padding(
|
|
padding: EdgeInsets.symmetric(vertical: Grid.half),
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
width: _kChannelLeadingWidth,
|
|
child: Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: SkeletonBar(width: 18, height: 18),
|
|
),
|
|
),
|
|
SizedBox(width: Grid.xxs),
|
|
SkeletonBar(
|
|
key: Key('channels-skeleton-section-label'),
|
|
width: 88,
|
|
height: 16,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
for (var index = 0; index < widths.length; index++)
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(
|
|
vertical: _kChannelRowVerticalPadding,
|
|
),
|
|
child: Row(
|
|
children: [
|
|
SizedBox(
|
|
width: _kChannelLeadingWidth,
|
|
child: Align(
|
|
alignment: Alignment.centerLeft,
|
|
child: SkeletonBar(
|
|
width: _kChannelIconSize,
|
|
height: _kChannelIconSize,
|
|
borderRadius: BorderRadius.circular(
|
|
index.isEven ? Radii.xs : Radii.full,
|
|
),
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(width: _kChannelLabelGap),
|
|
SkeletonBar(
|
|
key: Key('channels-skeleton-row-label-$index'),
|
|
width: widths[index],
|
|
height: 16,
|
|
),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|