Skip to content

Commit

Permalink
Merge pull request #380 from atsign-foundation/hotfix/fix-testing-Sep…
Browse files Browse the repository at this point in the history
…t-14-notes

fix: resolve noted issues
  • Loading branch information
sonle-geekyants authored Dec 26, 2023
2 parents c68c94c + 50869af commit 939bb9b
Show file tree
Hide file tree
Showing 9 changed files with 285 additions and 232 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,21 @@ class _DesktopFilterHistoryWidgetState
title: 'All File Types',
isCheck: optionalHistoryTypes
.every((element) => listFileType.contains(element)),
onTap: () {
if (optionalHistoryTypes
.every((element) => listFileType.contains(element))) {
listFileType.clear();
} else {
optionalHistoryTypes.forEach(
(element) {
if (!listFileType.contains(element)) {
listFileType.add(element);
}
},
);
}
widget.onSelectedOptionalFilter?.call(listFileType);
},
),
ListView.separated(
shrinkWrap: true,
Expand Down
4 changes: 3 additions & 1 deletion lib/desktop_screens_new/notification/success_card.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import 'package:flutter/material.dart';

class SuccessCard extends StatelessWidget {
final FileHistory fileHistory;

const SuccessCard({Key? key, required this.fileHistory}) : super(key: key);

@override
Expand Down Expand Up @@ -58,7 +59,8 @@ class SuccessCard extends StatelessWidget {
),
),
TextSpan(
text: '${fileHistory.fileDetails?.files?.length} files',
text:
'${fileHistory.fileDetails?.files?.length} files(s)',
style: TextStyle(
fontSize: 15,
color: Color(0xFF18A2EF),
Expand Down
15 changes: 14 additions & 1 deletion lib/screens/contact_new_version/contact_screen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class _ContactScreenState extends State<ContactScreen>
late GroupService _groupService;
late TabController _tabController;
late TextEditingController searchController;
bool isReloading = false;

@override
void initState() {
Expand Down Expand Up @@ -130,7 +131,7 @@ class _ContactScreenState extends State<ContactScreen>

Widget buildBody() {
return Consumer<ContactProvider>(builder: (context, provider, child) {
return widget.isLoading
return isReloading
? ContactSkeletonLoadingWidget()
: InkWell(
highlightColor: Colors.transparent,
Expand Down Expand Up @@ -207,6 +208,8 @@ class _ContactScreenState extends State<ContactScreen>
contactsType: ListContactType.contact,
trustedContacts: trustedProvider.trustedContacts,
searchKeywords: searchController.text,
onRefresh: () =>
setState(() => isReloading = !isReloading),
onTapContact: (contact) async {
final result = await Navigator.push(
context,
Expand Down Expand Up @@ -240,6 +243,8 @@ class _ContactScreenState extends State<ContactScreen>
contactsType: ListContactType.trusted,
trustedContacts: trustedProvider.trustedContacts,
searchKeywords: searchController.text,
onRefresh: () =>
setState(() => isReloading = !isReloading),
onTapContact: (contact) async {
await Navigator.push(
context,
Expand All @@ -257,6 +262,8 @@ class _ContactScreenState extends State<ContactScreen>
ListContactWidget(
contactsType: ListContactType.groups,
searchKeywords: searchController.text,
onRefresh: () =>
setState(() => isReloading = !isReloading),
onTapGroup: (group) async {
WidgetsBinding.instance
.addPostFrameCallback((_) async {
Expand Down Expand Up @@ -355,8 +362,14 @@ class _ContactScreenState extends State<ContactScreen>
}

Future<void> reloadPage() async {
setState(() {
isReloading = true;
});
await Future.delayed(Duration(milliseconds: 500), () async {
await _groupService.fetchGroupsAndContacts();
setState(() {
isReloading = false;
});
contactProvider.notify();
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class _ContactsWidgetState extends State<ContactsWidget> {
},
child: ListView.builder(
controller: widget.scrollController,
physics: const ClampingScrollPhysics(),
physics: const AlwaysScrollableScrollPhysics(),
itemCount: 27,
shrinkWrap: true,
itemBuilder: (context, alphabetIndex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class ListContactWidget extends StatefulWidget {
final ListContactType? contactsType;
final String searchKeywords;
final Function()? onTapAddButton;
final Function()? onRefresh;

const ListContactWidget({
Key? key,
Expand All @@ -33,6 +34,7 @@ class ListContactWidget extends StatefulWidget {
this.contactsType,
this.searchKeywords = '',
this.onTapAddButton,
this.onRefresh,
}) : super(key: key);

@override
Expand Down Expand Up @@ -143,7 +145,9 @@ class _ListContactWidgetState extends State<ListContactWidget>
onTapGroup: widget.onTapGroup,
onSelectContacts: widget.onSelectContacts,
onRefresh: () async {
widget.onRefresh?.call();
await _groupService.fetchGroupsAndContacts();
widget.onRefresh?.call();
},
contactPadding: EdgeInsets.only(left: 18, right: 28),
selectedContacts: widget.selectedContacts,
Expand Down
15 changes: 15 additions & 0 deletions lib/screens/history/widgets/filter_history_widget.dart
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,21 @@ class _FilterHistoryWidgetState extends State<FilterHistoryWidget> {
title: 'All File Types',
isCheck: optionalHistoryTypes
.every((element) => listFileType.contains(element)),
onTap: () {
if (optionalHistoryTypes
.every((element) => listFileType.contains(element))) {
listFileType.clear();
} else {
optionalHistoryTypes.forEach(
(element) {
if (!listFileType.contains(element)) {
listFileType.add(element);
}
},
);
}
widget.onSelectedOptionalFilter?.call(listFileType);
},
),
ListView.separated(
shrinkWrap: true,
Expand Down
15 changes: 6 additions & 9 deletions lib/screens/history/widgets/history_file_item.dart
Original file line number Diff line number Diff line change
Expand Up @@ -641,15 +641,12 @@ class _HistoryFileItemState extends State<HistoryFileItem> {
}) {
return InkWell(
onTap: onTap,
child: CommonUtilityFunctions()
.isFileDownloadAvailable(widget.fileTransfer!.date!)
? SvgPicture.asset(
icon,
width: 32,
height: 32,
fit: BoxFit.cover,
)
: SizedBox.shrink(),
child: SvgPicture.asset(
icon,
width: 32,
height: 32,
fit: BoxFit.cover,
),
);
}

Expand Down
2 changes: 1 addition & 1 deletion lib/screens/history/widgets/history_file_list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class _HistoryFileListState extends State<HistoryFileList> {
color: ColorConstants.moreFilesBackgroundColor,
),
child: Text(
isExpanded ? 'Show Less' : '${fileListLength - 2} More Files',
isExpanded ? 'Show Less' : '${fileListLength - 2} More File(s)',
style: TextStyle(
color: ColorConstants.orangeColor,
fontSize: 11,
Expand Down
Loading

0 comments on commit 939bb9b

Please sign in to comment.