mirror of
https://github.com/Iconica-Development/flutter_chat.git
synced 2025-05-19 02:43:50 +02:00
fix: routing issues
This commit is contained in:
parent
5e4a9c7ab4
commit
61d901c741
8 changed files with 45 additions and 34 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
## 3.0.1
|
||||||
|
|
||||||
|
- fix bug where you could make multiple groups quickly by routing back to the previous screen
|
||||||
|
- fix bug where you would route back to the user selection screen insterad of routing back to the chat overview screen
|
||||||
|
|
||||||
## 3.0.0
|
## 3.0.0
|
||||||
|
|
||||||
- Add theming
|
- Add theming
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat/flutter_chat.dart';
|
import "package:flutter_chat/flutter_chat.dart";
|
||||||
|
|
||||||
/// Navigates to the chat user story screen.
|
/// Navigates to the chat user story screen.
|
||||||
///
|
///
|
||||||
|
@ -218,7 +218,7 @@ Widget _newChatScreenRoute(
|
||||||
if (configuration.onPressCreateChat != null) return;
|
if (configuration.onPressCreateChat != null) return;
|
||||||
var chat = await configuration.chatService.chatOverviewService
|
var chat = await configuration.chatService.chatOverviewService
|
||||||
.getChatByUser(user);
|
.getChatByUser(user);
|
||||||
debugPrint('Chat is ${chat.id}');
|
debugPrint("Chat is ${chat.id}");
|
||||||
if (chat.id == null) {
|
if (chat.id == null) {
|
||||||
chat = await configuration.chatService.chatOverviewService
|
chat = await configuration.chatService.chatOverviewService
|
||||||
.storeChatIfNot(
|
.storeChatIfNot(
|
||||||
|
@ -230,10 +230,13 @@ Widget _newChatScreenRoute(
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
await Navigator.of(context).push(
|
await Navigator.of(context).push(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => _chatDetailScreenRoute(
|
builder: (context) => PopScope(
|
||||||
configuration,
|
canPop: false,
|
||||||
context,
|
child: _chatDetailScreenRoute(
|
||||||
chat.id!,
|
configuration,
|
||||||
|
context,
|
||||||
|
chat.id!,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -279,17 +282,20 @@ Widget _newGroupChatOverviewScreenRoute(
|
||||||
GroupChatModel(
|
GroupChatModel(
|
||||||
canBeDeleted: true,
|
canBeDeleted: true,
|
||||||
title: groupChatName,
|
title: groupChatName,
|
||||||
imageUrl: 'https://picsum.photos/200/300',
|
imageUrl: "https://picsum.photos/200/300",
|
||||||
users: users,
|
users: users,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
await Navigator.of(context).pushReplacement(
|
await Navigator.of(context).pushReplacement(
|
||||||
MaterialPageRoute(
|
MaterialPageRoute(
|
||||||
builder: (context) => _chatDetailScreenRoute(
|
builder: (context) => PopScope(
|
||||||
configuration,
|
canPop: false,
|
||||||
context,
|
child: _chatDetailScreenRoute(
|
||||||
chat.id!,
|
configuration,
|
||||||
|
context,
|
||||||
|
chat.id!,
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: BSD-3-Clause
|
// SPDX-License-Identifier: BSD-3-Clause
|
||||||
|
|
||||||
import 'package:flutter/material.dart';
|
import "package:flutter/material.dart";
|
||||||
import 'package:flutter_chat/flutter_chat.dart';
|
import "package:flutter_chat/flutter_chat.dart";
|
||||||
import 'package:flutter_chat/src/go_router.dart';
|
import "package:flutter_chat/src/go_router.dart";
|
||||||
import 'package:go_router/go_router.dart';
|
import "package:go_router/go_router.dart";
|
||||||
|
|
||||||
List<GoRoute> getChatStoryRoutes(
|
List<GoRoute> getChatStoryRoutes(
|
||||||
ChatUserStoryConfiguration configuration,
|
ChatUserStoryConfiguration configuration,
|
||||||
|
@ -57,7 +57,7 @@ List<GoRoute> getChatStoryRoutes(
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: ChatUserStoryRoutes.chatDetailScreen,
|
path: ChatUserStoryRoutes.chatDetailScreen,
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
var chatId = state.pathParameters['id'];
|
var chatId = state.pathParameters["id"];
|
||||||
var service = configuration.chatServiceBuilder?.call(context) ??
|
var service = configuration.chatServiceBuilder?.call(context) ??
|
||||||
configuration.chatService;
|
configuration.chatService;
|
||||||
var theme = Theme.of(context);
|
var theme = Theme.of(context);
|
||||||
|
@ -156,7 +156,7 @@ List<GoRoute> getChatStoryRoutes(
|
||||||
}
|
}
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
await context.push(
|
await context.push(
|
||||||
ChatUserStoryRoutes.chatDetailViewPath(chat.id ?? ''),
|
ChatUserStoryRoutes.chatDetailViewPath(chat.id ?? ""),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -231,13 +231,13 @@ List<GoRoute> getChatStoryRoutes(
|
||||||
GroupChatModel(
|
GroupChatModel(
|
||||||
canBeDeleted: true,
|
canBeDeleted: true,
|
||||||
title: groupChatName,
|
title: groupChatName,
|
||||||
imageUrl: 'https://picsum.photos/200/300',
|
imageUrl: "https://picsum.photos/200/300",
|
||||||
users: users,
|
users: users,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
if (context.mounted) {
|
if (context.mounted) {
|
||||||
context.go(
|
context.go(
|
||||||
ChatUserStoryRoutes.chatDetailViewPath(chat.id ?? ''),
|
ChatUserStoryRoutes.chatDetailViewPath(chat.id ?? ""),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -259,9 +259,9 @@ List<GoRoute> getChatStoryRoutes(
|
||||||
GoRoute(
|
GoRoute(
|
||||||
path: ChatUserStoryRoutes.chatProfileScreen,
|
path: ChatUserStoryRoutes.chatProfileScreen,
|
||||||
pageBuilder: (context, state) {
|
pageBuilder: (context, state) {
|
||||||
var chatId = state.pathParameters['id'];
|
var chatId = state.pathParameters["id"];
|
||||||
var userId = state.pathParameters['userId'];
|
var userId = state.pathParameters["userId"];
|
||||||
var id = userId == 'null' ? null : userId;
|
var id = userId == "null" ? null : userId;
|
||||||
var service = configuration.chatServiceBuilder?.call(context) ??
|
var service = configuration.chatServiceBuilder?.call(context) ??
|
||||||
configuration.chatService;
|
configuration.chatService;
|
||||||
var theme = Theme.of(context);
|
var theme = Theme.of(context);
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
name: flutter_chat
|
name: flutter_chat
|
||||||
description: A new Flutter package project.
|
description: A new Flutter package project.
|
||||||
version: 3.0.0
|
version: 3.0.1
|
||||||
|
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
|
@ -20,17 +20,17 @@ dependencies:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_chat
|
url: https://github.com/Iconica-Development/flutter_chat
|
||||||
path: packages/flutter_chat_view
|
path: packages/flutter_chat_view
|
||||||
ref: 3.0.0
|
ref: 3.0.1
|
||||||
flutter_chat_interface:
|
flutter_chat_interface:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_chat
|
url: https://github.com/Iconica-Development/flutter_chat
|
||||||
path: packages/flutter_chat_interface
|
path: packages/flutter_chat_interface
|
||||||
ref: 3.0.0
|
ref: 3.0.1
|
||||||
flutter_chat_local:
|
flutter_chat_local:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_chat
|
url: https://github.com/Iconica-Development/flutter_chat
|
||||||
path: packages/flutter_chat_local
|
path: packages/flutter_chat_local
|
||||||
ref: 3.0.0
|
ref: 3.0.1
|
||||||
uuid: ^4.3.3
|
uuid: ^4.3.3
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
name: flutter_chat_firebase
|
name: flutter_chat_firebase
|
||||||
description: A new Flutter package project.
|
description: A new Flutter package project.
|
||||||
version: 3.0.0
|
version: 3.0.1
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
@ -23,7 +23,7 @@ dependencies:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_chat
|
url: https://github.com/Iconica-Development/flutter_chat
|
||||||
path: packages/flutter_chat_interface
|
path: packages/flutter_chat_interface
|
||||||
ref: 3.0.0
|
ref: 3.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_iconica_analysis:
|
flutter_iconica_analysis:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
name: flutter_chat_interface
|
name: flutter_chat_interface
|
||||||
description: A new Flutter package project.
|
description: A new Flutter package project.
|
||||||
version: 3.0.0
|
version: 3.0.1
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
name: flutter_chat_local
|
name: flutter_chat_local
|
||||||
description: "A new Flutter package project."
|
description: "A new Flutter package project."
|
||||||
version: 3.0.0
|
version: 3.0.1
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
|
@ -14,7 +14,7 @@ dependencies:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_chat
|
url: https://github.com/Iconica-Development/flutter_chat
|
||||||
path: packages/flutter_chat_interface
|
path: packages/flutter_chat_interface
|
||||||
ref: 3.0.0
|
ref: 3.0.1
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
flutter_test:
|
flutter_test:
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
name: flutter_chat_view
|
name: flutter_chat_view
|
||||||
description: A standard flutter package.
|
description: A standard flutter package.
|
||||||
version: 3.0.0
|
version: 3.0.1
|
||||||
|
|
||||||
publish_to: none
|
publish_to: none
|
||||||
|
|
||||||
|
@ -20,7 +20,7 @@ dependencies:
|
||||||
git:
|
git:
|
||||||
url: https://github.com/Iconica-Development/flutter_chat
|
url: https://github.com/Iconica-Development/flutter_chat
|
||||||
path: packages/flutter_chat_interface
|
path: packages/flutter_chat_interface
|
||||||
ref: 3.0.0
|
ref: 3.0.1
|
||||||
cached_network_image: ^3.2.2
|
cached_network_image: ^3.2.2
|
||||||
flutter_image_picker:
|
flutter_image_picker:
|
||||||
git:
|
git:
|
||||||
|
|
Loading…
Reference in a new issue