fmt
This commit is contained in:
@@ -132,9 +132,13 @@ class _FullScreenImageState extends State<FullScreenImage>
|
|||||||
String getDay(DateTime dateTime) {
|
String getDay(DateTime dateTime) {
|
||||||
var now = DateTime.now();
|
var now = DateTime.now();
|
||||||
|
|
||||||
if(DateTime(dateTime.year, dateTime.month, dateTime.day) == DateTime(now.year, now.month, now.day)) {
|
if (DateTime(dateTime.year, dateTime.month, dateTime.day) ==
|
||||||
|
DateTime(now.year, now.month, now.day)) {
|
||||||
return 'today';
|
return 'today';
|
||||||
} else if(DateTime(now.year, now.month, now.day).difference(dateTime).inHours < 24) {
|
} else if (DateTime(now.year, now.month, now.day)
|
||||||
|
.difference(dateTime)
|
||||||
|
.inHours <
|
||||||
|
24) {
|
||||||
return 'yesterday';
|
return 'yesterday';
|
||||||
} else {
|
} else {
|
||||||
return 'on ${Jiffy(dateTime).format("MMM do")}';
|
return 'on ${Jiffy(dateTime).format("MMM do")}';
|
||||||
|
|||||||
@@ -64,12 +64,14 @@ class GiphyAttachment extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (_) {
|
Navigator.push(context, MaterialPageRoute(builder: (_) {
|
||||||
return FullScreenImage(
|
return FullScreenImage(
|
||||||
urls: [attachment.imageUrl ??
|
urls: [
|
||||||
attachment.assetUrl ??
|
attachment.imageUrl ??
|
||||||
attachment.thumbUrl],
|
attachment.assetUrl ??
|
||||||
userName: message.user.name,
|
attachment.thumbUrl
|
||||||
sentAt: message.createdAt,
|
],
|
||||||
message: message,
|
userName: message.user.name,
|
||||||
|
sentAt: message.createdAt,
|
||||||
|
message: message,
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
@@ -285,12 +287,14 @@ class GiphyAttachment extends StatelessWidget {
|
|||||||
onTap: () {
|
onTap: () {
|
||||||
Navigator.push(context, MaterialPageRoute(builder: (_) {
|
Navigator.push(context, MaterialPageRoute(builder: (_) {
|
||||||
return FullScreenImage(
|
return FullScreenImage(
|
||||||
urls: [attachment.imageUrl ??
|
urls: [
|
||||||
attachment.assetUrl ??
|
attachment.imageUrl ??
|
||||||
attachment.thumbUrl],
|
attachment.assetUrl ??
|
||||||
userName: message.user.name,
|
attachment.thumbUrl
|
||||||
sentAt: message.createdAt,
|
],
|
||||||
message: message,
|
userName: message.user.name,
|
||||||
|
sentAt: message.createdAt,
|
||||||
|
message: message,
|
||||||
);
|
);
|
||||||
}));
|
}));
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -48,9 +48,11 @@ class ImageAttachment extends StatelessWidget {
|
|||||||
return StreamChannel(
|
return StreamChannel(
|
||||||
channel: channel,
|
channel: channel,
|
||||||
child: FullScreenImage(
|
child: FullScreenImage(
|
||||||
urls: [attachment.imageUrl ??
|
urls: [
|
||||||
attachment.assetUrl ??
|
attachment.imageUrl ??
|
||||||
attachment.thumbUrl],
|
attachment.assetUrl ??
|
||||||
|
attachment.thumbUrl
|
||||||
|
],
|
||||||
userName: message.user.name,
|
userName: message.user.name,
|
||||||
sentAt: message.createdAt,
|
sentAt: message.createdAt,
|
||||||
message: message,
|
message: message,
|
||||||
|
|||||||
+96
-89
@@ -378,8 +378,9 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
child: Material(
|
child: Material(
|
||||||
child: InkWell(
|
child: InkWell(
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
await GallerySaver.saveImage(
|
await GallerySaver.saveImage(widget
|
||||||
widget.urls[widget.currentPage].split('?')[0]);
|
.urls[widget.currentPage]
|
||||||
|
.split('?')[0]);
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
},
|
},
|
||||||
child: SizedBox.expand(
|
child: SizedBox.expand(
|
||||||
@@ -434,7 +435,8 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
autofocus: true,
|
autofocus: true,
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
isDense: true,
|
isDense: true,
|
||||||
prefixIconConstraints: BoxConstraints.tight(Size(38.0, 38.0)),
|
prefixIconConstraints:
|
||||||
|
BoxConstraints.tight(Size(38.0, 38.0)),
|
||||||
prefixIcon: Transform.scale(
|
prefixIcon: Transform.scale(
|
||||||
scale: 1.2,
|
scale: 1.2,
|
||||||
alignment: Alignment.center,
|
alignment: Alignment.center,
|
||||||
@@ -462,7 +464,10 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
width: 8.0,
|
width: 8.0,
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
icon: Icon(StreamIcons.close_circle, color: Colors.black.withOpacity(0.5),),
|
icon: Icon(
|
||||||
|
StreamIcons.close_circle,
|
||||||
|
color: Colors.black.withOpacity(0.5),
|
||||||
|
),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
modalSetState(() {
|
modalSetState(() {
|
||||||
_userSearchMode = false;
|
_userSearchMode = false;
|
||||||
@@ -533,98 +538,100 @@ class _ImageFooterState extends State<ImageFooter> {
|
|||||||
child: Container(
|
child: Container(
|
||||||
color: Colors.white,
|
color: Colors.white,
|
||||||
height: 56.0,
|
height: 56.0,
|
||||||
child: _loading ? Center(
|
child: _loading
|
||||||
child: Padding(
|
? Center(
|
||||||
padding: const EdgeInsets.all(8.0),
|
child: Padding(
|
||||||
child: CircularProgressIndicator(),
|
padding: const EdgeInsets.all(8.0),
|
||||||
),
|
child: CircularProgressIndicator(),
|
||||||
) : Row(
|
|
||||||
children: [
|
|
||||||
Expanded(
|
|
||||||
child: Padding(
|
|
||||||
padding: const EdgeInsets.only(left: 8.0),
|
|
||||||
child: TextField(
|
|
||||||
controller: _messageController,
|
|
||||||
onChanged: (val) {
|
|
||||||
modalSetState(() {});
|
|
||||||
},
|
|
||||||
onTap: () {
|
|
||||||
modalSetState(() {});
|
|
||||||
setState(() {});
|
|
||||||
},
|
|
||||||
decoration: InputDecoration(
|
|
||||||
isDense: true,
|
|
||||||
prefixText: ' ',
|
|
||||||
hintText: 'Add a comment',
|
|
||||||
border: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(32.0),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.black.withOpacity(0.16),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
focusedBorder: OutlineInputBorder(
|
|
||||||
borderRadius: BorderRadius.circular(32.0),
|
|
||||||
borderSide: BorderSide(
|
|
||||||
color: Colors.black.withOpacity(0.16),
|
|
||||||
)),
|
|
||||||
contentPadding: EdgeInsets.symmetric(vertical: 12.0),
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
),
|
)
|
||||||
),
|
: Row(
|
||||||
AnimatedCrossFade(
|
children: [
|
||||||
crossFadeState: _messageController.text.isNotEmpty
|
Expanded(
|
||||||
? CrossFadeState.showFirst
|
child: Padding(
|
||||||
: CrossFadeState.showSecond,
|
padding: const EdgeInsets.only(left: 8.0),
|
||||||
firstChild: IconTheme(
|
child: TextField(
|
||||||
data: StreamChatTheme.of(context)
|
controller: _messageController,
|
||||||
.channelTheme
|
onChanged: (val) {
|
||||||
.messageInputButtonIconTheme,
|
modalSetState(() {});
|
||||||
child: Center(
|
},
|
||||||
child: Padding(
|
onTap: () {
|
||||||
padding: const EdgeInsets.all(8.0),
|
modalSetState(() {});
|
||||||
child: InkWell(
|
setState(() {});
|
||||||
onTap: () async {
|
},
|
||||||
modalSetState(() {
|
decoration: InputDecoration(
|
||||||
_loading = true;
|
isDense: true,
|
||||||
});
|
prefixText: ' ',
|
||||||
await sendMessage();
|
hintText: 'Add a comment',
|
||||||
modalSetState(() {
|
border: OutlineInputBorder(
|
||||||
_loading = false;
|
borderRadius: BorderRadius.circular(32.0),
|
||||||
});
|
borderSide: BorderSide(
|
||||||
},
|
color: Colors.black.withOpacity(0.16),
|
||||||
child: Transform.rotate(
|
),
|
||||||
angle: -pi / 2,
|
),
|
||||||
child: Icon(
|
focusedBorder: OutlineInputBorder(
|
||||||
StreamIcons.send_message,
|
borderRadius: BorderRadius.circular(32.0),
|
||||||
color: StreamChatTheme.of(context).accentColor,
|
borderSide: BorderSide(
|
||||||
|
color: Colors.black.withOpacity(0.16),
|
||||||
|
)),
|
||||||
|
contentPadding: EdgeInsets.symmetric(vertical: 12.0),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
AnimatedCrossFade(
|
||||||
),
|
crossFadeState: _messageController.text.isNotEmpty
|
||||||
secondChild: IconTheme(
|
? CrossFadeState.showFirst
|
||||||
data: StreamChatTheme.of(context)
|
: CrossFadeState.showSecond,
|
||||||
.channelTheme
|
firstChild: IconTheme(
|
||||||
.messageInputButtonIconTheme,
|
data: StreamChatTheme.of(context)
|
||||||
child: Padding(
|
.channelTheme
|
||||||
padding: const EdgeInsets.all(8.0),
|
.messageInputButtonIconTheme,
|
||||||
child: Center(
|
child: Center(
|
||||||
child: InkWell(
|
child: Padding(
|
||||||
onTap: () {},
|
padding: const EdgeInsets.all(8.0),
|
||||||
child: Icon(
|
child: InkWell(
|
||||||
StreamIcons.send_message,
|
onTap: () async {
|
||||||
color: Colors.grey,
|
modalSetState(() {
|
||||||
|
_loading = true;
|
||||||
|
});
|
||||||
|
await sendMessage();
|
||||||
|
modalSetState(() {
|
||||||
|
_loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
child: Transform.rotate(
|
||||||
|
angle: -pi / 2,
|
||||||
|
child: Icon(
|
||||||
|
StreamIcons.send_message,
|
||||||
|
color: StreamChatTheme.of(context).accentColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
)),
|
secondChild: IconTheme(
|
||||||
),
|
data: StreamChatTheme.of(context)
|
||||||
|
.channelTheme
|
||||||
|
.messageInputButtonIconTheme,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(8.0),
|
||||||
|
child: Center(
|
||||||
|
child: InkWell(
|
||||||
|
onTap: () {},
|
||||||
|
child: Icon(
|
||||||
|
StreamIcons.send_message,
|
||||||
|
color: Colors.grey,
|
||||||
|
),
|
||||||
|
)),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
duration: Duration(milliseconds: 300),
|
||||||
|
alignment: Alignment.center,
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
duration: Duration(milliseconds: 300),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-10
@@ -113,16 +113,18 @@ class ImageGroup extends StatelessWidget {
|
|||||||
Navigator.push(
|
Navigator.push(
|
||||||
context,
|
context,
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) =>
|
builder: (context) => StreamChannel(
|
||||||
StreamChannel(
|
channel: channel,
|
||||||
channel: channel,
|
child: FullScreenImage(
|
||||||
child: FullScreenImage(urls: images.map((e) => e.imageUrl ?? e.thumbUrl ?? e.assetUrl).toList(),
|
urls: images
|
||||||
startIndex: index,
|
.map((e) => e.imageUrl ?? e.thumbUrl ?? e.assetUrl)
|
||||||
userName: message.user.name,
|
.toList(),
|
||||||
sentAt: message.createdAt,
|
startIndex: index,
|
||||||
message: message,
|
userName: message.user.name,
|
||||||
),
|
sentAt: message.createdAt,
|
||||||
),
|
message: message,
|
||||||
|
),
|
||||||
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user