-
-
Notifications
You must be signed in to change notification settings - Fork 21
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
Refactoring : Pin Details and Attachments #2067
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added few comments for better understanding and code review process.
final linkField = find.byKey(PinItem.linkFieldKey); | ||
await linkField.should(findsOneWidget); | ||
await linkField.replaceText(url); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Link is no more part of pin section, it is now part of attachment.
final descriptionField = find.byKey(PinItem.descriptionFieldKey); | ||
await descriptionField.should(findsOneWidget); | ||
final textEditorState = | ||
(tester.firstState(descriptionField) as HtmlEditorState).editorState; | ||
final lastSelectable = textEditorState.getLastSelectable()!; | ||
final transaction = textEditorState.transaction; | ||
transaction.insertText( | ||
lastSelectable.$1, | ||
35, | ||
content, | ||
); | ||
await textEditorState.apply(transaction); | ||
textEditorState.service.keyboardService!.closeKeyboard(); | ||
|
||
final saveBtnKey = find.byKey(PinItem.saveBtnKey); | ||
await saveBtnKey.should(findsOneWidget); | ||
await tester.ensureVisible(saveBtnKey); | ||
await saveBtnKey.tap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- No more Edit Pin Page options as everything is now editable with Inline support!
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
import 'package:flutter_gen/gen_l10n/l10n.dart'; | ||
|
||
void showEditLinkBottomSheet({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as mentioned above. Link is no more part of pin section, it is now part of attachment.
@@ -3,9 +3,14 @@ import 'package:flutter/material.dart'; | |||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |||
|
|||
class SpaceNameWidget extends ConsumerWidget { | |||
final String? spaceId; | |||
final String spaceId; | |||
final bool isShowBrackets; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Helpful when we need to re-use this widget in other place where we want to show space name but without Brackets.
@@ -4,7 +4,7 @@ import 'package:flutter/material.dart'; | |||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | |||
import 'package:flutter_gen/gen_l10n/l10n.dart'; | |||
|
|||
void showPinLinkBottomSheet({ | |||
void showAddEditLinkBottomSheet({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add link related stuff are now part of Attachment Common option so make related naming changes and also putted in appropriate folder.
import 'package:flutter_gen/gen_l10n/l10n.dart'; | ||
import 'package:flutter_riverpod/flutter_riverpod.dart'; | ||
|
||
void showEditPintTitleDialog( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried to pull out action code as much as possible from main files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The function and inner call names are kinda misleading...
static const createPinPageKey = Key('create-pin-page'); | ||
static const titleFieldKey = Key('create-pin-title-field'); | ||
static const descriptionFieldKey = Key('create-pin-description-field'); | ||
static const submitBtn = Key('create-pin-submit'); | ||
|
||
final String? initialSelectedSpace; | ||
|
||
const CreatePin({ | ||
const CreatePinPage({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Naming changes!
import 'package:flutter_gen/gen_l10n/l10n.dart'; | ||
import 'package:skeletonizer/skeletonizer.dart'; | ||
|
||
class PinDetailsPage extends ConsumerStatefulWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So created this page from scratch to get rid from unknown issues and better code management with new UI-UX.
); | ||
} | ||
|
||
Widget pinIconUI() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In future, this will be dynamic and putted into common widget for Icon Identity management.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay it was a huge changeset and lot of nice changes 🎉 . But I feel it lacks behind in certain areas of code improvement, particularly I see redundancy with dialogs, adaptiveness of it, non-functional widgets in there and minor code addressal before it can be approved for merge on my behalf.
b392a63
to
870d707
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The code is overall fine, but the backward compat code is not something I can sign off of as is. I provided the approach I'd take.
@gnunicorn 1) General Feedback Points: 9272e3bNote: Due to one change in above commit, filename was not showing in attachment item if title is empty. which is fixes by this commit. 2) Backward Link Support Feedback: c88120fNote: Forgot do some of things on above commit which is correct by below commit. Reference Video: ![]() Pin.backward.support.mov3) Fixed canRedact issue which caused to not showing
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One last minor thing ... I'll address it on the following commit and merge it.
}, | ||
child: Text(L10n.of(context).edit), | ||
), | ||
PopupMenuItem<String>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can the user delete a pin if they don't have pin-edit-permissions? I think the entire menu needs to be behind that permission flag, no?
This PR contains refactoring of entire Pin Details page and Attachment module as below.
Download Button
(Show-case that file is not yet downloaded) andMore Menu
(For Edit and Delete attachment item)Reference video:
Pin.Details.mov
Note for Reviewers: