The Widgets
The screens in the Unsplash feature are mostly meant for listing a set of photos, such as the Latest and Featured list of photos.
You also have a listing for Collections and Topics, which takes you to a list of photos again for a collection or topic.
The Search screen is also very similar, consisting of a listing page which shows the results of the search, and then tapping on each of those results takes you to the photo-detail page.
Thus, the 3 core widgets which are part of our mini design system include:
- The
PhotoCard
that appears pretty much everywhere you are see a list of photos. - The
CollectionView
that shows you the list of photos. - The
PhotoDetail
view.
Home Tab
Here is the snippet of code from the Home tab that shows these widgets in use.
An interesting thing to note in the Home tab is the way we’ve managed the
various sub-sections (or sub-tabs) of the Home screen. The latest
, featured
,
collections
, and topics
are part of an enumeration for which we have the
corresponding widgets.
This simplifies the creation of the widgets per sub-tab and also makes it easier to read the code.
Search Tab
The Search Tab has a very similar structure and again relies on the
CollectionView
to render its listing of results. This can be seen in the code
below.