update components for splitview
This commit is contained in:
+30
-23
@@ -56,20 +56,20 @@ class _SplitViewState extends State<SplitView> {
|
|||||||
flex: 1,
|
flex: 1,
|
||||||
),
|
),
|
||||||
Flexible(
|
Flexible(
|
||||||
child: selectedChannel != null
|
child: Scaffold(
|
||||||
? StreamChannel(
|
body: selectedChannel != null
|
||||||
key: ValueKey(selectedChannel.cid),
|
? StreamChannel(
|
||||||
child: ChannelPage(),
|
key: ValueKey(selectedChannel.cid),
|
||||||
channel: selectedChannel,
|
child: ChannelPage(),
|
||||||
)
|
channel: selectedChannel,
|
||||||
: Scaffold(
|
)
|
||||||
body: Center(
|
: Center(
|
||||||
child: Text(
|
child: Text(
|
||||||
'Pick a channel to show the messages 💬',
|
'Pick a channel to show the messages 💬',
|
||||||
style: Theme.of(context).textTheme.headline,
|
style: Theme.of(context).textTheme.headline5,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
flex: 2,
|
flex: 2,
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
@@ -101,7 +101,6 @@ class ChannelListPage extends StatelessWidget {
|
|||||||
pagination: PaginationParams(
|
pagination: PaginationParams(
|
||||||
limit: 20,
|
limit: 20,
|
||||||
),
|
),
|
||||||
channelWidget: ChannelPage(),
|
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
@@ -115,18 +114,26 @@ class ChannelPage extends StatelessWidget {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Scaffold(
|
return Navigator(
|
||||||
appBar: ChannelHeader(
|
onGenerateRoute: (settings) {
|
||||||
showBackButton: false,
|
return MaterialPageRoute(
|
||||||
),
|
builder: (context) {
|
||||||
body: Column(
|
return Scaffold(
|
||||||
children: <Widget>[
|
appBar: ChannelHeader(
|
||||||
Expanded(
|
showBackButton: false,
|
||||||
child: MessageListView(),
|
),
|
||||||
),
|
body: Column(
|
||||||
MessageInput(),
|
children: <Widget>[
|
||||||
],
|
Expanded(
|
||||||
),
|
child: MessageListView(),
|
||||||
|
),
|
||||||
|
MessageInput(),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
name: example
|
name: example
|
||||||
description: A new Flutter project.
|
description: A new Flutter project.
|
||||||
|
|
||||||
version: 1.0.11+13
|
version: 1.0.12+14
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: ">=2.2.2 <3.0.0"
|
sdk: ">=2.2.2 <3.0.0"
|
||||||
|
|||||||
+97
-101
@@ -216,90 +216,83 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
child: Transform(
|
child: Transform(
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
||||||
child: Container(
|
child: FractionallySizedBox(
|
||||||
alignment: Alignment.centerLeft,
|
alignment: Alignment.centerLeft,
|
||||||
child: Container(
|
widthFactor: 0.75,
|
||||||
constraints: BoxConstraints.loose(
|
child: Column(
|
||||||
Size.fromWidth(MediaQuery.of(context).size.width * 0.8),
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
),
|
mainAxisSize: MainAxisSize.min,
|
||||||
child: Column(
|
children: <Widget>[
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: <Widget>[
|
mainAxisSize: MainAxisSize.min,
|
||||||
IntrinsicWidth(
|
children: <Widget>[
|
||||||
child: Column(
|
Row(
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
mainAxisAlignment: MainAxisAlignment.start,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.end,
|
||||||
mainAxisSize: MainAxisSize.min,
|
mainAxisSize: MainAxisSize.min,
|
||||||
children: <Widget>[
|
children: <Widget>[
|
||||||
Row(
|
if (widget.showUserAvatar == DisplayWidget.show)
|
||||||
mainAxisAlignment: MainAxisAlignment.start,
|
_buildUserAvatar(),
|
||||||
crossAxisAlignment: CrossAxisAlignment.end,
|
SizedBox(
|
||||||
mainAxisSize: MainAxisSize.min,
|
width: 6,
|
||||||
children: <Widget>[
|
),
|
||||||
if (widget.showUserAvatar == DisplayWidget.show)
|
if (widget.showUserAvatar == DisplayWidget.hide)
|
||||||
_buildUserAvatar(),
|
SizedBox(
|
||||||
SizedBox(
|
width: widget.messageTheme.avatarTheme.constraints
|
||||||
width: 6,
|
.maxWidth +
|
||||||
|
8,
|
||||||
|
),
|
||||||
|
Flexible(
|
||||||
|
child: Padding(
|
||||||
|
padding: widget.showReactions
|
||||||
|
? EdgeInsets.only(
|
||||||
|
top: _reactionPadding,
|
||||||
|
)
|
||||||
|
: EdgeInsets.zero,
|
||||||
|
child: PortalEntry(
|
||||||
|
portalAnchor: Alignment(0, 1),
|
||||||
|
childAnchor: Alignment.topRight,
|
||||||
|
portal: _buildReactionIndicator(context),
|
||||||
|
child: (widget.message.isDeleted &&
|
||||||
|
widget.message.status !=
|
||||||
|
MessageSendingStatus.FAILED_DELETE)
|
||||||
|
? Transform(
|
||||||
|
alignment: Alignment.center,
|
||||||
|
transform: Matrix4.rotationY(
|
||||||
|
widget.reverse ? pi : 0),
|
||||||
|
child: DeletedMessage(
|
||||||
|
messageTheme: widget.messageTheme,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
: Column(
|
||||||
|
crossAxisAlignment:
|
||||||
|
CrossAxisAlignment.start,
|
||||||
|
mainAxisSize: MainAxisSize.min,
|
||||||
|
children: <Widget>[
|
||||||
|
..._parseAttachments(context),
|
||||||
|
if (widget.message.text
|
||||||
|
.trim()
|
||||||
|
.isNotEmpty)
|
||||||
|
_buildTextBubble(context),
|
||||||
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
if (widget.showUserAvatar == DisplayWidget.hide)
|
),
|
||||||
SizedBox(
|
|
||||||
width: widget.messageTheme.avatarTheme
|
|
||||||
.constraints.maxWidth +
|
|
||||||
8,
|
|
||||||
),
|
|
||||||
Flexible(
|
|
||||||
child: Padding(
|
|
||||||
padding: widget.showReactions
|
|
||||||
? EdgeInsets.only(
|
|
||||||
top: _reactionPadding,
|
|
||||||
)
|
|
||||||
: EdgeInsets.zero,
|
|
||||||
child: PortalEntry(
|
|
||||||
portalAnchor: Alignment(0, 1),
|
|
||||||
childAnchor: Alignment.topRight,
|
|
||||||
portal: _buildReactionIndicator(context),
|
|
||||||
child: (widget.message.isDeleted &&
|
|
||||||
widget.message.status !=
|
|
||||||
MessageSendingStatus
|
|
||||||
.FAILED_DELETE)
|
|
||||||
? Transform(
|
|
||||||
alignment: Alignment.center,
|
|
||||||
transform: Matrix4.rotationY(
|
|
||||||
widget.reverse ? pi : 0),
|
|
||||||
child: DeletedMessage(
|
|
||||||
messageTheme: widget.messageTheme,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
: Column(
|
|
||||||
crossAxisAlignment:
|
|
||||||
CrossAxisAlignment.start,
|
|
||||||
mainAxisSize: MainAxisSize.min,
|
|
||||||
children: <Widget>[
|
|
||||||
..._parseAttachments(context),
|
|
||||||
if (widget.message.text
|
|
||||||
.trim()
|
|
||||||
.isNotEmpty)
|
|
||||||
_buildTextBubble(context),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
),
|
||||||
if (widget.showReplyIndicator &&
|
|
||||||
widget.message.replyCount > 0)
|
|
||||||
_buildReplyIndicator(leftPadding),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
if (widget.showReplyIndicator &&
|
||||||
if ((widget.message.createdAt != null &&
|
widget.message.replyCount > 0)
|
||||||
widget.showTimestamp) ||
|
_buildReplyIndicator(leftPadding),
|
||||||
widget.showUsername ||
|
],
|
||||||
widget.readList?.isNotEmpty == true)
|
),
|
||||||
_buildBottomRow(leftPadding),
|
if ((widget.message.createdAt != null &&
|
||||||
],
|
widget.showTimestamp) ||
|
||||||
),
|
widget.showUsername ||
|
||||||
|
widget.readList?.isNotEmpty == true)
|
||||||
|
_buildBottomRow(leftPadding),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -447,32 +440,35 @@ class _MessageWidgetState extends State<MessageWidget> {
|
|||||||
? Container(
|
? Container(
|
||||||
child: GestureDetector(
|
child: GestureDetector(
|
||||||
onTap: () => onLongPress(context),
|
onTap: () => onLongPress(context),
|
||||||
child: Container(
|
child: FractionallySizedBox(
|
||||||
width: MediaQuery.of(context).size.width * 0.3,
|
widthFactor: 0.3,
|
||||||
padding: const EdgeInsets.only(
|
child: Padding(
|
||||||
bottom: 4.0,
|
padding: const EdgeInsets.only(
|
||||||
),
|
bottom: 4.0,
|
||||||
child: Column(
|
),
|
||||||
crossAxisAlignment: CrossAxisAlignment.center,
|
child: Column(
|
||||||
mainAxisSize: MainAxisSize.min,
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
children: <Widget>[
|
mainAxisSize: MainAxisSize.min,
|
||||||
Transform(
|
children: <Widget>[
|
||||||
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
Transform(
|
||||||
alignment: Alignment.center,
|
transform: Matrix4.rotationY(widget.reverse ? pi : 0),
|
||||||
child: Container(
|
alignment: Alignment.center,
|
||||||
padding: const EdgeInsets.all(8),
|
child: Container(
|
||||||
decoration: BoxDecoration(
|
padding: const EdgeInsets.all(8),
|
||||||
color:
|
decoration: BoxDecoration(
|
||||||
Theme.of(context).brightness == Brightness.dark
|
color: Theme.of(context).brightness ==
|
||||||
? Colors.white
|
Brightness.dark
|
||||||
: Colors.black,
|
? Colors.white
|
||||||
borderRadius: BorderRadius.all(Radius.circular(14)),
|
: Colors.black,
|
||||||
|
borderRadius:
|
||||||
|
BorderRadius.all(Radius.circular(14)),
|
||||||
|
),
|
||||||
|
child: _buildReactionsText(context),
|
||||||
),
|
),
|
||||||
child: _buildReactionsText(context),
|
|
||||||
),
|
),
|
||||||
),
|
_buildReactionsTail(context),
|
||||||
_buildReactionsTail(context),
|
],
|
||||||
],
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
Reference in New Issue
Block a user