(Web) Hide scrollbar in viewer

This commit is contained in:
Ming Ming 2022-01-22 02:50:33 +08:00
parent afaf432ab0
commit ef41e4516c

View file

@ -226,50 +226,54 @@ class _ViewerState extends State<Viewer>
widthFactor: 1 / _viewportFraction, widthFactor: 1 / _viewportFraction,
child: NotificationListener<ScrollNotification>( child: NotificationListener<ScrollNotification>(
onNotification: (notif) => _onPageContentScrolled(notif, index), onNotification: (notif) => _onPageContentScrolled(notif, index),
child: SingleChildScrollView( child: ScrollConfiguration(
controller: _pageStates[index]!.scrollController, behavior: ScrollConfiguration.of(context).copyWith(scrollbars: false),
physics: !_isZoomed ? null : const NeverScrollableScrollPhysics(), child: SingleChildScrollView(
child: Stack( controller: _pageStates[index]!.scrollController,
children: [ physics: !_isZoomed ? null : const NeverScrollableScrollPhysics(),
_buildItemView(context, index), child: Stack(
Visibility( children: [
visible: !_isZoomed, _buildItemView(context, index),
child: AnimatedOpacity( Visibility(
opacity: _isShowDetailPane ? 1 : 0, visible: !_isZoomed,
duration: k.animationDurationNormal, child: AnimatedOpacity(
onEnd: () { opacity: _isShowDetailPane ? 1 : 0,
if (!_isShowDetailPane) { duration: k.animationDurationNormal,
setState(() { onEnd: () {
_isDetailPaneActive = false; if (!_isShowDetailPane) {
}); setState(() {
} _isDetailPaneActive = false;
}, });
child: Container( }
alignment: Alignment.topLeft, },
constraints: BoxConstraints( child: Container(
minHeight: MediaQuery.of(context).size.height), alignment: Alignment.topLeft,
decoration: BoxDecoration( constraints: BoxConstraints(
color: Theme.of(context).scaffoldBackgroundColor, minHeight: MediaQuery.of(context).size.height),
borderRadius: decoration: BoxDecoration(
const BorderRadius.vertical(top: Radius.circular(4)), color: Theme.of(context).scaffoldBackgroundColor,
), borderRadius: const BorderRadius.vertical(
margin: EdgeInsets.only(top: _calcDetailPaneOffset(index)), top: Radius.circular(4)),
// this visibility widget avoids loading the detail pane ),
// until it's actually opened, otherwise swiping between margin:
// photos will slow down severely EdgeInsets.only(top: _calcDetailPaneOffset(index)),
child: Visibility( // this visibility widget avoids loading the detail pane
visible: _isShowDetailPane, // until it's actually opened, otherwise swiping between
child: ViewerDetailPane( // photos will slow down severely
account: widget.account, child: Visibility(
file: widget.streamFiles[index], visible: _isShowDetailPane,
album: widget.album, child: ViewerDetailPane(
onSlideshowPressed: _onSlideshowPressed, account: widget.account,
file: widget.streamFiles[index],
album: widget.album,
onSlideshowPressed: _onSlideshowPressed,
),
), ),
), ),
), ),
), ),
), ],
], ),
), ),
), ),
), ),