当前位置:网站首页>Learn from me about the enterprise flutter project: simplified framework demo reference
Learn from me about the enterprise flutter project: simplified framework demo reference
2022-07-03 16:25:00 【Erdan and his big flower】
Preface
Recently, many people are asking me , None of them is good demo, How to do single engineering mode , How to encapsulate network requests , How to do network persistence . So today I will demo Share it out . At this stage, I can't build flutter The rapid development framework is open source . Temporarily simplify demo To show .
Related articles :
Learn from me about enterprise flutter project :flutter modularization , Conception and practice of single project architecture mode
demo Address :
https://github.com/smartbackme/myflutter
For everyone to use more clearly , I will explain the directory structure :
Directory structure

Explain with a module

Module 1 startup configuration :
class MyConfiger extends ICommentConfiger{
@override
Widget getRouter(RouteSettings settings) {
var router = RouterPage.getRouter(settings);
if(router!=null){
return router;
}
return const NullRouter();
}
}
void main() {
Application.init(AppInit(MyConfiger()));
runApp(const MyApp());
}
Common module description

Main project startup instructions
import 'package:commonmodule/commonmodule.dart';
import 'package:commonmodule/config.dart';
import 'package:flutter/material.dart';
import 'package:commonmodule/router_name.dart' as common;
import 'package:kg_density/kg_density.dart';
import 'package:myflutter/page/home.dart';
import 'package:onemodule/router_page.dart' as onemodule;
import 'package:twomodule/router_page.dart' as twomodule;
// Routing assignment management
class MyCommentConfiger extends ICommentConfiger{
@override
Widget getRouter(RouteSettings settings) {
if(settings.name == common.RouterName.home){
return const HomePage();
}
var teachertRouter = onemodule.RouterPage.getRouter(settings);
if(teachertRouter!=null){
return teachertRouter;
}
var clientRouter = twomodule.RouterPage.getRouter(settings);
if(clientRouter!=null){
return clientRouter;
}
return const NullRouter();
}
}
// Start initialization
void main() async {
MyFlutterBinding.ensureInitialized();
KgDensity.initKgDensity(designWidth : 375);
await SpSotre.instance.init();
ULogManager.init();
Application.init(AppInit(MyCommentConfiger()));
runApp(const MyApp());
}
//WidgetsFlutterBinding To configure
class MyFlutterBinding extends WidgetsFlutterBinding with KgFlutterBinding {
static WidgetsBinding ensureInitialized() {
if (WidgetsBinding.instance == null) MyFlutterBinding();
return WidgetsBinding.instance!;
}
}
边栏推荐
- 探索Cassandra的去中心化分布式架构
- Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (III)
- Batch files: list all files in a directory with relative paths - batch files: list all files in a directory with relative paths
- NSQ source code installation and operation process
- Rk3399 platform development series explanation (WiFi) 5.54. What is WiFi wireless LAN
- Nine ways to define methods in scala- Nine ways to define a method in Scala?
- Svn usage specification
- How to thicken the brush in the graphical interface
- SDNU_ ACM_ ICPC_ 2022_ Winter_ Practice_ 4th [individual]
- 1287. Elements that appear more than 25% in an ordered array
猜你喜欢

0214-27100 a day with little fluctuation

Unreal_DataTable 实现Id自增与设置RowName

"Remake Apple product UI with Android" (3) - elegant statistical chart

【LeetCode】94. Middle order traversal of binary tree

uploads-labs靶场(附源码分析)(更新中)

Cocos Creator 2.x 自动打包(构建 + 编译)

Remote file contains actual operation

Google Earth engine (GEE) - daymet v4: daily surface weather data set (1000m resolution) including data acquisition methods for each day

Initial test of scikit learn Library

Mb10m-asemi rectifier bridge mb10m
随机推荐
Is it safe to open an account with flush?
Getting started with Message Oriented Middleware
2022年Q2加密市场投融资报告:GameFi成为投资关键词
Unreal_DataTable 实现Id自增与设置RowName
ASEMI整流桥UMB10F参数,UMB10F规格,UMB10F封装
Initial test of scikit learn Library
Unity项目优化案例一
Function introduction of JMeter thread group
Expression of request header in different countries and languages
14 topics for performance interviews between superiors and subordinates (4)
高等数学(第七版)同济大学 习题2-1 个人解答
Record windows10 installation tensorflow-gpu2.4.0
Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword
ThreeJS 第二篇:顶点概念、几何体结构
2022爱分析· 国央企数字化厂商全景报告
【Proteus仿真】74HC595+74LS154驱动显示16X16点阵
One article takes you to understand machine learning
于文文、胡夏等明星带你玩转派对 皮皮APP点燃你的夏日
一台服务器最大并发 tcp 连接数多少?65535?
面试官:JVM如何分配和回收堆外内存