update components for splitview

This commit is contained in:
Salvatore Giordano
2020-08-03 15:56:00 +02:00
parent d008bc01ac
commit b95efa0ea5
3 changed files with 128 additions and 125 deletions
+12 -5
View File
@@ -56,17 +56,17 @@ class _SplitViewState extends State<SplitView> {
flex: 1, flex: 1,
), ),
Flexible( Flexible(
child: selectedChannel != null child: Scaffold(
body: selectedChannel != null
? StreamChannel( ? StreamChannel(
key: ValueKey(selectedChannel.cid), key: ValueKey(selectedChannel.cid),
child: ChannelPage(), child: ChannelPage(),
channel: selectedChannel, channel: selectedChannel,
) )
: Scaffold( : Center(
body: 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,
), ),
), ),
), ),
@@ -101,7 +101,6 @@ class ChannelListPage extends StatelessWidget {
pagination: PaginationParams( pagination: PaginationParams(
limit: 20, limit: 20,
), ),
channelWidget: ChannelPage(),
), ),
), ),
); );
@@ -115,6 +114,10 @@ class ChannelPage extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Navigator(
onGenerateRoute: (settings) {
return MaterialPageRoute(
builder: (context) {
return Scaffold( return Scaffold(
appBar: ChannelHeader( appBar: ChannelHeader(
showBackButton: false, showBackButton: false,
@@ -128,5 +131,9 @@ class ChannelPage extends StatelessWidget {
], ],
), ),
); );
},
);
},
);
} }
} }
+1 -1
View File
@@ -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"
+14 -18
View File
@@ -216,18 +216,14 @@ 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(
Size.fromWidth(MediaQuery.of(context).size.width * 0.8),
),
child: Column( child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
IntrinsicWidth( Column(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start, crossAxisAlignment: CrossAxisAlignment.start,
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: <Widget>[ children: <Widget>[
@@ -243,8 +239,8 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
if (widget.showUserAvatar == DisplayWidget.hide) if (widget.showUserAvatar == DisplayWidget.hide)
SizedBox( SizedBox(
width: widget.messageTheme.avatarTheme width: widget.messageTheme.avatarTheme.constraints
.constraints.maxWidth + .maxWidth +
8, 8,
), ),
Flexible( Flexible(
@@ -260,8 +256,7 @@ class _MessageWidgetState extends State<MessageWidget> {
portal: _buildReactionIndicator(context), portal: _buildReactionIndicator(context),
child: (widget.message.isDeleted && child: (widget.message.isDeleted &&
widget.message.status != widget.message.status !=
MessageSendingStatus MessageSendingStatus.FAILED_DELETE)
.FAILED_DELETE)
? Transform( ? Transform(
alignment: Alignment.center, alignment: Alignment.center,
transform: Matrix4.rotationY( transform: Matrix4.rotationY(
@@ -292,7 +287,6 @@ class _MessageWidgetState extends State<MessageWidget> {
_buildReplyIndicator(leftPadding), _buildReplyIndicator(leftPadding),
], ],
), ),
),
if ((widget.message.createdAt != null && if ((widget.message.createdAt != null &&
widget.showTimestamp) || widget.showTimestamp) ||
widget.showUsername || widget.showUsername ||
@@ -303,7 +297,6 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
), ),
), ),
),
); );
} }
@@ -447,8 +440,9 @@ 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,
child: Padding(
padding: const EdgeInsets.only( padding: const EdgeInsets.only(
bottom: 4.0, bottom: 4.0,
), ),
@@ -462,11 +456,12 @@ class _MessageWidgetState extends State<MessageWidget> {
child: Container( child: Container(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
decoration: BoxDecoration( decoration: BoxDecoration(
color: color: Theme.of(context).brightness ==
Theme.of(context).brightness == Brightness.dark Brightness.dark
? Colors.white ? Colors.white
: Colors.black, : Colors.black,
borderRadius: BorderRadius.all(Radius.circular(14)), borderRadius:
BorderRadius.all(Radius.circular(14)),
), ),
child: _buildReactionsText(context), child: _buildReactionsText(context),
), ),
@@ -476,6 +471,7 @@ class _MessageWidgetState extends State<MessageWidget> {
), ),
), ),
), ),
),
) )
: SizedBox(), : SizedBox(),
); );