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

WIP: new flutter-starter-boilerplate #31

Open
wants to merge 38 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
a82e264
new flutter-starter-boilerplate
geekruchika Sep 16, 2022
5e8dc77
new flutter-starter-boilerplate folders added
geekruchika Sep 16, 2022
671b791
demo gif added
geekruchika Sep 16, 2022
b848a4b
update readme
geekruchika Sep 16, 2022
418a836
📝 Added guidelines on how to use flutter starter
Sep 22, 2022
42a45ac
📝 added code snippets and refactored README
Sep 26, 2022
95cc6d0
🎨 added steps on how to remove unwanted service
Sep 26, 2022
26aed0e
📝 refactored README
Sep 26, 2022
7ee0cac
📝 refactored steps on how to use flutter starter
Sep 26, 2022
7550a96
📝 added BLoC steps in README
Sep 26, 2022
2e1583e
🔨 refactored bloc for updating theme
Sep 27, 2022
847c402
write unit test cases
JeevanGeek Sep 27, 2022
cc9a573
write widget test cases
JeevanGeek Sep 27, 2022
dc4cadc
write integration test cases
JeevanGeek Sep 27, 2022
509e92c
Merge pull request #32 from GeekyAnts/module/update-readme
geekruchika Sep 28, 2022
3a0fe35
Merge pull request #33 from GeekyAnts/module/refactor-bloc
geekruchika Sep 28, 2022
9c54ba1
Merge branch 'upgrade/flutter-starter-2-master' into test-cases
JeevanGeek Sep 28, 2022
eff5658
fix failing test cases
JeevanGeek Sep 28, 2022
5901958
fix theme switch value
JeevanGeek Sep 28, 2022
6f816e0
Merge pull request #35 from GeekyAnts/test-cases
geekruchika Sep 28, 2022
b9d43e8
fix gitignore files
JeevanGeek Sep 28, 2022
d24d8eb
📝 added Tech stack table and test cases point
Sep 29, 2022
4187201
📝 updated guidelines
Sep 29, 2022
88744dc
updated guidelines
Sep 29, 2022
cdaabfa
updated README
Sep 29, 2022
a14c30a
Merge pull request #39 from GeekyAnts/module/update-readme
geekruchika Sep 29, 2022
8f25ed7
update api-sdk and repository
JeevanGeek Oct 7, 2022
f0c4ea1
refactor imports
JeevanGeek Oct 7, 2022
516b9d0
fix bundleId and appname
JeevanGeek Oct 13, 2022
fd5ecb8
Merge pull request #40 from GeekyAnts/refactor/api-sdk
geekruchika Oct 20, 2022
47050cf
Merge pull request #36 from GeekyAnts/fix/gitignore
geekruchika Oct 20, 2022
2f6be98
add graphql module
JeevanGeek Nov 3, 2022
368cdc1
added CLI information in README
JeevanGeek Nov 4, 2022
45ea3ab
add information about graphql
JeevanGeek Nov 9, 2022
dc71c14
Merge pull request #42 from GeekyAnts/feature/graphql
geekruchika Nov 10, 2022
d434928
Merge pull request #41 from GeekyAnts/readme
geekruchika Nov 10, 2022
84f8507
add instructions for graphql server
JeevanGeek Nov 10, 2022
5b172b2
Merge pull request #43 from GeekyAnts/graphql-readme
geekruchika Nov 10, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
64 changes: 0 additions & 64 deletions CONTRIBUTING.md

This file was deleted.

21 changes: 0 additions & 21 deletions LICENSE

This file was deleted.

135 changes: 71 additions & 64 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,105 +1,111 @@
# Flutter Starter
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section -->
[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)
<!-- ALL-CONTRIBUTORS-BADGE:END -->
### Flutter Starter

## Introduction
We wanted to take Flutter a step further and accelerate the process of building production-level apps. Presenting our solution- Flutter Starter!

We wanted to take Flutter a step further and accelerate the process of building production-level apps. Presenting our solution- [Flutter Starter](https://flutter-starter.github.io/)!
![demo gif](./flutter_starter.gif)

<p align="center">
<img src="/flutter_starter_kit.gif" height="500"/>
</p>
## Introduction:

Flutter Starter, as the name suggests, is a starter kit for Flutter that helps you bootstrap projects with all the essential modules like **State Management, API calls, Style Guide,** etc. It helps you build production ready apps in a jiffy. Handle everything at one place so you don't have to rewrite code.
Flutter Starter, a starter kit for Flutter that helps you bootstrap projects with all the essential modules like **State Management, API calls, Style Guide, Localisation, Routes** etc. It helps you build production ready apps in a jiffy. It handles everything at one place so you don't have to rewrite code.

## Motivation
### Tech Stack

Flutter gives us a simple counter app on installation which works if you are just starting out. However, while building a production-level app, we need state-management, API calls, Styleguide and common widgets. We frequently repeat this code in every project.
| Library | Category | Version | Description |
| -------------------- | -------------------- | ------- | ------------------------------------------------------------------------------------------------------------- |
| Flutter | Mobile Framework | 3.0.1 | A framework for building multi-platform applications from a single codebase. |
| Flutter Localization | Internationalization | 0.17.0 | Localizations for the Flutter library. |
| BLoC | State Management | 8.1.0 | This design pattern helps to separate presentation from business logic |
| Flutter Bloc | State Management | 8.1.1 | Makes it easy to implement the BLoC design pattern |
| Http | Api Service | 0.13.5 | A composable, multi-platform, Future-based API for HTTP requests. |
| Http Interceptor | Intercepting | 1.0.2 | A simple plugin that allows you to intercept request and response objects and modify them if desired. |
| Shared Preferences | Storage | 2.0.12 | Wraps platform-specific persistent storage for simple data. |
| Dio | State Management | 4.0.6 | A powerful Http client for Dart. |
| Retrofit | Dio client Generator | 3.0.1+1 | A dio client generator using source_gen. |
| Graphql | Api Service | 5.1.0 | A GraphQL client for Flutter. |
| Go Router | Routing | 4.4.1 | A declarative router for Flutter based on Navigation 2 supporting deep linking. |
| Bloc Test | Testing | 9.1.0 | A testing library which makes it easy to test blocs. |
| Mocktail | Testing | 0.3.0 | A Dart mock library which simplifies mocking with null safety support and no manual mocks or code generation. |

Flutter Starter is based on the **DRY principle. Don't Repeat Yourself** is a programming principle that is aimed at reducing repetition and redundancy.
## What does Flutter Starter provide :

>:bulb: The **DRY principle** states that "Every piece of knowledge must have a single, unambiguous, authoritative representation within a system".
For the initial release flutter starter provides:

Why is this useful? Applying the DRY principle helps code maintainability, improves development efficiency and much more!
1. **Api- Services** There are three api-services **dio**, **http** and **graphql** that have been set up if you want to provide any network method calls. We have set up an example of http in the application for signup/ login purposes but you can choose whatever you are comfortable with.

## Features
- **Dio** : It is a powerful Http client for Dart, which supports Interceptors, Global configuration, FormData, Request Cancellation, File downloading, Timeout etc. [here](lib/api_sdk/dio)

* **Folder Structure:** Flutter Starter comes with a well-defined folder structure. Devs can easily navigate it and add files where necessary.
- **Http** : It is a composable, Future-based library for making HTTP requests that contains a set of high-level functions and classes that make it easy to consume HTTP resources. [here](lib/api_sdk/http)

* **Style Guide:** This kit helps you to build a Style Guide for your app. You can add your image and font assets, splash screen, color constants and theme data. These are available for use wherever required in your project.
- **Graphql** : It is a stand-alone GraphQL client for Flutter, bringing all the features from a modern GraphQL client to one easy to use package. [here](lib/api_sdk/graphql)

* **API Calls:** The starter kit includes all the files you need for API handling. You can choose from [REST](https://restfulapi.net/), [GraphQL](https://graphql.org/) and [Firebase](https://firebase.google.com/) depending on your project.
2. **State Management** For state management in the application, BLoC has been set up for basic authentication and updating themes in the app.

* **State Management:** Flutter Starter contains all the state management files, models and repositories for your app. We will use [Bloc](https://pub.dev/packages/bloc) for state management.
- **BLoC :** Flutter bloc is quite **simple** and easy to understand, it has a very good documentation with tons of examples and also, is one of the most used in the flutter community. [here](lib/shared/bloc)

* **Routers & Dependencies:** This kit allows you to quickly add routers for your app screens. Dependencies can also be added to your app by simply copy-pasting the install version from [pub.dev](https://pub.dev/) into the designated file.
3. **Basic Set up**

* **Testing & Deployment:** Lastly, you can test and deploy your app smoothly using Flutter Starter! Go to the test folder, add your test files and start writing test cases. Check out the [Android](https://flutter.dev/docs/deployment/android) or [iOS](https://flutter.dev/docs/deployment/ios) pages to deploy your app.
- **Localisation**: If you build an app for different markets, you will most likely need to support multiple languages for your end-users, hence we have added localisation as a basic set up. Right now, 3 languages have been added in our localisation folder but you can add more according to your use case: English, Spanish, French. [here](lib/l10n)

## Installing & Usage
- **Routing** : An app has to display multiple screens depending upon the developer's needs. Hence we need different set of routes to display those screens. We have set up a basic file (routes.dart) in which we are demonstrating how you can set-up routes of your application. We have added **go_router** as a dependency for routing so that same application can be run on flutter_web too, but if you want you can use basic routing as well by just uncommenting the code and using it as per requirements. [here](lib/routes)

Go to [Flutter](https://flutter.dev/docs/get-started/install) and install Flutter on your system. Proceed to our [Github repository](https://github.com/GeekyAnts/flutter-starter) and create a template.
- **Themes** : Theme of the whole application will be derived from here. A basic theme set up including interchanging of light and dark theme will be there. You can add n amount of colours, font sizes, text theme, etc to maintain the theme of your application. [here](lib/themes)

To run the project, run:
```
bash run_script.sh
```
4. **UI Screens**

- **Sign In :** This will be the landing page of our application, for someone who already has an account registered can login directly. [here](lib/screens/login/login_screen.dart)

>:bulb: You can build apps with Flutter using any text editor combined with our command-line tools. We use VS Code since it is lightweight.
- **Sign Up :** You can register yourself here. [here](lib/screens/signup/signup_screen.dart)

## Examples
- **Home :** It will contain a drawer which will have basic user information who has logged in and a switch to change between light and dark theme. [here](lib/screens/home/home.dart)

Here are some of the example apps made using Flutter Starter:
5. **Test Cases** We have also introduced test cases in the base setup so that you can validate your UI, business logic, functionality, etc. We have set up :

- [HackerNews App](https://flutter-starter.github.io/docs/hacker-news-example)
- **Unit Test Cases :** Unit tests are handy for verifying the behaviour of a single function, method, or class. [here](./test/bloc/)
- **Integration Test Cases :** They test how individual pieces work together as a whole, or capture the performance of an application running on a real device. [here](./integration_test/app_test.dart)
- **Widget Test Cases :** They test the UI components. It is used to test a single widget. The main goal of widget testing is to check whether the widget works as expected. [here](./test/screens/)

<p align="center">
<img src="/hacker_news.gif" height="500"/>
</p>
## What will Flutter Starter provide in later releases :

For second release we are planning to introduce one more api-service and command line interface.

- [GithubRepo List App](https://flutter-starter.github.io/docs/github-repo-list-example)
1. **Api-Services** :

<p align="center">
<img src="/github_repo_list.gif" height="500"/>
</p>
- **Firebase** : We will be providing all social authentications(Google/Twitter/Facebook etc) to the developer using firebase services.

- [Weather App](https://flutter-starter.github.io/docs/weather-app-example)
2. **State Management** :

<p align="center">
<img src="/weather_app.gif" height="500"/>
</p>
- **Provider/Riverpod** : We will be providing support for Provider/Riverpod state management templates too.

## Tech Stack
3. **Command Line Interface** : We are aiming to provide a command line interface, so that you can easily create a project using flutter starter as the base template by just writing a command in the terminal.

Flutter, Firebase, GraphQL, REST and Bloc.
4. **Example Templates** : We will creating multiple apps template on how to use this boilerplate.

## Naming Conventions
## How to use flutter starter:

* **Variables:** camelCase
* **Classes:** PascalCase
* **Files:** snake_case
To get started with flutter starter:

## Build Status
[Check out our roadmap here.](https://trello.com/b/wxSMZP1H/flutter-starter)
[Steps to get started](./use_flutter_starter.md)

## Using Flutter Starter CLI

## Contributors
- Flutter Starter CLI is written in the Dart programming language. It is a very useful tool that provides commands for the ease of setting up a Flutter project from scratch.
- While working with the Flutter projects we have to write the same repetitive code multiple times but using this CLI, we can create a Flutter template on the fly.
- Also, the basic structure of all the tests in Flutter is the same. So this CLI also provides a basic starter pack for the Flutter test as well.

<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
<!-- prettier-ignore-start -->
<!-- markdownlint-disable -->
<table>
<tr>
<td align="center"><a href="https://github.com/raj2611"><img src="https://avatars1.githubusercontent.com/u/23263053?v=4" width="100px;" alt=""/><br /><sub><b>Sumant Raj</b></sub></a><br /><a href="https://github.com/GeekyAnts/flutter-starter/commits?author=raj2611" title="Code">💻</a></td>
<td align="center"><a href="https://github.com/madhav23bansal"><img src="https://avatars0.githubusercontent.com/u/52946553?v=4" width="100px;" alt=""/><br /><sub><b>madhav23bansal</b></sub></a><br /><a href="https://github.com/GeekyAnts/flutter-starter/commits?author=madhav23bansal" title="Code">💻</a></td>
</tr>
</table>
Activate globally via:

```sh
dart pub global activate flutter_starter_cli
```

<!-- markdownlint-enable -->
<!-- prettier-ignore-end -->
<!-- ALL-CONTRIBUTORS-LIST:END -->
```sh
# To create project
$ flutter_starter_cli create

# Then follow instructions
```

Read more about [`Flutter Starter CLI`](https://pub.dev/packages/flutter_starter_cli).

## How to Contribute

Expand All @@ -108,4 +114,5 @@ Thank you for your interest in contributing to Flutter Starter! We are lucky to
## License

Licensed under the MIT License, Copyright © 2020 GeekyAnts.

See [LICENSE](https://github.com/GeekyAnts/flutter-starter/blob/master/LICENSE) for more information.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion
ndkVersion flutter.ndkVersion

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
Expand All @@ -43,8 +44,10 @@ android {

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId "com.example.app"
minSdkVersion flutter.minSdkVersion
applicationId "com.example.flutter_starter"
// You can update the following values to match your application needs.
// For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-build-configuration.
minSdkVersion 19
targetSdkVersion flutter.targetSdkVersion
versionCode flutterVersionCode.toInteger()
versionName flutterVersionName
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
<!-- Flutter needs it to communicate with the running application
package="com.example.flutter_starter">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.app">
package="com.example.flutter_starter">
<application
android:label="app"
android:label="flutter_starter"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
Expand Down
Loading