add file size limit parameter
This commit is contained in:
@@ -70,7 +70,12 @@ class MyApp extends StatelessWidget {
|
||||
Widget build(BuildContext context) => MaterialApp(
|
||||
theme: ThemeData.light(),
|
||||
darkTheme: ThemeData.dark(),
|
||||
supportedLocales: const [Locale('en'), Locale('hi')],
|
||||
supportedLocales: const [
|
||||
Locale('en'),
|
||||
Locale('hi'),
|
||||
Locale('fr'),
|
||||
Locale('it'),
|
||||
],
|
||||
localizationsDelegates: GlobalStreamChatLocalizations.delegates,
|
||||
builder: (context, widget) => StreamChat(
|
||||
client: client,
|
||||
|
||||
@@ -67,9 +67,9 @@ abstract class Translations {
|
||||
|
||||
String get instantCommandsLabel;
|
||||
|
||||
String get fileTooLargeAfterCompressionError;
|
||||
String fileTooLargeAfterCompressionError(double limitInMB);
|
||||
|
||||
String get fileTooLargeError;
|
||||
String fileTooLargeError(double limitInMB);
|
||||
|
||||
String emojiMatchingQueryText(String query);
|
||||
|
||||
@@ -314,14 +314,14 @@ class DefaultTranslations implements Translations {
|
||||
String get instantCommandsLabel => 'Instant Commands';
|
||||
|
||||
@override
|
||||
String get fileTooLargeAfterCompressionError =>
|
||||
String fileTooLargeAfterCompressionError(double limitInMB) =>
|
||||
'The file is too large to upload. '
|
||||
'The file size limit is 20MB. '
|
||||
'The file size limit is $limitInMB MB. '
|
||||
'We tried compressing it, but it was not enough.';
|
||||
|
||||
@override
|
||||
String get fileTooLargeError =>
|
||||
'The file is too large to upload. The file size limit is 20MB.';
|
||||
String fileTooLargeError(double limitInMB) =>
|
||||
'The file is too large to upload. The file size limit is $limitInMB MB.';
|
||||
|
||||
@override
|
||||
String emojiMatchingQueryText(String query) => 'Emoji matching "$query"';
|
||||
|
||||
@@ -1144,7 +1144,9 @@ class MessageInputState extends State<MessageInput> {
|
||||
|
||||
if (mediaInfo.filesize! > widget.maxAttachmentSize) {
|
||||
_showErrorAlert(
|
||||
context.translations.fileTooLargeAfterCompressionError,
|
||||
context.translations.fileTooLargeAfterCompressionError(
|
||||
widget.maxAttachmentSize / (1024 * 1024),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -1155,7 +1157,9 @@ class MessageInputState extends State<MessageInput> {
|
||||
path: mediaInfo.path,
|
||||
);
|
||||
} else {
|
||||
_showErrorAlert(context.translations.fileTooLargeError);
|
||||
_showErrorAlert(context.translations.fileTooLargeError(
|
||||
widget.maxAttachmentSize / (1024 * 1024),
|
||||
));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1922,7 +1926,9 @@ class MessageInputState extends State<MessageInput> {
|
||||
|
||||
if (mediaInfo.filesize! > widget.maxAttachmentSize) {
|
||||
_showErrorAlert(
|
||||
context.translations.fileTooLargeAfterCompressionError,
|
||||
context.translations.fileTooLargeAfterCompressionError(
|
||||
widget.maxAttachmentSize / (1024 * 1024),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -1933,7 +1939,9 @@ class MessageInputState extends State<MessageInput> {
|
||||
path: mediaInfo.path,
|
||||
);
|
||||
} else {
|
||||
_showErrorAlert(context.translations.fileTooLargeError);
|
||||
_showErrorAlert(context.translations.fileTooLargeError(
|
||||
widget.maxAttachmentSize / (1024 * 1024),
|
||||
));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user