chore: Add replies and hold to show
This commit is contained in:
parent
74a3d0d52e
commit
f28aeedd4a
3 changed files with 181 additions and 77 deletions
|
|
@ -26,39 +26,47 @@ class StoryView extends StatelessWidget {
|
|||
backgroundColor: Colors.blueGrey,
|
||||
appBar: AppBar(
|
||||
titleSpacing: 0,
|
||||
title: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
controller.title,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: currentEvent != null
|
||||
? Text(
|
||||
currentEvent.originServerTs.localizedTime(context),
|
||||
style: const TextStyle(
|
||||
color: Colors.white70,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
],
|
||||
leading: IconButton(
|
||||
icon: const Icon(Icons.close),
|
||||
onPressed: Navigator.of(context).pop,
|
||||
),
|
||||
title: AnimatedOpacity(
|
||||
duration: const Duration(seconds: 1),
|
||||
opacity: controller.isHold ? 0 : 1,
|
||||
child: ListTile(
|
||||
contentPadding: EdgeInsets.zero,
|
||||
title: Text(
|
||||
controller.title,
|
||||
style: const TextStyle(
|
||||
color: Colors.white,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
)
|
||||
: null,
|
||||
leading: Avatar(
|
||||
mxContent: controller.avatar,
|
||||
name: controller.title,
|
||||
],
|
||||
),
|
||||
),
|
||||
subtitle: currentEvent != null
|
||||
? Text(
|
||||
currentEvent.originServerTs.localizedTime(context),
|
||||
style: const TextStyle(
|
||||
color: Colors.white70,
|
||||
shadows: [
|
||||
Shadow(
|
||||
color: Colors.black,
|
||||
offset: Offset(0, 0),
|
||||
blurRadius: 5,
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
: null,
|
||||
leading: Avatar(
|
||||
mxContent: controller.avatar,
|
||||
name: controller.title,
|
||||
),
|
||||
),
|
||||
),
|
||||
systemOverlayStyle: SystemUiOverlayStyle.light,
|
||||
|
|
@ -199,56 +207,98 @@ class StoryView extends StatelessWidget {
|
|||
top: 4,
|
||||
left: 4,
|
||||
right: 4,
|
||||
child: SafeArea(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
for (var i = 0; i < events.length; i++)
|
||||
Expanded(
|
||||
child: i == controller.index
|
||||
? LinearProgressIndicator(
|
||||
color: Colors.white,
|
||||
minHeight: 2,
|
||||
backgroundColor: Colors.grey.shade600,
|
||||
value: controller.loadingMode
|
||||
? null
|
||||
: controller.progress.inMilliseconds /
|
||||
StoryPageController
|
||||
.maxProgress.inMilliseconds,
|
||||
)
|
||||
: Container(
|
||||
margin: const EdgeInsets.all(4),
|
||||
height: 2,
|
||||
color: i < controller.index
|
||||
? Colors.white
|
||||
: Colors.grey.shade600,
|
||||
),
|
||||
),
|
||||
],
|
||||
child: AnimatedOpacity(
|
||||
duration: const Duration(seconds: 1),
|
||||
opacity: controller.isHold ? 0 : 1,
|
||||
child: SafeArea(
|
||||
child: Row(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
for (var i = 0; i < events.length; i++)
|
||||
Expanded(
|
||||
child: i == controller.index
|
||||
? LinearProgressIndicator(
|
||||
color: Colors.white,
|
||||
minHeight: 2,
|
||||
backgroundColor: Colors.grey.shade600,
|
||||
value: controller.loadingMode
|
||||
? null
|
||||
: controller.progress.inMilliseconds /
|
||||
StoryPageController
|
||||
.maxProgress.inMilliseconds,
|
||||
)
|
||||
: Container(
|
||||
margin: const EdgeInsets.all(4),
|
||||
height: 2,
|
||||
color: i < controller.index
|
||||
? Colors.white
|
||||
: Colors.grey.shade600,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (!controller.isOwnStory && currentEvent != null)
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: AnimatedOpacity(
|
||||
duration: const Duration(seconds: 1),
|
||||
opacity: controller.isHold ? 0 : 1,
|
||||
child: SafeArea(
|
||||
child: TextField(
|
||||
onTap: controller.hold,
|
||||
onEditingComplete: controller.unhold,
|
||||
focusNode: controller.replyFocus,
|
||||
controller: controller.replyController,
|
||||
minLines: 1,
|
||||
maxLines: 7,
|
||||
onSubmitted: controller.replyAction,
|
||||
textInputAction: TextInputAction.newline,
|
||||
readOnly: controller.replyLoading,
|
||||
decoration: InputDecoration(
|
||||
hintText: L10n.of(context)!.reply,
|
||||
prefixIcon: IconButton(
|
||||
onPressed: controller.replyEmojiAction,
|
||||
icon: const Icon(Icons.emoji_emotions_outlined),
|
||||
),
|
||||
suffixIcon: controller.replyLoading
|
||||
? const CircularProgressIndicator.adaptive(
|
||||
strokeWidth: 2)
|
||||
: IconButton(
|
||||
onPressed: controller.replyAction,
|
||||
icon: const Icon(Icons.send_outlined),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
if (controller.isOwnStory &&
|
||||
controller.currentSeenByUsers.isNotEmpty)
|
||||
Positioned(
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: controller.displaySeenByUsers,
|
||||
icon: const Icon(
|
||||
Icons.visibility_outlined,
|
||||
color: Colors.white70,
|
||||
),
|
||||
label: Text(
|
||||
controller.seenByUsersTitle,
|
||||
style: const TextStyle(color: Colors.white70),
|
||||
),
|
||||
bottom: 16,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: SafeArea(
|
||||
child: Center(
|
||||
child: OutlinedButton.icon(
|
||||
onPressed: controller.displaySeenByUsers,
|
||||
icon: const Icon(
|
||||
Icons.visibility_outlined,
|
||||
color: Colors.white70,
|
||||
),
|
||||
label: Text(
|
||||
controller.seenByUsersTitle,
|
||||
style: const TextStyle(color: Colors.white70),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue