🐛 Bug fixes

This commit is contained in:
LittleSheep 2025-01-21 15:04:55 +08:00
parent fbb486b90b
commit ed0334fcda
2 changed files with 76 additions and 83 deletions

View File

@ -196,72 +196,68 @@ class _AttachmentListState extends State<AttachmentList> {
); );
} }
return AspectRatio( return Container(
aspectRatio: widget.data.isNotEmpty ? widget.data.first?.data['ratio']?.toDouble() ?? 1 : 1, constraints: BoxConstraints(maxHeight: constraints.maxHeight),
child: Container( child: ScrollConfiguration(
constraints: constraints, behavior: _AttachmentListScrollBehavior(),
child: ScrollConfiguration( child: ListView.separated(
behavior: _AttachmentListScrollBehavior(), padding: widget.padding,
child: ListView.separated( shrinkWrap: true,
padding: widget.padding, itemCount: widget.data.length,
shrinkWrap: true, itemBuilder: (context, idx) {
itemCount: widget.data.length, return Container(
itemBuilder: (context, idx) { constraints: constraints.copyWith(maxWidth: widget.maxWidth),
return Container( child: AspectRatio(
constraints: constraints.copyWith(maxWidth: widget.maxWidth), aspectRatio: (widget.data[idx]?.data['ratio'] ?? 1).toDouble(),
child: AspectRatio( child: GestureDetector(
aspectRatio: (widget.data[idx]?.data['ratio'] ?? 1).toDouble(), onTap: () {
child: GestureDetector( if (widget.data[idx]?.mediaType != SnMediaType.image) return;
onTap: () { context.pushTransparentRoute(
if (widget.data[idx]?.mediaType != SnMediaType.image) return; AttachmentZoomView(
context.pushTransparentRoute( data: widget.data.where((ele) => ele != null && ele.mediaType == SnMediaType.image).cast(),
AttachmentZoomView( initialIndex: idx,
data: heroTags: heroTags,
widget.data.where((ele) => ele != null && ele.mediaType == SnMediaType.image).cast(), ),
initialIndex: idx, backgroundColor: Colors.black.withOpacity(0.7),
heroTags: heroTags, rootNavigator: true,
), );
backgroundColor: Colors.black.withOpacity(0.7), },
rootNavigator: true, child: Stack(
); fit: StackFit.expand,
}, children: [
child: Stack( Container(
fit: StackFit.expand, decoration: BoxDecoration(
children: [ color: backgroundColor,
Container( border: Border(
decoration: BoxDecoration( top: borderSide,
color: backgroundColor, bottom: borderSide,
border: Border(
top: borderSide,
bottom: borderSide,
),
borderRadius: AttachmentList.kDefaultRadius,
), ),
child: ClipRRect( borderRadius: AttachmentList.kDefaultRadius,
borderRadius: AttachmentList.kDefaultRadius, ),
child: AttachmentItem( child: ClipRRect(
data: widget.data[idx], borderRadius: AttachmentList.kDefaultRadius,
heroTag: heroTags[idx], child: AttachmentItem(
), data: widget.data[idx],
heroTag: heroTags[idx],
), ),
), ),
Positioned( ),
right: 8, Positioned(
bottom: 8, right: 8,
child: Chip( bottom: 8,
label: Text('${idx + 1}/${widget.data.length}'), child: Chip(
), label: Text('${idx + 1}/${widget.data.length}'),
), ),
], ),
), ],
), ),
), ),
); ),
}, );
separatorBuilder: (context, index) => const Gap(8), },
physics: const BouncingScrollPhysics(), separatorBuilder: (context, index) => const Gap(8),
scrollDirection: Axis.horizontal, physics: const BouncingScrollPhysics(),
), scrollDirection: Axis.horizontal,
), ),
), ),
); );

View File

@ -110,31 +110,28 @@ class AppRootScaffold extends StatelessWidget {
Column( Column(
children: [ children: [
if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS)) if (!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS))
Container( WindowTitleBarBox(
decoration: BoxDecoration( child: Container(
border: Border( decoration: BoxDecoration(
bottom: BorderSide( border: Border(
color: Theme.of(context).dividerColor, bottom: BorderSide(
width: 1 / devicePixelRatio, color: Theme.of(context).dividerColor,
width: 1 / devicePixelRatio,
),
), ),
), ),
), child: MoveWindow(
child: Row( child: Row(
crossAxisAlignment: CrossAxisAlignment.center, crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: Platform.isMacOS ? MainAxisAlignment.center : MainAxisAlignment.start, mainAxisAlignment: Platform.isMacOS ? MainAxisAlignment.center : MainAxisAlignment.start,
children: [ children: [
WindowTitleBarBox( Text(
child: MoveWindow(
child: Text(
'Solar Network', 'Solar Network',
style: GoogleFonts.spaceGrotesk(), style: GoogleFonts.spaceGrotesk(),
).padding(horizontal: 12, vertical: 5), ).padding(horizontal: 12, vertical: 5),
), if (!Platform.isMacOS)
), Row(
if (!Platform.isMacOS) mainAxisSize: MainAxisSize.min,
Expanded(
child: WindowTitleBarBox(
child: Row(
children: [ children: [
Expanded(child: MoveWindow()), Expanded(child: MoveWindow()),
Row( Row(
@ -146,9 +143,9 @@ class AppRootScaffold extends StatelessWidget {
), ),
], ],
), ),
), ],
), ),
], ),
), ),
), ),
Expanded(child: innerWidget), Expanded(child: innerWidget),