Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Categorized Sub-spaces and Sub-chats #2168

Open
wants to merge 61 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
983348f
Setup sub-space screen and routing
kumarpalsinh25 Sep 10, 2024
2fed2fe
Setup AppBar Component
kumarpalsinh25 Sep 10, 2024
10927ee
Setup Categories Data Providers
kumarpalsinh25 Sep 10, 2024
1ccd46d
Merge branch 'main' into kumar/categorised-spaces
kumarpalsinh25 Sep 10, 2024
7cd3c32
Added dummy data for testing
kumarpalsinh25 Sep 11, 2024
b11e15e
Implemented ExpandedList List to view dummy categories data
kumarpalsinh25 Sep 11, 2024
24581e5
Added category icon and color data in dummy list
kumarpalsinh25 Sep 11, 2024
ae2ee1b
Optimised dummy data function
kumarpalsinh25 Sep 11, 2024
419e84d
Setup Categories List with Dummy Data
kumarpalsinh25 Sep 11, 2024
48342cf
Merge remote-tracking branch 'origin/kumar/categorised-spaces' into k…
kumarpalsinh25 Sep 11, 2024
54ef622
entries are a vec
gnunicorn Sep 11, 2024
e3ba54e
Minor usage pattern fix to ensure consistentency and improved memory …
gnunicorn Sep 11, 2024
11742d0
Added space card UI for categories entries data
kumarpalsinh25 Sep 12, 2024
81b81b9
Added https://pub.dev/packages/drag_and_drop_lists
kumarpalsinh25 Sep 12, 2024
aa4ab11
Manage Organised view toggle
kumarpalsinh25 Sep 12, 2024
9850b66
Added action buttons in Organised view
kumarpalsinh25 Sep 12, 2024
6b33414
Code Refactoring to manage categories in generic way
kumarpalsinh25 Sep 12, 2024
fe12753
Save updated categories data
kumarpalsinh25 Sep 12, 2024
5a01b6c
Minor UI Fix
kumarpalsinh25 Sep 12, 2024
66efc97
Save categories order
kumarpalsinh25 Sep 12, 2024
ec58103
Updated dummy categories data
kumarpalsinh25 Sep 12, 2024
febaec4
Fixes the bug related to category order management
kumarpalsinh25 Sep 12, 2024
44fa3d9
Improve code structure by using LocalCategory Model class to manage c…
kumarpalsinh25 Sep 16, 2024
04045cf
Manage actual space list with categories and un-categories data
kumarpalsinh25 Sep 16, 2024
f64e905
Fixed lint error
kumarpalsinh25 Sep 16, 2024
85617e2
Add category flow
kumarpalsinh25 Sep 17, 2024
cb70089
Menu options to category and general structure changes in space listing
kumarpalsinh25 Sep 17, 2024
ef0c960
Minor UI Change
kumarpalsinh25 Sep 17, 2024
f5a27d4
Manage add and delete category with local state
kumarpalsinh25 Sep 17, 2024
ed06801
Moved Organized category as separate screen
kumarpalsinh25 Sep 17, 2024
14bc624
Added relevant title
kumarpalsinh25 Sep 17, 2024
07e5af2
Edit category draft work
kumarpalsinh25 Sep 17, 2024
808749c
Edit category draft work
kumarpalsinh25 Sep 17, 2024
61d0663
Edit category
kumarpalsinh25 Sep 17, 2024
bb86ef2
Minor wording corrections
kumarpalsinh25 Sep 17, 2024
0da2c35
Don't show category which don't have any entries
kumarpalsinh25 Sep 17, 2024
cb3d15c
Minor fixes
kumarpalsinh25 Sep 18, 2024
7e30d60
Manage local category list with provider
kumarpalsinh25 Sep 18, 2024
a89e61e
General code improvement
kumarpalsinh25 Sep 18, 2024
7d40b78
General code improvement
kumarpalsinh25 Sep 18, 2024
802f2fe
General code improvement
kumarpalsinh25 Sep 18, 2024
8fd2784
General code improvement
kumarpalsinh25 Sep 18, 2024
d9f5c26
Save organize categories on back and manage delete categories entries
kumarpalsinh25 Sep 18, 2024
b746951
Minor fixes
kumarpalsinh25 Sep 18, 2024
aa49437
Wording correction
kumarpalsinh25 Sep 18, 2024
d9d5952
Dummy category validation code improvement
kumarpalsinh25 Sep 18, 2024
1b65cc3
Wording improvement
kumarpalsinh25 Sep 18, 2024
969e39d
Fixed last category item view cut issue
kumarpalsinh25 Sep 18, 2024
7b718ed
Merge branch 'main' into kumar/categorised-spaces
kumarpalsinh25 Sep 18, 2024
c0bb187
Changes related to merge with main
kumarpalsinh25 Sep 18, 2024
dbb070f
Remove older sub-spaces page
kumarpalsinh25 Sep 18, 2024
4e9be4a
Added RoomCard menu options
kumarpalsinh25 Sep 18, 2024
6fcf12d
Added entries at begin which are came from delete category item
kumarpalsinh25 Sep 18, 2024
84653d6
Make sub-chats with categories options
kumarpalsinh25 Sep 20, 2024
946368c
Minor fixes
kumarpalsinh25 Sep 20, 2024
2331239
Change related to providers updates
kumarpalsinh25 Sep 20, 2024
6286083
Added skeleton loading UI
kumarpalsinh25 Sep 20, 2024
28959d2
Minor fixes
kumarpalsinh25 Sep 20, 2024
e36e3fa
Updated change log data
kumarpalsinh25 Sep 20, 2024
c4d5dd4
Merge branch 'main' into kumar/categorised-spaces
kumarpalsinh25 Sep 20, 2024
975d558
Added missing Goto chat call on tap of Chat Room Card
kumarpalsinh25 Sep 20, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changes/2168-categorized-structure.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- [New] : All new categorize management for sub-spaces and sub-chats
- [New] : You can now create custom categories and manage all the sub-space and sub-chat base on the your requirements
10 changes: 5 additions & 5 deletions app/integration_test/tests/sub_spaces.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'package:acter/common/widgets/sliver_scaffold.dart';
import 'package:acter/features/space/sheets/link_room_sheet.dart';
import 'package:acter/features/space/pages/sub_spaces_page.dart';
import 'package:acter/features/spaces/pages/sub_spaces.dart';
import 'package:convenient_test_dev/convenient_test_dev.dart';
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
Expand Down Expand Up @@ -42,8 +42,8 @@ void subSpaceTests() {
await t.gotoSpace(spaceId);
await t.navigateTo([
const Key('spaces'),
SubSpacesPage.moreOptionKey,
SubSpacesPage.linkSubspaceKey,
SubSpaces.moreOptionKey,
SubSpaces.linkSubspaceKey,
]);

final roomListEntry = find.byKey(Key('room-list-link-$subSpace'));
Expand Down Expand Up @@ -89,8 +89,8 @@ void subSpaceTests() {
await t.gotoSpace(spaceId);
await t.navigateTo([
const Key('spaces'),
SubSpacesPage.moreOptionKey,
SubSpacesPage.linkSubspaceKey,
SubSpaces.moreOptionKey,
SubSpaces.linkSubspaceKey,
]);

final roomListEntry = find.byKey(Key('room-list-link-$subSpace'));
Expand Down
56 changes: 56 additions & 0 deletions app/lib/common/skeletons/general_list_skeleton_widget.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import 'package:atlas_icons/atlas_icons.dart';
import 'package:flutter/material.dart';
import 'package:skeletonizer/skeletonizer.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';

class GeneralListSkeletonWidget extends StatelessWidget {
const GeneralListSkeletonWidget({super.key});

@override
Widget build(BuildContext context) {
return Skeletonizer(child: _buildSkeletonUI(context));
}

Widget _buildSkeletonUI(BuildContext context) {
return Column(
children: [
_buildListItemSkeletonUI(context),
_buildListItemSkeletonUI(context),
_buildListItemSkeletonUI(context),
_buildListItemSkeletonUI(context),
_buildListItemSkeletonUI(context),
],
);
}

Widget _buildListItemSkeletonUI(BuildContext context) {
return Padding(
padding: const EdgeInsets.all(16),
child: Row(
children: [
Container(
height: 50,
width: 50,
color: Colors.white,
),
const SizedBox(width: 10),
Expanded(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(L10n.of(context).title + L10n.of(context).title),
Text(
L10n.of(context).description + L10n.of(context).description,
),
],
),
),
const SizedBox(width: 20),
const Icon(Atlas.crown_winner_thin),
const SizedBox(width: 10),
const Icon(Atlas.dots_vertical),
],
),
);
}
}
6 changes: 4 additions & 2 deletions app/lib/common/utils/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,12 @@ enum Routes {
linkRecommended('/:spaceId([!#][^/]+)/linkRecommended'),
spaceInvite('/:spaceId([!#][^/]+)/invite'),
space('/:spaceId([!#][^/]+)'), // !spaceId, #spaceName
spaceRelatedSpaces('/:spaceId([!#][^/]+)/spaces'),
subSpaces('/:spaceId([!#][^/]+)/subSpaces'),
subChats('/:spaceId([!#][^/]+)/subChats'),
organizeCategories('/organizeCategories/:spaceId([^/]+)/:categoriesFor([^/]+)'),
spaceMembers('/:spaceId([!#][^/]+)/members'),
spacePins('/:spaceId([!#][^/]+)/pins'),
spaceEvents('/:spaceId([!#][^/]+)/events'),
spaceChats('/:spaceId([!#][^/]+)/chats'),
spaceTasks('/:spaceId([!#][^/]+)/tasks'),
// -- space Settings
spaceSettings('/:spaceId([!#][^/]+)/settings'),
Expand Down Expand Up @@ -112,5 +113,6 @@ enum Routes {
fatalFail('/error');

const Routes(this.route);

final String route;
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ enum ActerIcon {
static ActerIcon iconForTask(String? name) =>
iconFor(name) ?? ActerIcon.list;

static ActerIcon iconForCategories(String? name) =>
iconFor(name) ?? ActerIcon.list;

static ActerIcon iconForPin(String? name) =>
iconFor(name) ?? ActerIcon.pin;

Expand Down
6 changes: 6 additions & 0 deletions app/lib/common/widgets/room/room_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ class RoomCard extends ConsumerWidget {
/// the default border.
final bool withBorder;

/// Custom Leading Widget
final Widget? leading;

/// Custom Trailing Widget
final Widget? trailing;

Expand Down Expand Up @@ -106,6 +109,7 @@ class RoomCard extends ConsumerWidget {
this.showParents = true,
this.showSuggestedMark = false,
this.showVisibilityMark = false,
this.leading,
this.trailing,
});

Expand All @@ -127,6 +131,7 @@ class RoomCard extends ConsumerWidget {
this.showParents = false,
this.showSuggestedMark = false,
this.showVisibilityMark = false,
this.leading,
this.trailing,
});

Expand All @@ -149,6 +154,7 @@ class RoomCard extends ConsumerWidget {
showParents: showParents,
showSuggestedMark: showSuggestedMark,
showVisibilityMark: showVisibilityMark,
leading: leading,
trailing: trailing,
);
}
Expand Down
23 changes: 20 additions & 3 deletions app/lib/common/widgets/room/room_with_profile_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class RoomWithAvatarInfoCard extends StatelessWidget {
final AvatarInfo avatarInfo;
final List<AvatarInfo>? parents;
final Widget? subtitle;
final Widget? leading;
final Widget? trailing;
final double avatarSize;

Expand Down Expand Up @@ -85,6 +86,7 @@ class RoomWithAvatarInfoCard extends StatelessWidget {
required this.avatarInfo,
this.parents,
this.subtitle,
this.leading,
this.trailing,
this.onTap,
this.onLongPress,
Expand Down Expand Up @@ -129,9 +131,24 @@ class RoomWithAvatarInfoCard extends StatelessWidget {
titleTextStyle: titleTextStyle,
subtitleTextStyle: subtitleTextStyle,
leadingAndTrailingTextStyle: leadingAndTrailingTextStyle,
title: Text(title, overflow: TextOverflow.ellipsis),
subtitle: buildSubtitle(context),
leading: avatar,
title: Row(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes are for providing option to added dynamic leading widget. Earlier dynamic trailing widget option was there.

mainAxisAlignment: MainAxisAlignment.start,
children: [
avatar,
const SizedBox(width: 12),
Expanded(
child: Column(
mainAxisAlignment: MainAxisAlignment.start,
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(title, overflow: TextOverflow.ellipsis),
buildSubtitle(context) ?? const SizedBox.shrink(),
],
),
),
],
),
leading: leading,
trailing: trailing,
),
);
Expand Down
74 changes: 74 additions & 0 deletions app/lib/features/categories/actions/save_categories.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import 'package:acter/common/providers/sdk_provider.dart';
import 'package:acter/common/providers/space_providers.dart';
import 'package:acter/features/categories/model/CategoryModelLocal.dart';
import 'package:acter/features/categories/providers/categories_providers.dart';
import 'package:acter/features/categories/utils/category_utils.dart';
import 'package:flutter/material.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_gen/gen_l10n/l10n.dart';
import 'package:logging/logging.dart';

final _log = Logger('a3::save_categories');

Future<void> saveCategories(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One function to save all categories related changes from Local Category List.

BuildContext context,
WidgetRef ref,
String spaceId,
CategoriesFor categoriesFor,
List<CategoryModelLocal> categoryList,
) async {
// Show loading message
EasyLoading.show(status: L10n.of(context).updatingCategories);
try {
//Get category manager
final categoriesManager = await ref.read(
categoryManagerProvider(
(spaceId: spaceId, categoriesFor: categoriesFor),
).future,
);
final sdk = await ref.watch(sdkProvider.future);
final displayBuilder = sdk.api.newDisplayBuilder();

//Get category builder
final categoriesBuilder = categoriesManager.updateBuilder();

//Clear category builder data and Add new
categoriesBuilder.clear();
for (int i = 0; i < categoryList.length; i++) {
bool isValidCategory = CategoryUtils().isValidCategory(categoryList[i]);
if (isValidCategory) {
final newCategoryItem = categoriesManager.newCategoryBuilder();
//ADD TITLE
newCategoryItem.title(categoryList[i].title);

//ADD COLOR AND ICON
displayBuilder.color(categoryList[i].color!.value);
displayBuilder.icon('acter-icon', categoryList[i].icon!.name);
newCategoryItem.display(displayBuilder.build());

//ADD ENTRIES
for (int j = 0; j < categoryList[i].entries.length; j++) {
newCategoryItem.addEntry(categoryList[i].entries[j]);
}
categoriesBuilder.add(newCategoryItem.build());
}
}

//Save category builder
final space = await ref.read(spaceProvider(spaceId).future);
space.setCategories(categoriesFor.name, categoriesBuilder);

EasyLoading.dismiss();
} catch (e, s) {
_log.severe('Failed to save categories', e, s);
if (!context.mounted) {
EasyLoading.dismiss();
return;
}
EasyLoading.showError(
L10n.of(context).updatingCategoriesFailed(e),
duration: const Duration(seconds: 3),
);
}
}
16 changes: 16 additions & 0 deletions app/lib/features/categories/model/CategoryModelLocal.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import 'package:acter/common/widgets/acter_icon_picker/model/acter_icons.dart';
import 'package:flutter/material.dart';

class CategoryModelLocal {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is to better manage category operation from flutter side.

final String title;
final Color? color;
final ActerIcon? icon;
final List<String> entries;

const CategoryModelLocal({
required this.title,
this.color,
this.icon,
required this.entries,
});
}
Loading
Loading