chore: hide activity role tooltip when it bar is open (#3933)

pull/2245/head
ggurdin 2 months ago committed by GitHub
parent c24e0db30f
commit 98406c70f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,89 @@
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:matrix/matrix.dart';
import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pangea/activity_sessions/activity_room_extension.dart';
import 'package:fluffychat/pangea/choreographer/controllers/choreographer.dart';
class ActivityRoleTooltip extends StatefulWidget {
final Choreographer choreographer;
const ActivityRoleTooltip({
required this.choreographer,
super.key,
});
@override
State<ActivityRoleTooltip> createState() => ActivityRoleTooltipState();
}
class ActivityRoleTooltipState extends State<ActivityRoleTooltip> {
Room get room => widget.choreographer.chatController.room;
StreamSubscription? _choreoSub;
@override
void initState() {
super.initState();
_choreoSub = widget.choreographer.stateStream.stream.listen((event) {
if (mounted) setState(() {});
});
}
@override
void dispose() {
_choreoSub?.cancel();
super.dispose();
}
@override
Widget build(BuildContext context) {
if (widget.choreographer.itController.willOpen ||
room.showActivityChatUI && room.ownRole?.goal != null) {
return const SizedBox();
}
return Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
border: Border(
top: BorderSide(
color: Theme.of(context).colorScheme.outline,
width: 0.1,
),
),
),
child: AnimatedSize(
duration: FluffyThemes.animationDuration,
child: room.hasDismissedGoalTooltip
? const SizedBox()
: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
spacing: 10.0,
children: [
Expanded(
child: Text(
room.ownRole!.goal!,
style: const TextStyle(
fontSize: 12.0,
),
textAlign: TextAlign.center,
),
),
IconButton(
icon: const Icon(Icons.close),
onPressed: () async {
await room.dismissGoalTooltip();
if (mounted) setState(() {});
},
),
],
),
),
),
);
}
}

@ -6,7 +6,7 @@ import 'package:fluffychat/config/themes.dart';
import 'package:fluffychat/pages/chat/chat.dart';
import 'package:fluffychat/pages/chat/chat_emoji_picker.dart';
import 'package:fluffychat/pages/chat/reply_display.dart';
import 'package:fluffychat/pangea/activity_sessions/activity_room_extension.dart';
import 'package:fluffychat/pangea/activity_sessions/activity_session_chat/activity_role_tooltip.dart';
import 'package:fluffychat/pangea/chat/widgets/pangea_chat_input_row.dart';
import 'package:fluffychat/pangea/choreographer/widgets/it_bar.dart';
@ -57,49 +57,9 @@ class ChatInputBarState extends State<ChatInputBar> {
child: SizeChangedLayoutNotifier(
child: Column(
children: [
if (widget.controller.room.showActivityChatUI &&
widget.controller.room.ownRole?.goal != null)
Container(
decoration: BoxDecoration(
color: Theme.of(context).colorScheme.surface,
border: Border(
top: BorderSide(
color: Theme.of(context).colorScheme.outline,
width: 0.1,
),
),
),
child: AnimatedSize(
duration: FluffyThemes.animationDuration,
child: widget.controller.room.hasDismissedGoalTooltip
? const SizedBox()
: Padding(
padding: const EdgeInsets.all(12.0),
child: Row(
spacing: 10.0,
children: [
Expanded(
child: Text(
widget.controller.room.ownRole!.goal!,
style: const TextStyle(
fontSize: 12.0,
),
textAlign: TextAlign.center,
),
),
IconButton(
icon: const Icon(Icons.close),
onPressed: () async {
await widget.controller.room
.dismissGoalTooltip();
if (mounted) setState(() {});
},
),
],
),
),
),
),
ActivityRoleTooltip(
choreographer: widget.controller.choreographer,
),
Container(
padding: EdgeInsets.only(
bottom: widget.padding,

Loading…
Cancel
Save