DEV Community

Lamonte
Lamonte

Posted on

My first PR approved to the Flutter SDK

So, this was a fun experience submitting my first PR of the year and it was very small, not going to lie. I've dabbled with supporting open source projects from time to time, but I've never submitted a feature patch to a repo as big as the Flutter SDK. Let alone anything tied to Google.

It was definitely an experience, because I don't have that much experience with the testing library. There's a lot that I feel is undocumented and the testing library is actually cool as hell. The google flutter dev that assigned themselves to my repo showed me that you can actually drag the ui from the testing lib and find specific things within the screen view and actually detect if you've properly hit a specific widget. That level of integration testing is fascinating and honestly I hope someone writes more on it because there's just so much I want to understand from the testing library.

(All the testing code is credited to Shi-Hao)

customController.animateTo(
    40.0,
    duration: const Duration(milliseconds: 200),
    curve: Curves.linear
);

await tester.pumpAndSettle();
Offset listViewTopLeft = tester.getTopLeft(
    find.byType(ReorderableListView),
);

Offset firstBoxTopLeft = tester.getTopLeft(
    find.byKey(firstBox)
);

expect(firstBoxTopLeft.dy, listViewTopLeft.dy - 40.0);

I'm definitely used to simple unit tests, that's easy, but integration tests for actually testing how the the UI responds and works as intended is very cool and there's just so much to learn.

As for the PR I added, ReorderableListView didn't expose the scroll controller like the ListView builder did. So you were forced to wrap it in a PrimaryScrollController to pass your own scroll controller which seemed like a tedious step. So I decided this would be my chance to hit one of my goals this year, which was to contribute more to open source and damn was this a big first step starting with this PR.

Now whenever this gets added, I'll be able to use one of my favorite packages called Flutter Speed Dial without a PrimaryScrollController that allows me to auto hide the dial visibility when I move the scroll view. :)

This was definitely an intimidating PR because of the people behind it, but damn if I can do it so can you :)!

Top comments (1)

Collapse
 
creativ_bracket profile image
Jermaine

You came, you saw, you conquered! Good job :)