Merge branch 'develop' into v4

This commit is contained in:
Salvatore Giordano
2022-04-29 16:24:12 +02:00
80 changed files with 607 additions and 180 deletions
@@ -2,22 +2,43 @@ import 'dart:async';
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/stream_attachment_package.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
import 'package:url_launcher/url_launcher.dart';
/// Launch URL
Future<void> launchURL(BuildContext context, String url) async {
if (await canLaunch(url)) {
await launch(url);
} else {
try {
await launch(Uri.parse(url).withScheme.toString());
} catch (e) {
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(content: Text(context.translations.launchUrlError)),
);
}
}
/// Get centerTitle considering a default and platform specific behaviour
bool getEffectiveCenterTitle(
ThemeData theme, {
bool? centerTitle,
List<Widget>? actions,
}) {
if (centerTitle != null) return centerTitle;
if (theme.appBarTheme.centerTitle != null) {
return theme.appBarTheme.centerTitle!;
}
switch (theme.platform) {
case TargetPlatform.android:
case TargetPlatform.fuchsia:
case TargetPlatform.linux:
case TargetPlatform.windows:
return false;
case TargetPlatform.iOS:
case TargetPlatform.macOS:
return actions == null || actions.length < 2;
}
}
/// Shows confirmation dialog
Future<bool?> showConfirmationDialog(
BuildContext context, {
@@ -433,8 +454,8 @@ int levenshtein(String s, String t, {bool caseSensitive = true}) {
/// An easy way to handle attachment related operations on a message
extension AttachmentPackagesX on Message {
/// This extension will return a List of type [StreamAttachmentPackage] from the
/// existing attachments of the message
/// This extension will return a List of type [StreamAttachmentPackage]
/// from the existing attachments of the message
List<StreamAttachmentPackage> getAttachmentPackageList() {
final _attachmentPackages = List<StreamAttachmentPackage>.generate(
attachments.length,