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

General Fixes #2361

Merged
merged 10 commits into from
Nov 13, 2024
4 changes: 4 additions & 0 deletions .changes/2361-general-fixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- [Fix] : Pin icon changes now reflected in list immediately
- [Fix] : No more keyboard overlay issue when we do add task from quick action buttons
- [Improvement] : Better color contrast on Boost Post Backgrounds
- [Improvement] : Better boost slide scroll management on desktop
34 changes: 30 additions & 4 deletions app/lib/features/events/providers/event_providers.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:acter/features/bookmarks/providers/bookmarks_provider.dart';
import 'package:acter/features/bookmarks/types.dart';
import 'package:acter/features/bookmarks/util.dart';
import 'package:acter/features/events/providers/event_type_provider.dart';
import 'package:acter/features/events/actions/sort_event_list.dart';
import 'package:acter/features/events/providers/notifiers/event_notifiers.dart';
Expand Down Expand Up @@ -186,16 +187,25 @@ final eventListSearchedProvider = FutureProvider.autoDispose
final eventListQuickSearchedProvider =
FutureProvider.autoDispose<List<ffi.CalendarEvent>>((ref) async {
final searchTerm = ref.watch(quickSearchValueProvider);

final priotizeBookmarkedEvents = await priotizeBookmarked(
ref,
BookmarkType.events,
await ref.watch(allEventListProvider(null).future),
getId: (t) => t.eventId().toString(),
);

return _filterEventBySearchTerm(
searchTerm,
await ref.watch(allEventListProvider(null).future),
priotizeBookmarkedEvents,
);
});

final eventListSearchedAndFilterProvider = FutureProvider.autoDispose
.family<List<ffi.CalendarEvent>, String?>((ref, spaceId) async {
//Declare filtered event list
final filteredEventList =

final List<ffi.CalendarEvent> filteredEventList =
switch (ref.watch(eventListFilterProvider(spaceId))) {
EventFilters.bookmarked =>
await ref.watch(bookmarkedEventListProvider(spaceId).future),
Expand All @@ -205,9 +215,25 @@ final eventListSearchedAndFilterProvider = FutureProvider.autoDispose
await ref.watch(allUpcomingEventListProvider(spaceId).future),
EventFilters.past =>
await ref.watch(allPastEventListProvider(spaceId).future),
EventFilters.all => await ref.watch(allEventListProvider(spaceId).future),
EventFilters.all =>
(await ref.watch(allOngoingEventListProvider(spaceId).future))
.followedBy(
await ref.watch(allUpcomingEventListProvider(spaceId).future),
)
.followedBy(await ref.watch(allPastEventListProvider(spaceId).future))
.toList(),
};

final priotizeBookmarkedEvents = await priotizeBookmarked(
ref,
BookmarkType.events,
filteredEventList,
getId: (t) => t.eventId().toString(),
);

final searchTerm = ref.watch(eventListSearchTermProvider(spaceId));
return _filterEventBySearchTerm(searchTerm, filteredEventList);
return _filterEventBySearchTerm(
searchTerm,
priotizeBookmarkedEvents,
);
});
12 changes: 12 additions & 0 deletions app/lib/features/news/model/news_post_color_data.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

import 'package:flutter/material.dart';

List<Color> newsPostColors = [
Colors.brown,
Colors.red,
Colors.orange,
Colors.deepPurple,
Colors.purple,
Colors.indigo,
Colors.pink,
];
7 changes: 4 additions & 3 deletions app/lib/features/news/news_utils/news_utils.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'dart:io';

import 'package:acter/common/utils/utils.dart';
import 'package:acter/features/news/model/news_post_color_data.dart';
import 'package:acter/features/news/model/news_slide_model.dart';
import 'package:acter/features/news/providers/news_post_editor_providers.dart';
import 'package:acter_flutter_sdk/acter_flutter_sdk.dart';
Expand Down Expand Up @@ -51,7 +52,7 @@ class NewsUtils {

//Add text slide
static void addTextSlide(WidgetRef ref) {
final clr = getRandomElement(Colors.primaries);
final clr = getRandomElement(newsPostColors);
NewsSlideItem textSlide = NewsSlideItem(
type: NewsSlideType.text,
text: '',
Expand All @@ -62,7 +63,7 @@ class NewsUtils {

//Add image slide
static Future<void> addImageSlide(WidgetRef ref) async {
final clr = getRandomElement(Colors.primaries);
final clr = getRandomElement(newsPostColors);
XFile? imageFile = await imagePicker.pickImage(
source: ImageSource.gallery,
);
Expand All @@ -78,7 +79,7 @@ class NewsUtils {

//Add video slide
static Future<void> addVideoSlide(WidgetRef ref) async {
final clr = getRandomElement(Colors.primaries);
final clr = getRandomElement(newsPostColors);
XFile? videoFile = await imagePicker.pickVideo(
source: ImageSource.gallery,
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:acter/common/utils/utils.dart';
import 'package:acter/common/widgets/event/event_selector_drawer.dart';
import 'package:acter/common/widgets/spaces/space_selector_drawer.dart';
import 'package:acter/features/news/model/news_post_color_data.dart';
import 'package:acter/features/news/model/news_post_state.dart';
import 'package:acter/features/news/model/news_references_model.dart';
import 'package:acter/features/news/model/news_slide_model.dart';
Expand All @@ -21,7 +22,7 @@ class NewsStateNotifier extends StateNotifier<NewsPostState> {

void changeTextSlideBackgroundColor() {
NewsSlideItem? selectedNewsSlide = state.currentNewsSlide;
selectedNewsSlide?.backgroundColor = getRandomElement(Colors.primaries);
selectedNewsSlide?.backgroundColor = getRandomElement(newsPostColors);
state = state.copyWith(currentNewsSlide: selectedNewsSlide);
}

Expand Down
37 changes: 23 additions & 14 deletions app/lib/features/news/widgets/news_full_view.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import 'package:acter/common/animations/like_animation.dart';
import 'package:acter/features/news/providers/news_providers.dart';
import 'package:acter/features/news/widgets/news_item/news_item.dart';
import 'package:acter_flutter_sdk/acter_flutter_sdk_ffi.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';

Expand Down Expand Up @@ -49,21 +50,29 @@ class NewsVerticalViewState extends ConsumerState<NewsFullView> {
}

Widget buildPagerView() {
return PageView.builder(
controller: _pageController,
itemCount: widget.newsList.length,
scrollDirection: Axis.vertical,
itemBuilder: (context, index) => InkWell(
onDoubleTap: () async {
LikeAnimation.run(index);
final news = widget.newsList[index];
final manager = await ref.read(newsReactionsProvider(news).future);
final status = manager.likedByMe();
if (!status) {
await manager.sendLike();
}
return ScrollConfiguration(
behavior: ScrollConfiguration.of(context).copyWith(
dragDevices: {
PointerDeviceKind.touch,
PointerDeviceKind.mouse,
},
child: NewsItem(news: widget.newsList[index]),
),
child: PageView.builder(
controller: _pageController,
itemCount: widget.newsList.length,
scrollDirection: Axis.vertical,
itemBuilder: (context, index) => InkWell(
onDoubleTap: () async {
LikeAnimation.run(index);
final news = widget.newsList[index];
final manager = await ref.read(newsReactionsProvider(news).future);
final status = manager.likedByMe();
if (!status) {
await manager.sendLike();
}
},
child: NewsItem(news: widget.newsList[index]),
),
),
);
}
Expand Down
3 changes: 3 additions & 0 deletions app/lib/features/pins/actions/pin_update_actions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,10 @@ Future<void> updatePinIcon(

await updateBuilder.send();
EasyLoading.dismiss();

//TODO : this only fixes the case where we do the update. if the change comes from outside - another user - this will not trigger.
ref.invalidate(pinProvider);
ref.invalidate(pinListProvider);
gnunicorn marked this conversation as resolved.
Show resolved Hide resolved
} catch (e, s) {
_log.severe('Failed to change icon of pin', e, s);
if (!context.mounted) {
Expand Down
10 changes: 5 additions & 5 deletions app/lib/features/space/providers/space_navbar_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,16 @@ final tabsProvider =
}
}

final hasSpaces = await ref.watch(hasSubSpacesProvider(spaceId).future);
if (hasSpaces) {
tabs.add(TabEntry.spaces);
}

final hasChats = await ref.watch(hasSubChatsProvider(spaceId).future);
if (hasChats) {
tabs.add(TabEntry.chats);
}

final hasSpaces = await ref.watch(hasSubSpacesProvider(spaceId).future);
if (hasSpaces) {
tabs.add(TabEntry.spaces);
}

tabs.add(TabEntry.members);

final membership = ref.watch(roomMembershipProvider(spaceId));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class ChatsSection extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SectionHeader(
title: L10n.of(context).suggestedChats,
title: L10n.of(context).chats,
isShowSeeAllButton: true,
onTapSeeAll: () => context.pushNamed(
Routes.subChats.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class SpacesSection extends ConsumerWidget {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
SectionHeader(
title: L10n.of(context).suggestedSpaces,
title: L10n.of(context).spaces,
isShowSeeAllButton: true,
onTapSeeAll: () => context.pushNamed(
Routes.subSpaces.name,
Expand Down
9 changes: 6 additions & 3 deletions app/lib/features/tasks/actions/create_task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,12 @@ Future<void> showCreateTaskBottomSheet(
showDragHandle: true,
useSafeArea: true,
isScrollControlled: true,
builder: (context) => CreateTaskWidget(
taskList: taskList,
taskName: taskName,
builder: (context) => Padding(
padding: MediaQuery.of(context).viewInsets,
Copy link
Contributor

Choose a reason for hiding this comment

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

curios ... why is that not needed in other cases? Is it because the object then pulls the auto-focus? But others should be doing that, too, no? I'd like to understand the cause here ...

Or should we wrap that in a safe-area?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Don't know exact root cause. I also faced similar kind of issue where I developer createEditTitle common widget where it was working fine on some area and misbehave at some places.

Above code just fixed the issue earlier also so applied it here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can also confirm that wrapping with safe-area doesn't fixed this.

Copy link
Contributor

Choose a reason for hiding this comment

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

Hm... that is unsatisfying ... would be good to figure out the root cause at some point...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm true, let me check if I can figure out something

child: CreateTaskWidget(
taskList: taskList,
taskName: taskName,
),
),
);
}
Expand Down
Loading