flutter-template-perfect
flutter-template-perfect copied to clipboard
这是一个商用级MVVM模板。This is a commercial grade MVVM template.
flutter MVVM template中文
A new Flutter project template with Null-safety.
Getting Starter
# dev
> flutter run
# run with Specify entry
> flutter run --target ex/exMain.dart
# build
> flutter build apk
Core functions
-
stacked
: MVVM architecture -
route
base onauto_route
, Generate using build_runner -
service
base onget_it, stacked_service
, for example [NavigationService,DialogService,BottomSheetService,SnackbarService] [ConnectivityService,OpenLinkService,ShareService,FileService,LocalStorageService...] -
model
base onbuilt_value
,Generate using build_runner -
localization
base onflutter_localizations
,Built in Chinese and English [en,zh],Define in assets/lang -
common utils
be located core/utils,Built in common colors,size[Colour,Distance,validators]
1. stacked
- A view file controls UI and a model file controls all data. eg: XX_view.dart && XX_view_model.dart
2. service
-
NavigationService: Router control,router listen
-
DialogService: Dialog
-
BottomSheetService: BottomSheet
-
SnackbarService: Snackbar
-
ConnectivityService :Connect to the service. Whether the application is in the foreground or zoomed to the background. Monitor the application lifecycle. use
connectivity_plus
package -
OpenLinkService : launching a URL . use
url_launcher
package -
ShareService : Share . use
share
package -
FileService : File upload, download and save service. use
path_provider
package -
LocalStorageService : Local storage service. use
shared_preferences
package -
AppSettingsService : AppSetting. use
app_settings
package -
EnvironmentService : Environment setting. use
flutter_dotenv
package -
device_info_plus : get device info . use
device_info_plus
package -
KeyboardService : Keyboard. use
flutter_keyboard_visibility
package -
HttpService : Http request. use
dio
package -
StoppableService : Stop called Service
Automatic generation model
Run in the project root directory:
> flutter packages pub run build_runner build --delete-conflicting-outputs
# or(或者)
> flutter packages pub run build_runner watch