chore: minor fixes, add support for "hi" locale
Signed-off-by: xsahil03x <[email protected]>
This commit is contained in:
@@ -70,6 +70,10 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) => MaterialApp(
|
||||
theme: ThemeData.light(),
|
||||
darkTheme: ThemeData.dark(),
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('hi'),
|
||||
],
|
||||
localizationsDelegates: const [
|
||||
GlobalStreamChatLocalizations.delegate,
|
||||
GlobalCupertinoLocalizations.delegate,
|
||||
|
||||
@@ -84,8 +84,8 @@ class ChannelInfo extends StatelessWidget {
|
||||
);
|
||||
} else {
|
||||
alternativeWidget = Text(
|
||||
context.translations.userLastOnlineText +
|
||||
Jiffy(otherMember.user?.lastActive).fromNow(),
|
||||
'${context.translations.userLastOnlineText} '
|
||||
'${Jiffy(otherMember.user?.lastActive).fromNow()}',
|
||||
style: textStyle,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -198,7 +198,7 @@ class ChannelPreview extends StatelessWidget {
|
||||
size: 16,
|
||||
),
|
||||
Text(
|
||||
context.translations.channelIsMutedText,
|
||||
' ${context.translations.channelIsMutedText}',
|
||||
style: chatThemeData.channelPreviewTheme.subtitle,
|
||||
),
|
||||
],
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'dart:io';
|
||||
import 'package:cached_network_image/cached_network_image.dart';
|
||||
import 'package:chewie/chewie.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:photo_view/photo_view.dart';
|
||||
import 'package:stream_chat_flutter/src/gallery_footer.dart';
|
||||
import 'package:stream_chat_flutter/src/gallery_header.dart';
|
||||
@@ -183,7 +182,6 @@ class _FullScreenMediaState extends State<FullScreenMedia>
|
||||
children: [
|
||||
GalleryHeader(
|
||||
userName: widget.userName,
|
||||
// TODO: Fix this
|
||||
sentAt: context.translations.sentAtText(
|
||||
date: widget.message.createdAt,
|
||||
time: widget.message.createdAt,
|
||||
@@ -225,22 +223,6 @@ class _FullScreenMediaState extends State<FullScreenMedia>
|
||||
),
|
||||
);
|
||||
|
||||
String getDay(DateTime dateTime) {
|
||||
final now = DateTime.now();
|
||||
|
||||
if (DateTime(dateTime.year, dateTime.month, dateTime.day) ==
|
||||
DateTime(now.year, now.month, now.day)) {
|
||||
return 'today';
|
||||
} else if (DateTime(now.year, now.month, now.day)
|
||||
.difference(dateTime)
|
||||
.inHours <
|
||||
24) {
|
||||
return 'yesterday';
|
||||
} else {
|
||||
return 'on ${Jiffy(dateTime).MMMd}';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() async {
|
||||
for (final package in videoPackages.values) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart'
|
||||
show User;
|
||||
|
||||
@@ -146,11 +147,6 @@ abstract class Translations {
|
||||
|
||||
String get loadingChannelsError;
|
||||
|
||||
// title: 'Delete Conversation',
|
||||
// okText: 'DELETE',
|
||||
// question:
|
||||
// 'Are you sure you want to delete this conversation?',
|
||||
|
||||
String get deleteConversationLabel;
|
||||
|
||||
String get deleteConversationQuestion;
|
||||
@@ -274,7 +270,7 @@ class DefaultTranslations implements Translations {
|
||||
String resultCountText(int count) => '$count results';
|
||||
|
||||
@override
|
||||
String get messageDeletedText => 'This message was deleted.';
|
||||
String get messageDeletedText => 'This message is deleted.';
|
||||
|
||||
@override
|
||||
String get messageDeletedLabel => 'Message deleted';
|
||||
@@ -428,9 +424,22 @@ class DefaultTranslations implements Translations {
|
||||
@override
|
||||
String get photosLabel => 'Photos';
|
||||
|
||||
String _getDay(DateTime dateTime) {
|
||||
final now = Jiffy(DateTime.now());
|
||||
final date = Jiffy(dateTime);
|
||||
|
||||
if (date.isSame(now, Units.DAY)) {
|
||||
return 'today';
|
||||
} else if (now.diff(date, Units.HOUR) < 24) {
|
||||
return 'yesterday';
|
||||
} else {
|
||||
return 'on ${date.MMMd}';
|
||||
}
|
||||
}
|
||||
|
||||
@override
|
||||
String sentAtText({required DateTime date, required DateTime time}) =>
|
||||
'Sent $date at $time';
|
||||
'Sent ${_getDay(date)} at ${Jiffy(time.toLocal()).format('HH:mm')}';
|
||||
|
||||
@override
|
||||
String get todayLabel => 'Today';
|
||||
@@ -439,7 +448,7 @@ class DefaultTranslations implements Translations {
|
||||
String get yesterdayLabel => 'Yesterday';
|
||||
|
||||
@override
|
||||
String get channelIsMutedText => ' Channel is muted';
|
||||
String get channelIsMutedText => 'Channel is muted';
|
||||
|
||||
@override
|
||||
String get noTitleText => 'No title';
|
||||
|
||||
@@ -92,8 +92,8 @@ class UserItem extends StatelessWidget {
|
||||
return Text(
|
||||
user.online == true
|
||||
? context.translations.userOnlineText
|
||||
: context.translations.userLastOnlineText +
|
||||
Jiffy(user.lastActive).fromNow(),
|
||||
: '${context.translations.userLastOnlineText} '
|
||||
'${Jiffy(user.lastActive).fromNow()}',
|
||||
style: chatTheme.textTheme.footnote.copyWith(
|
||||
color: chatTheme.colorTheme.textHighEmphasis.withOpacity(.5)),
|
||||
);
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
export 'package:jiffy/jiffy.dart';
|
||||
export 'package:stream_chat_flutter_core/stream_chat_flutter_core.dart';
|
||||
|
||||
export 'src/attachment/attachment.dart';
|
||||
@@ -16,6 +17,7 @@ export 'src/gallery_footer.dart';
|
||||
export 'src/gallery_header.dart';
|
||||
export 'src/info_tile.dart';
|
||||
export 'src/localization/stream_chat_localizations.dart';
|
||||
export 'src/localization/translations.dart' show DefaultTranslations;
|
||||
export 'src/mention_tile.dart';
|
||||
export 'src/message_action.dart';
|
||||
export 'src/message_input.dart';
|
||||
|
||||
Reference in New Issue
Block a user