Skip to content

Instantly share code, notes, and snippets.

View alperefesahin's full-sized avatar
😄

Alper Efe Şahin alperefesahin

😄
View GitHub Profile
import 'package:equatable/equatable.dart';
abstract class NotificationEvent extends Equatable {
const NotificationEvent();
@override
List<Object> get props => [];
}
class InitNotificationEvent extends NotificationEvent {
class ExampleState extends Equatable {
const ExampleState({
this.user = const User(),
this.isLoading = false,
});
@override
List<Object?> get props => [
user,
isLoading,
class AppWidget extends StatelessWidget {
const AppWidget({super.key});
@override
Widget build(BuildContext context) {
return const MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Responsive Flutter UI App',
home: ResponsiveLayout(
mobileLayout: MobileChatsPage(),
class ResponsiveLayout extends StatelessWidget {
const ResponsiveLayout({
super.key,
required this.mobileLayout,
required this.desktopLayout,
});
final Widget mobileLayout;
final Widget desktopLayout;
MaterialApp.router(
debugShowCheckedModeBanner: false,
routerConfig: appRouter.router,
localizationsDelegates: const [...],
supportedLocales: const [...],
builder: (context, child) {
final client = getIt<StreamChatClient>();
child = StreamChat(
client: client,
builder: (context, child) {
final client = getIt<StreamChatClient>();
child = StreamChat(
client: client,
child: child,
);
child = botToastBuilder(context, child);
return child;
bool searchInsideExistingChannels({
required List<Channel> listOfChannels,
required String searchedText,
required int index,
required int lengthOfTheChannelMembers,
required User oneToOneChatMember,
}) {
int result;
final editedSearchedText = searchedText.toLowerCase().trim();
void selectUserToSendCapturedPhoto({
required User user,
required int userIndex,
}) {
final listOfSelectedUserIDs = {...state.listOfSelectedUserIDs};
if (listOfSelectedUserIDs.isEmpty) {
listOfSelectedUserIDs.add(user.id);
}
void selectUserWhenCreatingAGroup({
required User user,
required bool isCreateNewChatPageForCreatingGroup,
}) {
final listOfSelectedUserIDs = {...state.listOfSelectedUserIDs};
final listOfSelectedUsers = {...state.listOfSelectedUsers};
if (!isCreateNewChatPageForCreatingGroup) {
if (listOfSelectedUserIDs.isEmpty) {
listOfSelectedUserIDs.add(user.id);
Future<void> createNewChannel({
required bool isCreateNewChatPageForCreatingGroup,
}) async {
if (state.isInProgress) {
return;
}
String channelImageUrl = "";
String channelName = state.channelName;
final listOfMemberIDs = {...state.listOfSelectedUserIDs};