nft

Flutter Template

Flutter 1.20.2 • channel stable • https://github.com/flutter/flutter.git
Framework • revision bbfbf1770c (2 weeks ago) • 2020-08-13 08:33:09 -0700
Engine • revision 9d5b21729f
Tools • Dart 2.9.1

Update app icon

flutter pub get
flutter pub run flutter_launcher_icons:main

Clone initial setup

  • Search and Replace All nft to new package id
  • Search and Replace All NFT App to new App display name
  • Search and Replace All com.app.nft to new App bundle id
  • Update directory folder path name of Android (android/app/src/main/kotlin/) same with new App bundle id
  • Remove example folder

Update localization

Install flutter_intl tool

  1. Add other locales:
  • Update CFBundleLocalizations in ios/Runner/Info.plist to add new locale
  • Run Tools -> Flutter Intl -> Add Locale
  1. Access to the current locale
Intl.getCurrentLocale()
  1. Change current locale
S.load(Locale('vi'));
  1. Reference the keys in Dart code
Widget build(BuildContext context) {
    return Column(children: [
        Text(
            S.of(context).pageHomeConfirm,
        ),
        Text(
            S.current.pageHomeConfirm,// If you don't have `context` to pass
        ),
    ]);
}

Generate intl via cli

#https://pub.dev/packages/intl_utils
flutter pub run intl_utils:generate

Structure

lib
  |-generated                     ---> auto genrated by flutter_intl
  |-I10n                          ---> auto genrated by flutter_intl
    |-intl_en.arb                 ---> define your translation here
  |-models                        ---> places of object models
  |-pages                         ---> define all pages/screens of application
    |-home                        ---> we should organize as app module (eg: home, about, ...) rather then platform module (eg: activity, dialog, ...)
      |-home_provider.dart
      |-home_screen.dart
  |-services                      ---> define app services (database service, network service)
    |-remote
      |-api.dart
      |-auth_api.dart
    |-app_loading.dart
    |-logging.dart
  |-utils                         ---> app utils
    |-app_asset.dart
    |-app_config.dart
    |-app_constant.dart
    |-app_extension.dart
    |-app_helper.dart
    |-app_log.dart
    |-app_route.dart
    |-app_style.dart
    |-app_theme.dart
  |-widgets                       ---> app widgets
  |-main.dart                     ---> each main.dart file point to each env of app. Ex: default main.dart for dev env, create new main_prod.dart for prod env
  |-my_app.dart                   ---> application bootstrap
test                              ---> widget/unit testing
test_driver                       ---> integration testing

Versioning

version: 1.0.6+2003271407
---
Version name: 1.0.6
Version code: 2003271407

Version name: major.minor.build/patch Version code: yymmddHHMM

  • Remember to increase bold the version name and code also.

https://medium.com/p/2dd558f8b524

Multi env

  • Create new env factory in app_config.dart.
  • Create new file called main_.dart. Ex: main_prod.dart and config to prod env
  • Build with flutter
flutter build ios -t lib/main_prod.dart

Testing

flutter test
flutter drive --target=test_driver/app.dart

Release

Libraries

api
app_asset
app_config
app_constant
app_extension
app_helper
app_loading
app_log
app_route
app_style
app_theme
appbar_padding
auth_api
base_response
content_page
counter_page
counter_provider
home_page
home_provider
l10n
log_in_request
log_in_response
main
messages_all
messages_en
messages_vi
my_app
normal_page
screen_widget
tutorial_page