fix: mount StringsScope, keep list inline text, show FOB until scroll down

This commit is contained in:
randogoth 2026-10-11 10:28:54 +03:00
parent 9a11194f77
commit 65e693b9c6
6 changed files with 281 additions and 27 deletions

View file

@ -25,8 +25,10 @@ class ReaderScreen extends StatefulWidget {
class _ReaderScreenState extends State<ReaderScreen> {
final _scroll = ScrollController();
bool _barVisible = true;
bool _fobVisible = false;
/// Address bar and FOB share one visibility: on screen from the start,
/// hidden while the reader scrolls down, back on any upward scroll.
bool _chromeVisible = true;
bool _showBrokenText = false;
final _reportedNewPosts = <String>{};
final _checkedSubscriptions = <String>{};
@ -48,20 +50,13 @@ class _ReaderScreenState extends State<ReaderScreen> {
if (!_scroll.hasClients) return;
final position = _scroll.position;
// The bar hides when the reader scrolls down and comes back on any
// upward scroll; it is always visible at the top of the page.
final wantBar = position.pixels <= 0 ||
// The bar and FOB hide when the reader scrolls down and come back on any
// upward scroll; both are always visible at the top of the page.
final wantVisible = position.pixels <= 0 ||
position.userScrollDirection == ScrollDirection.forward;
// The FOB appears once the page is scrolled, and stays reachable on pages
// that fit without scrolling.
final contentScrolls = position.maxScrollExtent > 0;
final wantFob = contentScrolls ? position.pixels > 16 : true;
if (wantBar != _barVisible || wantFob != _fobVisible) {
setState(() {
_barVisible = wantBar;
_fobVisible = wantFob;
});
if (wantVisible != _chromeVisible) {
setState(() => _chromeVisible = wantVisible);
}
}
@ -75,14 +70,14 @@ class _ReaderScreenState extends State<ReaderScreen> {
body: Column(
children: [
AnimatedSlide(
offset: _barVisible ? Offset.zero : const Offset(0, -1),
offset: _chromeVisible ? Offset.zero : const Offset(0, -1),
duration: const Duration(milliseconds: 200),
curve: Curves.easeOut,
child: AnimatedSize(
duration: const Duration(milliseconds: 200),
curve: Curves.easeOut,
alignment: Alignment.topCenter,
child: _barVisible
child: _chromeVisible
? const AddressBar()
: const SizedBox(width: double.infinity),
),
@ -110,7 +105,7 @@ class _ReaderScreenState extends State<ReaderScreen> {
right: 0,
bottom: 0,
child: Fob(
visible: _fobVisible,
visible: _chromeVisible,
label: strings.t('reader-fob-label'),
onTap: () => showReaderSettingsSheet(context),
),