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

app-responsiveness: fix renderflex overfow in widgets. #988

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

oriohac
Copy link

@oriohac oriohac commented Oct 6, 2024

Fix renderflex overflow in the Home, Add Account
and AlertDialog widgets, by making them scrollable, when all contents in a screen do not fit in the
screen. Which are fixes to these observed issues.

widgets.

Fix renderflex overflow in the Home, Add Account
and AlertDialog widgets, by making them scrollable,
when all contents in a screen do not fit in the
screen.
@oriohac
Copy link
Author

oriohac commented Oct 6, 2024

Screenshot from 2024-10-04 06-51-40 Screenshot from 2024-10-04 07-00-04

The before and after images of the Homepage which has a renderflex overflow and when it was fixed.

Screenshot from 2024-10-04 06-43-56 Screenshot from 2024-10-04 06-45-04

The before and after images showing Add Account page with renderflex overflow and when it is fixed.

@chrisbobbe
Copy link
Collaborator

Is there an issue or a previous conversation that prompted this PR? If so, please put a link in the PR description so we can review with all the relevant context; thanks.

@oriohac
Copy link
Author

oriohac commented Oct 8, 2024

Is there an issue or a previous conversation that prompted this PR? If so, please put a link in the PR description so we can review with all the relevant context; thanks.

Yes, there is, this chat was what prompted the PR.

Copy link
Collaborator

@chrisbobbe chrisbobbe left a comment

Choose a reason for hiding this comment

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

Thanks! Comments below.

lib/widgets/app.dart Outdated Show resolved Hide resolved
lib/widgets/dialog.dart Outdated Show resolved Hide resolved
lib/widgets/login.dart Outdated Show resolved Hide resolved
Comment on lines 291 to 304
testWidgets('Home scrollable test, when contents do not fit to screen', (tester)async{
await tester.pumpWidget(MaterialApp(
home: Scaffold(body: Center(child: SingleChildScrollView(child: Column(
children: List.generate(15, (count)=>Text('Pick $count')),
))))));
//make sure the added scrollable widget is functional
expect(find.byType(SingleChildScrollView), findsOneWidget);
expect(find.text('Pick 0'), findsOneWidget);

await tester.drag(find.byType(SingleChildScrollView), const Offset(0, -300));
//Test for items down the column
await tester.pump();
expect(find.text('Pick 14'), findsOneWidget);
});
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is meant to test the code you added in HomePage, right? So it should exercise that code itself, instead of writing code for a new page that doesn't appear in the app. :)

To make it so the content runs longer than a screenful, try making the test simulate a shorter device height, and/or simulate an increased device text-size setting. We have examples of both in other widget tests.

(Similarly for AddAccountPage.)

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for pointing this out, I will make the changes and send a PR

lib/widgets/dialog.dart Show resolved Hide resolved
oriohac and others added 10 commits October 9, 2024 03:25
widgets.

Fix renderflex overflow in the Home, Add Account
and AlertDialog widgets, by making them scrollable,
when all contents in a screen do not fit in the
screen.
Remove the SingleChildScrollView in the content field:
Pass scrollable: true to the AlertDialog constructor
…rflex Overflow on smaller screens, and write corresponding test for the change.
@oriohac
Copy link
Author

oriohac commented Oct 13, 2024

Hello, I have applied the changes, and waiting for review.

@chrisbobbe
Copy link
Collaborator

chrisbobbe commented Oct 15, 2024

Hi @oriohac, please note our convention of "clear and coherent commits"; you'll need to tidy up your commit history before we can review your PR in more detail. Some things I notice happening:

  • A commit makes an undesired change that gets reverted in a later commit. Instead, amend or remove the earlier commit so it doesn't make the undesired change in the first place.
  • I see a merge commit; Zulip doesn't use merge commits.
  • tools/check should pass at each commit; it looks like that's not true yet.

Also, bump on #988 (comment), which is still unresolved. It looks like you've copy-pasted from the current implementation of HomePage instead of testing HomePage itself. An important purpose of automated tests is to catch bugs that might appear in future changes to the app code. In this case, that app code is HomePage. The tests can't catch future bugs in HomePage if they don't actually exercise HomePage.

PIG208 and others added 4 commits October 26, 2024 04:39
As a result, showErrorDialog no longer returns a Future that can be
mistakenly awaited.  The wrapped return value offers clarity on how the
Future is supposed to be used.

There is no user visible change because existing callers (other than
lightbox's) that wait for its return value are all asynchronous
handlers for UI elements like buttons, and waits unnecessarily.

See also discussion
  zulip#937 (comment).

Signed-off-by: Zixuan James Li <[email protected]>
Unlike ScaffoldFeatureController which inspired it, this class
doesn't offer a way to control the dialog, so it's not really
a "controller"; just call it DialogStatus.

A private final field with a public getter (of the same type)
is equivalent to just a public final field: nothing can set it,
and any library can get it.

Also generalize the description a bit: we currently use this
only for AlertDialog, but it'd apply equally well for any
dialog box.
widgets.

Fix renderflex overflow in the Home, Add Account
and AlertDialog widgets, by making them scrollable,
when all contents in a screen do not fit in the
screen.
@chrisbobbe
Copy link
Collaborator

This is not ready for another review. Please see above: #988 (comment) and ask in #git help in the Zulip development community if you need help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants