feat: theme chrome by palette, selectable text, wap fallback, and library pages
This commit is contained in:
parent
c104c2026b
commit
56f3d959fa
12 changed files with 534 additions and 51 deletions
|
|
@ -73,6 +73,10 @@ class _SwipeNavigatorState extends State<SwipeNavigator>
|
|||
|
||||
bool get _settledAnimating => _settling != null && _settle.isAnimating;
|
||||
|
||||
/// How close to a screen edge a drag must begin to navigate; horizontal
|
||||
/// drags elsewhere belong to text selection.
|
||||
static const _edgeZone = 40.0;
|
||||
|
||||
void _onDragStart(DragStartDetails details) {
|
||||
if (_settledAnimating) return;
|
||||
setState(() => _dragging = true);
|
||||
|
|
@ -161,24 +165,37 @@ class _SwipeNavigatorState extends State<SwipeNavigator>
|
|||
)
|
||||
: null;
|
||||
|
||||
return GestureDetector(
|
||||
behavior: HitTestBehavior.deferToChild,
|
||||
onHorizontalDragStart: _onDragStart,
|
||||
onHorizontalDragUpdate: _onDragUpdate,
|
||||
onHorizontalDragEnd: _onDragEnd,
|
||||
child: Stack(
|
||||
children: [
|
||||
if (peek != null) Positioned.fill(child: peek),
|
||||
Transform.translate(
|
||||
offset: Offset(dx, 0),
|
||||
child: widget.child,
|
||||
),
|
||||
],
|
||||
),
|
||||
return Stack(
|
||||
children: [
|
||||
if (peek != null) Positioned.fill(child: peek),
|
||||
Transform.translate(
|
||||
offset: Offset(dx, 0),
|
||||
child: widget.child,
|
||||
),
|
||||
// Only horizontal drags that begin at a screen edge navigate;
|
||||
// the strips are translucent, so taps, vertical scrolling and
|
||||
// text selection still pass through everywhere.
|
||||
_edgeStrip(fromLeft: true),
|
||||
_edgeStrip(fromLeft: false),
|
||||
],
|
||||
);
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
Widget _edgeStrip({required bool fromLeft}) => Positioned(
|
||||
left: fromLeft ? 0 : null,
|
||||
right: fromLeft ? null : 0,
|
||||
top: 0,
|
||||
bottom: 0,
|
||||
width: _edgeZone,
|
||||
child: GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onHorizontalDragStart: _onDragStart,
|
||||
onHorizontalDragUpdate: _onDragUpdate,
|
||||
onHorizontalDragEnd: _onDragEnd,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// The neighboring page's fallback panel while it is still being parsed.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue