Git Product home page Git Product logo

kingwu / flutter_starter_kit Goto Github PK

View Code? Open in Web Editor NEW
779.0 27.0 125.0 131 KB

A starter kit for beginner learns with Bloc pattern, RxDart, sqflite, Fluro and Dio to architect a flutter project. This starter kit build an App Store app as a example

License: Apache License 2.0

Kotlin 2.32% Ruby 3.13% Swift 0.57% Objective-C 0.05% Dart 93.93%
flutter flutter-examples flutter-bloc rxdart flutter-demo starter-kit ios android mobile mobile-app

flutter_starter_kit's Introduction

Flutter Starter Kit - App Store Example

A starter kit for beginner learns with Bloc pattern, RxDart, sqflite, Fluro and Dio to architect a flutter project. This starter kit build an App Store app as a example

App Store Flutter Demo

Feature

  • Bloc Pattern
  • Navigate pages by Fluro
  • Local cache by using sqflite
  • Restful api call by using Dio
  • Database debugging (Android Only) by using flutter_stetho
  • Loading Network Image
  • Localization by using gen_lang and lang_table
  • Environment Variable & Project Config (Like App Name, Bundle Id) based on different project flavour (Development, Staging & Production)
  • Build pojo by using json_serializable
  • Update each list item instead of re-rendering whole list view when data set has changed on a list item
  • Hero animation
  • Show empty View when the list view is empty

Install

  1. Follow flutter official setup guide to set up flutter environment
  2. Download flutter version 1.17.3

Remark: This starter kit support Flutter version - 1.17.3. It is because Flutter may have breaking change on latest version.

Run Config

  1. Click 'Edit Configuration'
  2. Create different run configs for flavours

Edit Config

Config

Flavour

Useful Command

Run flutter_starter_kit

For development,

flutter run --flavor development -t lib/config/main_development.dart

For staging,

flutter run --flavor staging -t lib/config/main_staging.dart

For production,

flutter run --flavor production -t lib/config/main_production.dart

Generate json serialize and deserialize functions

flutter packages pub run build_runner build --delete-conflicting-outputs

lang_table

flutter packages pub run lang_table:generate --platform=airTable --input=https://api.airtable.com/v0/appZmh0WMg3y6APAg/example --api-key={YOUR API KEY} --target=Flutter

gen_lang

flutter packages pub run gen_lang:generate

Known Issues

Migration Guide

  • If you wanna to use this project as your project's base, please read migration guide

Reference

From other platform?

Learn Widget & Layout

Bloc Pattern

Json Serialization

Localization

Flavouring

Advance Topic

Powered By

flutter_starter_kit's People

Contributors

kingwu avatar mono0926 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

flutter_starter_kit's Issues

Please solve the infinite loading problem!

Hello @KingWu ! I am trying to solve the infinite loading problem in this starter-kit
Many attempts have been made to identify the cause.
And then, I found that after entering 'Entry _$EntryFromJson' of "Entry.g.dart' to be infinitely loading.
theProblems1
theProblems2

In the console, the previous code works fine.
After entering '$EntryFromJson', it is confirmed that the operation stops.
To check this, I used a simple method to print messages to the console.

I think, 'void _showLoading' function in 'HomePadge.dart' is displays the loading screen, and it doesn't seem to go to the next screen.

I don't know how to solve this problem from here on.
Help me Please!!!

Problem with navigation using BlocListener

With flutter new update 3.0.0 there is a problem with navigation using BlocListener when I navigate to the next screen it navigates and when i go back I need two clicks to pop the screen when navigate with anything else it works and i pop the screen with one click

Build fails

Running "flutter pub get" in flutter_starter_kit... 2.7s
Launching lib\config\main_development.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Finished with error: Please review your Gradle project setup in the android/ folder.

  • Error running Gradle:
    ProcessException: Process "C:\dev\flutter_starter_kit\android\gradlew.bat" exited abnormally:
    Starting a Gradle Daemon (subsequent builds will be faster)

Configure project :app
app: 'annotationProcessor' dependencies won't be recognized as kapt annotation processors. Please change the configuration name to 'kapt' for these artifacts: 'com.github.bumptech.glide:compiler:4.8.0' and apply the kapt plugin: "apply plugin: 'kotlin-kapt'".

Configure project :path_provider

Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.

FAILURE: Build failed with an exception.

  • What went wrong:
    A problem occurred configuring project ':path_provider'.

Could not resolve all artifacts for configuration ':path_provider:classpath'.
Could not download builder.jar (com.android.tools.build:builder:3.3.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/builder/3.3.0/builder-3.3.0.jar'.
> Read timed out
Could not download manifest-merger.jar (com.android.tools.build:manifest-merger:26.3.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.3.0/manifest-merger-26.3.0.jar'.
> Could not GET 'https://dl.google.com/dl/android/maven2/com/android/tools/build/manifest-merger/26.3.0/manifest-merger-26.3.0.jar'.
> Connection reset
Could not download bundletool.jar (com.android.tools.build:bundletool:0.6.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/build/bundletool/0.6.0/bundletool-0.6.0.jar'.
> Read timed out
Could not download protos.jar (com.android.tools.analytics-library:protos:26.3.0)
> Could not get resource 'https://dl.google.com/dl/android/maven2/com/android/tools/analytics-library/protos/26.3.0/protos-26.3.0.jar'.
> Read timed out

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

  • Get more help at https://help.gradle.org

BUILD FAILED in 3m 14s
Command: C:\dev\flutter_starter_kit\android\gradlew.bat app:properties

APIProvider

I am learning from your patten and using the APIProvider class to make calls to an api. Question if i have new api end point which doesn't use the _baseUrl how would i use _dio

currently...
static const String _newAPIUrl = 'https://www.test.com/api/'

if i use _dio.post(APIProvider._newAPIUrl, data: data);
the url path is pre-pended with the _baseUrl

How can I avoid in nice way the pre-pending of the _baseUrl value?
thx

How do I run this app

Hi, I've run a large number of Flutter apps that I've downloaded from github, but I cannot see how to run this. There is no main.dart, and I don't know how to run config. Can you please advise.

[IOS] How can I rename app on Organizer

Hi bro,

Thank you for your starter kit! It's really nice for us.

image
I'm trying to archive my app to apple but, its showing development...its show be named English Listening...I changed it already.
image

Please help me if you know that.
Thank you!

Error running in all 3 modes. Easily fixed. Simple SqFlite example would be gr8.

C:\Users\boh5\flutter-dev\apps_dev\bloc\flutter_starter_kit>flutter run --flavor staging -t lib/config/main_staging.dart
Launching lib/config/main_staging.dart on Moto G 5S Plus in debug mode...
Initializing gradle... 0.7s
Resolving dependencies... 2.4s

Compiler message:
lib/app/ui/page/AppDetailPage.dart:243:49: Error: Expected ',' before this.
        separatorBuilder: (BuildContext context int index){
                                                ^^^
lib/app/ui/page/AppDetailPage.dart:246:44: Error: Expected ',' before this.
        itemBuilder: (BuildContext context int index){
                                           ^^^
Compiler failed on C:\Users\boh5\flutter-dev\apps_dev\bloc\flutter_starter_kit\lib/config/main_staging.dart
Running Gradle task 'assembleStagingDebug'...
Running Gradle task 'assembleStagingDebug'... Done                  4.2s
Gradle task assembleStagingDebug failed with exit code 1

[flutter run -t homepage.dart] Showing empty

Hi KingWu,

I'd like to say hello first. I really love your starter kit.
I'm a newbie of flutter. Could you help me how to run your example?
image
its empty now!
I'm using this command: flutter run -t lib/app/ui/page/HomePage.dart
and also flutter run -t lib/app/ui/page/AppDetailPage.dart
They are the same result.
Please give me a help.
Email: [email protected]
Skype: vult.pnv

Regards and waiting for ur help!

Tutorial

I'm starting to use flutter and I wanted to use this starter kit as a starting point for a project wouldn't it be nice to have a wiki where we can show how to add models, auth, caching and Api routes.

Maybe how to add a screen

Forgive me if that's not the case it's just the files were overwhelming and I wanted to customize it a bit

Help In Visual Studio Code

flutter_starter_kit ashish$ flutter run lib/utility/framework/Application.dart
Using hardware rendering with device Android SDK built for x86. If you get graphics artifacts, consider enabling software rendering with "--enable-software-rendering".
Launching lib/utility/framework/Application.dart on Android SDK built for x86 in debug mode...
Initializing gradle... 10.2s
Resolving dependencies...
177.4s (!)

The Gradle project does not define a task suitable for the requested build.
The android/app/build.gradle file defines product flavors: development, production, staging
You must specify a --flavor option to select one of them.
Gradle build aborted.

Error: The non-abstract class 'StethoHttpClientResponse' is missing implementations for these members: - HttpClientResponse.compressionState

Launching lib\config\main_development.dart on Android SDK built for x86 in debug mode...
Initializing gradle...
Resolving dependencies...
Running Gradle task 'assembleDevelopmentDebug'...

Compiler message:
file:///C:/bin/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_stetho-0.2.2/lib/src/http_client_response.dart:4:7: Error: The non-abstract class 'StethoHttpClientResponse' is missing implementations for these members:
 - HttpClientResponse.compressionState
Try to either
 - provide an implementation,
 - inherit an implementation from a superclass or mixin,
 - mark the class as abstract, or
 - provide a 'noSuchMethod' implementation.

class StethoHttpClientResponse extends StreamView<List<int>>
      ^^^^^^^^^^^^^^^^^^^^^^^^
org-dartlang-sdk:///third_party/dart/sdk/lib/_http/http.dart:1967:42: Context: 'HttpClientResponse.compressionState' is defined here.
  HttpClientResponseCompressionState get compressionState;
                                         ^^^^^^^^^^^^^^^^
Compiler failed on C:\dev\flutter_starter_kit\lib\config\main_development.dart

FAILURE: Build failed with an exception.

* Where:
Script 'C:\bin\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 665

* What went wrong:
Execution failed for task ':app:compileflutterBuildDevelopmentDebugX86'.
> Process 'command 'C:\bin\flutter\bin\flutter.bat'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 26s
Finished with error: Gradle task assembleDevelopmentDebug failed with exit code 1

Deprecated!!

inheritFromWidgetOfExactType in AppProvider deprecated.

// Change this line
(context.inheritFromWidgetOfExactType(AppProvider) as AppProvider)

// Replace with
(context.dependOnInheritedWidgetOfExactType())

[ How to Fix ] type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String'

Hi,

I needed to change the RSS from Apple Store:
static const String _baseUrl = 'https://rss.itunes.apple.com/api/v1'; // https://itunes.apple.com/hk
static const String _TOP_FREE_APP_API = '/us/ios-apps/top-free/all/%d/explicit.json'; //https://itunes.apple.com/hk/rss/topfreeapplications/limit=10/json
static const String _TOP_FEATURE_APP_API = '/us/ios-apps/top-grossing/all/%d/explicit.json';
static const String _APP_DETAIL_API = '/lookup/json';

Now I'm receiving the issue in some mapping:
Screen Shot 2019-07-29 at 17 04 34
type '_InternalLinkedHashMap<String, dynamic>' is not a subtype of type 'String'

I think the issue was here:
.../flutter_starter_kit/lib/app/model/pojo/response/TopAppResponse.dart

Thanks for your support =)

too old

The current Dart SDK version is 2.3.0-dev.0.0.flutter-8e73b3c006.

Because dashboard depends on flutter_staggered_grid_view >=0.1.1 <0.2.2 which requires SDK version >=1.19.0 <2.0.0, version solving failed.

pub get failed (1)

Why it keeps loading

Hi @KingWu

device-2019-09-24-090933

I tried to run the app, but it keeps showing the loading dialog in the homepage. I don't think the api is restricted to my country because i got the response in the logs.

I/flutter (15855): INFO: 2019-09-24 09:08:36.466345: APIProvider - Request Path : [GET] https://itunes.apple.com/hk/rss/topfreeapplications/limit=100/json
I/flutter (15855): INFO: 2019-09-24 09:08:36.467205: APIProvider - Request Data : null
I/flutter (15855): INFO: 2019-09-24 09:08:39.863540: APIProvider - Request Path : [GET] https://itunes.apple.com/hk/rss/topgrossingapplications/limit=10/json
I/flutter (15855): INFO: 2019-09-24 09:08:39.864060: APIProvider - Request Data : null
I/flutter (15855): INFO: 2019-09-24 09:08:41.108807: APIProvider - Response Path : [GET] https://itunes.apple.com/hk/rss/topgrossingapplications/limit=10/json Request Data : null
I/flutter (15855): INFO: 2019-09-24 09:08:41.109443: APIProvider - Response statusCode : 200
I/flutter (15855): INFO: 2019-09-24 09:08:41.110048: APIProvider - Response data : {"feed":{"author":{"name":{"label":"iTunes Store"}, "uri":{"label":"http://www.apple.com/itunes/"}}, "entry":[
I/flutter (15855): {"im:name":{"label":"萬國覺醒-RoK"}, "im:image":[
I/flutter (15855): {"label":"https://is2-ssl.mzstatic.com/image/thumb/Purple123/v4/b3/12/a6/b312a634-2472-d3e1-bdeb-83ff5e5edf46/AppIcon-0-1x_U007emarketing-0-85-220-9.png/53x53bb.png", "attributes":{"height":"53"}}, 
I/flutter (15855): {"label":"https://is1-ssl.mzstatic.com/image/thumb/Purple123/v4/b3/12/a6/b312a634-2472-d3e1-bdeb-83ff5e5edf46/AppIcon-0-1x_U007emarketing-0-85-220-9.png/75x75bb.png", "attributes":{"height":"75"}}, 
I/flutter (15855): {"label":"https://is4-ssl.mzstatic.com/image/thumb/Purple123/v4/b3/12/a6/b312a634-2472-d3e1-bdeb-83ff5e5edf46/AppIcon-0-1x_U007emarketing-0-85-220-9.png/100x100bb.png", "attributes":{"height":"100"}}], "summary":{"label":"【遊戲特色】\n\n-運籌帷幄,作戰策略由你決定\n想在地圖上來個迂迴包抄?還是想據守地形,以弱勝強?亦或直取敵巢,圍魏救趙�
I/flutter (15855): INFO: 2019-09-24 09:08:41.241229: type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>' in type cast
I/flutter (15855): INFO: 2019-09-24 09:08:41.541581: APIProvider - Response Path : [GET] https://itunes.apple.com/hk/rss/topfreeapplications/limit=100/json Request Data : null
I/flutter (15855): INFO: 2019-09-24 09:08:41.542045: APIProvider - Response statusCode : 200
I/flutter (15855): INFO: 2019-09-24 09:08:41.543467: APIProvider - Response data : {"feed":{"author":{"name":{"label":"iTunes Store"}, "uri":{"label":"http://www.apple.com/itunes/"}}, "entry":[
I/flutter (15855): {"im:name":{"label":"有線新聞"}, "im:image":[
I/flutter (15855): {"label":"https://is4-ssl.mzstatic.com/image/thumb/Purple123/v4/bd/4a/6d/bd4a6d93-8889-4465-2d7f-667b9c003fff/AppIcon-0-1x_U007emarketing-0-0-GLES2_U002c0-512MB-sRGB-0-0-0-85-220-0-0-0-7.png/53x53bb.png", "attributes":{"height":"53"}}, 
I/flutter (15855): {"label":"https://is5-ssl.mzstatic.com/image/thumb/Purple123/v4/bd/4a/6d/bd4a6d93-8889-4465-2d7f-667b9c003fff/AppIcon-0-1x_U007emarketing-0-0-GLES2_U002c0-512MB-sRGB-0-0-0-85-220-0-0-0-7.png/75x75bb.png", "attributes":{"height":"75"}}, 
I/flutter (15855): {"label":"https://is2-ssl.mzstatic.com/image/thumb/Purple123/v4/bd/4a/6d/bd4a6d93-8889-4465-2d7f-667b9c003fff/AppIcon-0-1x_U007emarketing-0-0-GLES2_U002c0-512MB-sRGB-0-0-0-85-220-0-0-0-7.png/100x100bb.png", "attributes":{"height":"100"}}], "summary":{"label":"24小時無間斷播放有線新聞台及有線財經資訊台"}
V/BoostFramework(15855): BoostFramework() : mPerf = com.qualcomm.qti.Performance@b60c0e5

doesn't this seem more complex than needed?

Just working through your approach and finding things a little layered. I had to document it out to figure out the layered approach. Does this sound right?

Main

creates AppStoreApplication object (creating instances of DbAppStoreRepository, AppStoreAPIRepository, and Router)

creates new AppComponent stateful widget (passing in AppStoreApplication object)
> which returns AppProvider (inherited widget)
- which passes in application and surfaces Router, AppStoreApplication

interesting approach (just seems little complex) no?

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.