opt: pl_gallery layout

This commit is contained in:
guozhigq
2024-11-25 22:39:04 +08:00
parent 747ed377b5
commit 0ae6238d0e

View File

@ -234,17 +234,17 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return InteractiveViewerBoundary( return Stack(children: [
controller: _transformationController, InteractiveViewerBoundary(
boundaryWidth: MediaQuery.of(context).size.width, controller: _transformationController,
onScaleChanged: _onScaleChanged, boundaryWidth: MediaQuery.of(context).size.width,
onLeftBoundaryHit: _onLeftBoundaryHit, onScaleChanged: _onScaleChanged,
onRightBoundaryHit: _onRightBoundaryHit, onLeftBoundaryHit: _onLeftBoundaryHit,
onNoBoundaryHit: _onNoBoundaryHit, onRightBoundaryHit: _onRightBoundaryHit,
maxScale: widget.maxScale, onNoBoundaryHit: _onNoBoundaryHit,
minScale: widget.minScale, maxScale: widget.maxScale,
child: Stack(children: [ minScale: widget.minScale,
CustomDismissible( child: CustomDismissible(
onDismissed: () { onDismissed: () {
Navigator.of(context).pop(); Navigator.of(context).pop();
widget.onDismissed?.call(_pageController!.page!.floor()); widget.onDismissed?.call(_pageController!.page!.floor());
@ -275,53 +275,50 @@ class _InteractiveviewerGalleryState extends State<InteractiveviewerGallery>
}, },
), ),
), ),
Positioned( ),
bottom: 0, Positioned(
left: 0, bottom: 0,
right: 0, left: 0,
child: Container( right: 0,
padding: EdgeInsets.fromLTRB( child: Container(
12, 8, 20, MediaQuery.of(context).padding.bottom + 8), padding: EdgeInsets.fromLTRB(
decoration: _enablePageView 12, 8, 20, MediaQuery.of(context).padding.bottom + 8),
? BoxDecoration( decoration: _enablePageView
gradient: LinearGradient( ? BoxDecoration(
begin: Alignment.topCenter, gradient: LinearGradient(
end: Alignment.bottomCenter, begin: Alignment.topCenter,
colors: [ end: Alignment.bottomCenter,
Colors.transparent, colors: [Colors.transparent, Colors.black.withOpacity(0.3)],
Colors.black.withOpacity(0.3) ),
], )
), : null,
) child: Row(
: null, mainAxisAlignment: MainAxisAlignment.spaceBetween,
child: Row( children: [
mainAxisAlignment: MainAxisAlignment.spaceBetween, IconButton(
children: [ icon: const Icon(Icons.close, color: Colors.white),
IconButton( onPressed: () {
icon: const Icon(Icons.close, color: Colors.white), Navigator.of(context).pop();
onPressed: () { widget.onDismissed?.call(_pageController!.page!.floor());
Navigator.of(context).pop(); },
widget.onDismissed?.call(_pageController!.page!.floor()); ),
}, widget.sources.length > 1
), ? Text(
widget.sources.length > 1 "${currentIndex! + 1}/${widget.sources.length}",
? Text( style: const TextStyle(color: Colors.white),
"${currentIndex! + 1}/${widget.sources.length}", )
style: const TextStyle(color: Colors.white), : const SizedBox(),
) PopupMenuButton(
: const SizedBox(), itemBuilder: (context) {
PopupMenuButton( return _buildPopupMenuList();
itemBuilder: (context) { },
return _buildPopupMenuList(); child: const Icon(Icons.more_horiz, color: Colors.white),
}, ),
child: const Icon(Icons.more_horiz, color: Colors.white), ],
),
],
),
), ),
), ),
]), ),
); ]);
} }
// 图片分享 // 图片分享