update to flutter 3.0

This commit is contained in:
Salvatore Giordano
2022-05-18 11:56:52 +02:00
parent 3e2bc56909
commit d4505620ff
5 changed files with 79 additions and 46 deletions
+37 -2
View File
@@ -1,10 +1,45 @@
# This file tracks properties of this Flutter project. # This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc. # Used by Flutter tool to assess capabilities and perform upgrades etc.
# #
# This file should be version controlled and should not be manually edited. # This file should be version controlled.
version: version:
revision: 8962f6dc68ec8e2206ac2fa874da4a453856c7d3 revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
channel: stable channel: stable
project_type: app project_type: app
# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: android
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: ios
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: linux
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: macos
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: web
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
- platform: windows
create_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
base_revision: ee4e09cce01d6f2d7f4baebd247fde02e5008851
# User provided section
# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
@@ -35,7 +35,8 @@ class ChannelPage extends StatefulWidget {
class _ChannelPageState extends State<ChannelPage> { class _ChannelPageState extends State<ChannelPage> {
FocusNode? _focusNode; FocusNode? _focusNode;
StreamMessageInputController _messageInputController = StreamMessageInputController(); StreamMessageInputController _messageInputController =
StreamMessageInputController();
@override @override
void initState() { void initState() {
@@ -51,7 +52,7 @@ class _ChannelPageState extends State<ChannelPage> {
void _reply(Message message) { void _reply(Message message) {
_messageInputController.quotedMessage = message; _messageInputController.quotedMessage = message;
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_focusNode!.requestFocus(); _focusNode!.requestFocus();
}); });
} }
@@ -41,28 +41,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
late final channel = StreamChannel.of(context).channel; late final channel = StreamChannel.of(context).channel;
late final userListController = StreamUserListController( late StreamUserListController userListController;
client: StreamChat.of(context).client,
limit: 25,
filter: Filter.and(
[
if (_searchController!.text.isNotEmpty)
Filter.autoComplete('name', _userNameQuery),
Filter.notIn('id', [
StreamChat.of(context).currentUser!.id,
...channel.state!.members
.map<String?>(((e) => e.userId))
.whereType<String>(),
]),
],
),
sort: [
SortOption(
'name',
direction: 1,
),
],
);
void _userNameListener() { void _userNameListener() {
if (_searchController!.text == _userNameQuery) { if (_searchController!.text == _userNameQuery) {
@@ -104,6 +83,33 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
mutedBool = ValueNotifier(channel.isMuted); mutedBool = ValueNotifier(channel.isMuted);
} }
@override
void didChangeDependencies() {
userListController = StreamUserListController(
client: StreamChat.of(context).client,
limit: 25,
filter: Filter.and(
[
if (_searchController!.text.isNotEmpty)
Filter.autoComplete('name', _userNameQuery),
Filter.notIn('id', [
StreamChat.of(context).currentUser!.id,
...channel.state!.members
.map<String?>(((e) => e.userId))
.whereType<String>(),
]),
],
),
sort: [
SortOption(
'name',
direction: 1,
),
],
);
super.didChangeDependencies();
}
@override @override
void dispose() { void dispose() {
userListController.dispose(); userListController.dispose();
@@ -220,7 +226,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
Widget _buildMembers(List<Member> members) { Widget _buildMembers(List<Member> members) {
final groupMembers = members final groupMembers = members
..sort((prev, curr) { ..sort((prev, curr) {
if (curr.role == 'owner') return 1; if (curr.userId == channel.createdBy?.id) return 1;
return 0; return 0;
}); });
@@ -246,7 +252,8 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
final userMember = groupMembers.firstWhereOrNull( final userMember = groupMembers.firstWhereOrNull(
(e) => e.user!.id == StreamChat.of(context).currentUser!.id, (e) => e.user!.id == StreamChat.of(context).currentUser!.id,
); );
_showUserInfoModal(member.user, userMember?.role == 'owner'); _showUserInfoModal(
member.user, userMember?.userId == channel.createdBy?.id);
}, },
child: Container( child: Container(
height: 65.0, height: 65.0,
@@ -293,7 +300,7 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
Padding( Padding(
padding: const EdgeInsets.all(8.0), padding: const EdgeInsets.all(8.0),
child: Text( child: Text(
member.role == 'owner' member.userId == channel.createdBy?.id
? AppLocalizations.of(context).owner ? AppLocalizations.of(context).owner
: '', : '',
style: TextStyle( style: TextStyle(
@@ -920,18 +927,6 @@ class _GroupInfoScreenState extends State<GroupInfoScreen> {
); );
}, },
), ),
// if (!channel.isDistinct &&
// StreamChat.of(context).user!.id != user.id &&
// isUserAdmin)
// _buildModalListTile(
// context,
// StreamSvgIcon.iconUserSettings(
// color: StreamChatTheme.of(context).colorTheme.textLowEmphasis,
// size: 24.0,
// ),
// 'Make Owner', () {
// // TODO: Add make owner implementation (Remaining from backend)
// }),
if (!channel.isDistinct && if (!channel.isDistinct &&
StreamChat.of(context).currentUser!.id != user.id && StreamChat.of(context).currentUser!.id != user.id &&
isUserAdmin) isUserAdmin)
+2 -2
View File
@@ -36,7 +36,7 @@ void sampleAppLogHandler(LogRecord record) async {
StreamChatClient buildStreamChatClient( StreamChatClient buildStreamChatClient(
String apiKey, { String apiKey, {
Level logLevel = Level.SEVERE, Level logLevel = Level.INFO,
}) { }) {
return StreamChatClient( return StreamChatClient(
apiKey, apiKey,
@@ -129,7 +129,7 @@ class _MyAppState extends State<MyApp>
final now = DateTime.now().millisecondsSinceEpoch; final now = DateTime.now().millisecondsSinceEpoch;
if (now - timeOfStartMs > 1500) { if (now - timeOfStartMs > 1500) {
SchedulerBinding.instance!.addPostFrameCallback((timeStamp) { SchedulerBinding.instance.addPostFrameCallback((timeStamp) {
forwardAnimations(); forwardAnimations();
}); });
} else { } else {
+5 -3
View File
@@ -24,8 +24,10 @@ class _ThreadPageState extends State<ThreadPage> {
@override @override
void initState() { void initState() {
super.initState(); super.initState();
_messageInputController = _messageInputController = StreamMessageInputController(
StreamMessageInputController(message: widget.parent); message: Message(
parentId: widget.parent.id,
));
} }
@override @override
@@ -36,7 +38,7 @@ class _ThreadPageState extends State<ThreadPage> {
void _reply(Message message) { void _reply(Message message) {
_messageInputController.quotedMessage = message; _messageInputController.quotedMessage = message;
WidgetsBinding.instance!.addPostFrameCallback((timeStamp) { WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_focusNode.requestFocus(); _focusNode.requestFocus();
}); });
} }