makes toolbar have dynamic width to fit around content
This commit is contained in:
parent
2bc421e6e7
commit
4ddd28b7fe
3 changed files with 47 additions and 46 deletions
|
|
@ -373,24 +373,16 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
|
|||
// the default spacing between the side of the screen and the message bubble
|
||||
final double messageMargin =
|
||||
pangeaMessageEvent.ownMessage ? Avatar.defaultSize + 16 : 8;
|
||||
|
||||
// the actual spacing between the side of the screen and
|
||||
// the message bubble, accounts for wide screen
|
||||
double extraChatSpace = FluffyThemes.isColumnMode(context)
|
||||
? ((screenWidth -
|
||||
(FluffyThemes.columnWidth * 3.5) -
|
||||
FluffyThemes.navRailWidth) /
|
||||
2) +
|
||||
messageMargin
|
||||
: messageMargin;
|
||||
|
||||
if (extraChatSpace < messageMargin) {
|
||||
extraChatSpace = messageMargin;
|
||||
}
|
||||
final horizontalPadding = FluffyThemes.isColumnMode(context) ? 8.0 : 0.0;
|
||||
final chatViewWidth = screenWidth -
|
||||
(FluffyThemes.isColumnMode(context)
|
||||
? (FluffyThemes.columnWidth + FluffyThemes.navRailWidth)
|
||||
: 0);
|
||||
final maxWidth = chatViewWidth - (2 * horizontalPadding) - messageMargin;
|
||||
|
||||
final overlayMessage = Container(
|
||||
constraints: const BoxConstraints(
|
||||
maxWidth: FluffyThemes.columnWidth * 2.5,
|
||||
constraints: BoxConstraints(
|
||||
maxWidth: maxWidth,
|
||||
),
|
||||
child: Material(
|
||||
type: MaterialType.transparency,
|
||||
|
|
@ -439,21 +431,20 @@ class MessageOverlayController extends State<MessageSelectionOverlay>
|
|||
),
|
||||
);
|
||||
|
||||
final horizontalPadding = FluffyThemes.isColumnMode(context) ? 8.0 : 0.0;
|
||||
final columnOffset = FluffyThemes.isColumnMode(context)
|
||||
? FluffyThemes.columnWidth + FluffyThemes.navRailWidth
|
||||
: 0;
|
||||
|
||||
final double leftPadding = widget._pangeaMessageEvent.ownMessage
|
||||
? extraChatSpace
|
||||
final double? leftPadding = widget._pangeaMessageEvent.ownMessage
|
||||
? null
|
||||
: messageOffset!.dx - horizontalPadding - columnOffset;
|
||||
|
||||
final double rightPadding = widget._pangeaMessageEvent.ownMessage
|
||||
final double? rightPadding = widget._pangeaMessageEvent.ownMessage
|
||||
? screenWidth -
|
||||
messageOffset!.dx -
|
||||
messageSize!.width -
|
||||
horizontalPadding
|
||||
: extraChatSpace;
|
||||
: null;
|
||||
|
||||
final positionedOverlayMessage = _overlayPositionAnimation == null
|
||||
? Positioned(
|
||||
|
|
|
|||
|
|
@ -120,34 +120,40 @@ class MessageToolbarState extends State<MessageToolbar> {
|
|||
.layerLinkAndKey('${widget.pangeaMessageEvent.eventId}-toolbar')
|
||||
.key,
|
||||
type: MaterialType.transparency,
|
||||
child: Column(
|
||||
child: Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color: Theme.of(context).colorScheme.primary.withOpacity(0.5),
|
||||
),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(AppConfig.borderRadius),
|
||||
),
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: AppConfig.toolbarMaxHeight,
|
||||
),
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: AnimatedSize(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
child: toolbarContent,
|
||||
),
|
||||
Column(
|
||||
children: [
|
||||
Container(
|
||||
decoration: BoxDecoration(
|
||||
color: Theme.of(context).cardColor,
|
||||
border: Border.all(
|
||||
width: 2,
|
||||
color:
|
||||
Theme.of(context).colorScheme.primary.withOpacity(0.5),
|
||||
),
|
||||
borderRadius: const BorderRadius.all(
|
||||
Radius.circular(AppConfig.borderRadius),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
constraints: const BoxConstraints(
|
||||
maxHeight: AppConfig.toolbarMaxHeight,
|
||||
),
|
||||
// child: Row(
|
||||
// children: [
|
||||
// Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: AnimatedSize(
|
||||
duration: FluffyThemes.animationDuration,
|
||||
child: toolbarContent,
|
||||
),
|
||||
),
|
||||
// ),
|
||||
// ],
|
||||
// ),
|
||||
),
|
||||
],
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:fluffychat/config/app_config.dart';
|
||||
import 'package:fluffychat/pages/chat/chat.dart';
|
||||
import 'package:fluffychat/pangea/utils/bot_style.dart';
|
||||
import 'package:fluffychat/pangea/widgets/common/bot_face_svg.dart';
|
||||
import 'package:fluffychat/pangea/widgets/igc/card_header.dart';
|
||||
|
|
@ -7,8 +8,10 @@ import 'package:flutter/material.dart';
|
|||
import 'package:flutter_gen/gen_l10n/l10n.dart';
|
||||
|
||||
class PaywallCard extends StatelessWidget {
|
||||
final ChatController chatController;
|
||||
const PaywallCard({
|
||||
super.key,
|
||||
required this.chatController,
|
||||
});
|
||||
|
||||
@override
|
||||
|
|
@ -69,6 +72,7 @@ class PaywallCard extends StatelessWidget {
|
|||
width: double.infinity,
|
||||
child: TextButton(
|
||||
onPressed: () {
|
||||
chatController.clearSelectedEvents();
|
||||
MatrixState.pangeaController.subscriptionController
|
||||
.showPaywall(context);
|
||||
},
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue