GithubHelp home page GithubHelp logo

nivisi / later Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 338 KB

๐Ÿ“ฐ Later is an app that allows you to save your reading for... later.

License: MIT License

Kotlin 0.18% Ruby 3.89% Swift 1.85% Objective-C 0.06% Dart 31.30% CMake 27.10% C++ 30.94% C 2.06% HTML 2.63%

later's People

Contributors

hardioi avatar nivisi avatar

Watchers

 avatar

later's Issues

Setup `WatchAllRecordsUseCase`

As we're following clean architecture, our BLoC must not know about repositories or whatsoever, only use cases.

So, we need a use case that will allow HomeBloc (#3) to watch for all the home records.

Get to know our flow

We need to get to know how we will work in this repo. This is a test ticket where we need to add a test.dart file to the lib folder.

Implement `RecordsLocalDataSource` & connect `RecordsRepository` to it

In the repositories we'll need to use data sources in order to access the data.

Steps:

  1. Rename RecordModel to RecordDbModel and move it under the data/models folder
  2. Create a new class RecordModel with all the fields made final. Put it under domain/models folder.
  3. Create an abstract RecordsDataSource with these methods:
    • watchAll
    • create
    • getById
  4. Create an actual implementation RecordsLocalDataSource that make it work with Isar (see the logic in the current RecordsRepository). This local data source must be correctly annotated for injectable, see the documentation.
  5. Make the RecordsRepository work with this local data source. Map RecordDbModels to RecordModels.

Setup `HomeCubit`

As we follow the BLoC pattern, we need to setup HomeCubit. At the moment the only dependency should be WatchAllRecordsUseCase to access the records stream.

Implement validation on `AddRecord` page

As a user, I would like to know why the Save button is locked and what should I do to resolve it.

We have the following validation rules:

  • Title must have at least 1 character;
  • URL must be a URL (and not empty ofc)

Once a user starts typing, we can start validating fields. On error, make fields that have errors red and display corresponding error messages under the fields. Lookup how to do it with a form widget.

Important: an input must not display an error if it has not been edited yet. It's a reference to the form widget... It can validate fields that hasn't been edited, and a user will see the error even if they haven't typed anything yet. It's a bad UX, we must avoid it.

Finish `RecordModel`

RecordModel must have:

  • Title;
  • Description
  • URL;
  • Last edited date (lastEditedAt)
  • Created at date (createdAt)

Implement saving a record

After #7 is done, we are now able to finish adding a record. On the page, at the moment, the only data that we can enter is title, description and url

We need to:

  • Configure the corresponding method in the repository
  • Create a use case for creating a record
  • Implement the logic on the cubit side
  • Add the save button to the app bar
  • Pass the data from the page to the cubit

We'll work on validation in #9

Setup `AddRecord` Feature

On the AddRecordPage we'll be able to add our records.

In this ticket, we'll need to add the following:

  • A simple AddRecordPage with:
    • App Bar with title New
    • Text field for title
    • Text field for description
    • Text field for URL
  • Its route
  • A simple cubit for this page.

No logic needed for now.

Investigate theme packages

Problem

It would be great if we started using theming right away. Then, later on, we could easily introduce new theme palettes and change it on the fly.

Goal

Investigate what's out there on pub.dev we can use for theme. Let's chose one of them.

Criterias:

  • Smooth transition from one theme to another
  • Ability to create our own custom fields and data properties (see #2)
  • Ability to access theme data via BuildContext
  • Optional: Create text style datas

Implement theming

See #1 for the reference. Here we'll do actual implementation of the theme.

For now, let's define these colours in our palette:

  • backgroundColor
  • backgroundSecondaryColor
  • foregroundColor // Text / icon colors
  • foregroundDisabledColor // Text / icon colors that are disabled
  • foregroundSecondaryColor // Secondary text (like info)
  • foregroundSeocndaryDisabledColor // Secondary text (like info) / icon that are disabled
  • primaryColor // for tappable elements
  • secondaryPrimaryColor // for tappable elements, but less important
  • primaryDisabledColor // for tappable elements disabled at the moment
  • secondaryPrimaryDisabledColor // for tappable elements that are less important and disabled at the moment

And also text styles:

  • title1
  • title2
  • subtitle1
  • subtitle2
  • text1
  • text2

We'll add everything that is missing later (๐Ÿ˜„) on.

Look into the `freezed` package, create a simple state for `HomeCubit`

For cubit states classes we are using the freezed message. This will allow us to emit new states easier by simply doing emit(state.copyWith(/* something */)).

Let's create a simple HomeCubit state that will contain a list of RecordModels. Also, let's have a method called init in the cubit that will:

  1. Execute the WatchAllRecordsUseCase and listen to the stream
  2. In the listener, it will emit the records within the state.

P.S. Feel free to play with the state in any way. For example, create a simple button that will execute the method in the cubit that will emit a random number, or something like this. The primary goal is to get to know the package and its purpose.

Implement `HomePage`

Let's setup our HomePage. It must have:

  • An app bar with later text; // for the app bar, let's create and use a custom widget called LaterAppBar
  • A loading state with a simple circular loader (for now);
  • An empty state that has a text Pretty empty here! ๐Ÿ‘€ \n Let's create your first later record. and a button Create;
  • An error state that has a text Something went wrong during loading record... and a button Try again
  • Add BlocProvider. Note: please use injector for creating a bloc.
  • The actual list! It must have items rendered as tiles (for now) with the title and a chevron at the right.

Define `PrimaryButton` and `SecondaryButton`

Having separate widgets for buttons such as PrimaryButton and SecondaryButton is a good tone: if we'll need to adjust something, we would need to do it only in one place.

So:

  • Define two classes with identical params: VoidCallback? onTap and String title;
  • Make the build method to return a TextButton. If needed, we'll change it to something else in the future;
  • Put the files under lib/widgets/buttons folder.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.