fix: float the pet over the messages and let it be dragged
The pet used to sit in the column above the composer, reserving a strip of its own: the message list ended there, which read as an opaque band cutting off the last row. It is now a layer over the message area, so the list keeps its full height and shows through around the sprite. Only the body of the sheet takes touches (contentBox, 4dp out); taps and drags on the transparent canvas still reach the messages underneath. Dragging the body moves the pet along the composer's top edge (or the activity cap's) with a small lift while held and the pack's drag reaction. The spot is stored as a fraction of the width in pet.x.v1, so a restart or a change in width puts it back in the same place. Taps now react on tap-up so a drag does not fire a left/right reaction. 0.4.1 (401).
This commit is contained in:
1 parent
d72af036a1
commit
d25167de58
8 files changed
+348
-58
No files matched your search
@@ -167,10 +167,18 @@ class _ChatScreenState extends State<ChatScreen> {
|
||||
],
|
||||
),
|
||||
),
|
||||
Expanded(child: _messageList()),
|
||||
Expanded(
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(child: _messageList()),
|
||||
// Over the messages, not in the column: the list keeps its
|
||||
// full height and shows through around the pet.
|
||||
Positioned.fill(child: PetLayer(state: _petState())),
|
||||
],
|
||||
),
|
||||
),
|
||||
_permissions(),
|
||||
_forms(),
|
||||
PetSlot(state: _petState()),
|
||||
if (chat.running) _activityStrip(),
|
||||
_composer(widget.keyboardInset),
|
||||
],
|
||||
|
||||
@@ -221,19 +221,26 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
|
||||
body: Column(
|
||||
children: [
|
||||
Expanded(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Text(
|
||||
'我们今天要做什么?',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: scheme.onSurface,
|
||||
child: Stack(
|
||||
children: [
|
||||
Positioned.fill(
|
||||
child: Center(
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Text(
|
||||
'我们今天要做什么?',
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
fontSize: 26,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: scheme.onSurface,
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
const Positioned.fill(child: PetLayer(state: 'idle')),
|
||||
],
|
||||
),
|
||||
),
|
||||
Padding(
|
||||
@@ -260,7 +267,6 @@ class _NewSessionScreenState extends State<NewSessionScreen> {
|
||||
items: _attachments,
|
||||
onRemove: _removeAttachment,
|
||||
),
|
||||
const PetSlot(state: 'idle'),
|
||||
_composer(theme, widget.keyboardInset),
|
||||
],
|
||||
),
|
||||
|
||||
Reference in new issue
Block a user