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
@@ -5,6 +5,7 @@ import 'package:flutter_svg/flutter_svg.dart';
import 'package:photo_manager/photo_manager.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/src/media_list_view.dart';
import 'package:stream_chat_flutter/src/media_list_view_controller.dart';
import 'package:stream_chat_flutter/stream_chat_flutter.dart';
/// Callback for when a file has to be picked.
@@ -113,6 +114,7 @@ class StreamAttachmentPicker extends StatefulWidget {
class _StreamAttachmentPickerState extends State<StreamAttachmentPicker> {
int _filePickerIndex = 0;
final _mediaListViewController = MediaListViewController();
@override
Widget build(BuildContext context) {
@@ -281,6 +283,26 @@ class _StreamAttachmentPickerState extends State<StreamAttachmentPicker> {
),
],
),
const Spacer(),
FutureBuilder(
future: PhotoManager.requestPermissionExtend(),
builder: (context, snapshot) {
if (snapshot.hasData &&
snapshot.data == PermissionState.limited) {
return TextButton(
child: Text(context.translations.viewLibrary),
onPressed: () async {
await PhotoManager.presentLimited();
_mediaListViewController.updateMedia(
newValue: true,
);
},
);
}
return const SizedBox.shrink();
},
),
DecoratedBox(
decoration: BoxDecoration(
color: _streamChatTheme.colorTheme.barsBg,
@@ -315,6 +337,7 @@ class _StreamAttachmentPickerState extends State<StreamAttachmentPicker> {
borderRadius: BorderRadius.circular(8),
),
child: _PickerWidget(
mediaListViewController: _mediaListViewController,
filePickerIndex: _filePickerIndex,
streamChatTheme: _streamChatTheme,
containsFile: _attachmentContainsFile,
@@ -410,6 +433,7 @@ class _PickerWidget extends StatefulWidget {
required this.streamChatTheme,
required this.allowedAttachmentTypes,
required this.customAttachmentTypes,
required this.mediaListViewController,
}) : super(key: key);
final int filePickerIndex;
@@ -420,6 +444,7 @@ class _PickerWidget extends StatefulWidget {
final StreamChatThemeData streamChatTheme;
final List<DefaultAttachmentTypes> allowedAttachmentTypes;
final List<CustomAttachmentType> customAttachmentTypes;
final MediaListViewController mediaListViewController;
@override
_PickerWidgetState createState() => _PickerWidgetState();
@@ -473,6 +498,7 @@ class _PickerWidgetState extends State<_PickerWidget> {
return StreamMediaListView(
selectedIds: widget.selectedMedias,
onSelect: widget.onMediaSelected,
controller: widget.mediaListViewController,
);
}
@@ -13,7 +13,6 @@ import 'package:stream_chat_flutter/src/commands_overlay.dart';
import 'package:stream_chat_flutter/src/emoji/emoji.dart';
import 'package:stream_chat_flutter/src/emoji_overlay.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/src/multi_overlay.dart';
import 'package:stream_chat_flutter/src/quoted_message_widget.dart';
import 'package:stream_chat_flutter/src/user_mentions_overlay.dart';
import 'package:stream_chat_flutter/src/v4/message_input/simple_safe_area.dart';
@@ -437,7 +437,7 @@ class StreamMessageTextField extends StatefulWidget {
/// This setting is only honored on iOS devices.
///
/// If unset, defaults to the brightness of
/// [ThemeData.primaryColorBrightness].
/// [ThemeData.brightness].
final Brightness? keyboardAppearance;
/// {@macro flutter.widgets.editableText.scrollPadding}
@@ -158,7 +158,8 @@ class StreamChannelGridView extends StatelessWidget {
/// only scroll the view if it has sufficient content. See [physics].
///
/// Also when true, the scroll view is used for default [ScrollAction]s. If a
/// ScrollAction is not handled by an otherwise focused part of the application,
/// ScrollAction is not handled by
/// an otherwise focused part of the application,
/// the ScrollAction will be evaluated using this scroll view, for example,
/// when executing [Shortcuts] key events like page up and down.
///
@@ -288,7 +289,8 @@ class StreamChannelGridView extends StatelessWidget {
///
/// See also:
///
/// * [SemanticsConfiguration.scrollChildCount], the corresponding semantics property.
/// * [SemanticsConfiguration.scrollChildCount],
/// the corresponding semantics property.
final int? semanticChildCount;
/// {@macro flutter.widgets.scrollable.dragStartBehavior}
@@ -2,7 +2,6 @@ import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_empty_widget.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_error_widget.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_load_more_error.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_load_more_indicator.dart';
@@ -75,7 +74,8 @@ class StreamMessageSearchGridView extends StatelessWidget {
/// A builder that is called to build items in the [PagedValueGridView].
///
/// The `value` parameter is the [GetMessageBuilder] at this position in the grid.
/// The `value` parameter is the [GetMessageBuilder]
/// at this position in the grid.
final StreamMessageSearchGridViewIndexedWidgetBuilder itemBuilder;
/// A builder that is called to build the empty state of the grid.
@@ -144,7 +144,8 @@ class StreamMessageSearchGridView extends StatelessWidget {
/// only scroll the view if it has sufficient content. See [physics].
///
/// Also when true, the scroll view is used for default [ScrollAction]s. If a
/// ScrollAction is not handled by an otherwise focused part of the application,
/// ScrollAction is not handled by
/// an otherwise focused part of the application,
/// the ScrollAction will be evaluated using this scroll view, for example,
/// when executing [Shortcuts] key events like page up and down.
///
@@ -274,7 +275,8 @@ class StreamMessageSearchGridView extends StatelessWidget {
///
/// See also:
///
/// * [SemanticsConfiguration.scrollChildCount], the corresponding semantics property.
/// * [SemanticsConfiguration.scrollChildCount],
/// the corresponding semantics property.
final int? semanticChildCount;
/// {@macro flutter.widgets.scrollable.dragStartBehavior}
@@ -1,7 +1,8 @@
// ignore_for_file: deprecated_member_use_from_same_package
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_empty_widget.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_error_widget.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_load_more_error.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_load_more_indicator.dart';
@@ -1,7 +1,6 @@
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_empty_widget.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_error_widget.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_load_more_error.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_load_more_indicator.dart';
@@ -152,7 +151,8 @@ class StreamUserGridView extends StatelessWidget {
/// only scroll the view if it has sufficient content. See [physics].
///
/// Also when true, the scroll view is used for default [ScrollAction]s. If a
/// ScrollAction is not handled by an otherwise focused part of the application,
/// ScrollAction is not handled by
/// an otherwise focused part of the application,
/// the ScrollAction will be evaluated using this scroll view, for example,
/// when executing [Shortcuts] key events like page up and down.
///
@@ -282,7 +282,8 @@ class StreamUserGridView extends StatelessWidget {
///
/// See also:
///
/// * [SemanticsConfiguration.scrollChildCount], the corresponding semantics property.
/// * [SemanticsConfiguration.scrollChildCount],
/// the corresponding semantics property.
final int? semanticChildCount;
/// {@macro flutter.widgets.scrollable.dragStartBehavior}
@@ -48,10 +48,11 @@ class StreamUserListTile extends StatelessWidget {
/// A widget to display at the end of tile.
final Widget? selectedWidget;
/// If this tile is also [enabled] then icons and text are rendered with the same color.
/// If this tile is also [enabled] then icons
/// and text are rendered with the same color.
///
/// By default the selected color is the theme's primary color. The selected color
/// can be overridden with a [ListTileTheme].
/// By default the selected color is the theme's primary color.
/// The selected color can be overridden with a [ListTileTheme].
///
/// {@tool dartpad}
/// Here is an example of using a [StatefulWidget] to keep track of the
@@ -1,7 +1,8 @@
// ignore_for_file: deprecated_member_use_from_same_package
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:stream_chat_flutter/src/extension.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_empty_widget.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_error_widget.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_load_more_error.dart';
import 'package:stream_chat_flutter/src/v4/scroll_view/stream_scroll_view_load_more_indicator.dart';