当前位置:网站首页>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!;
}
}
边栏推荐
- "Everyday Mathematics" serial 56: February 25
- [combinatorics] combinatorial identities (review of eight combinatorial identities | product of combinatorial identities 1 | proof | use scenario | general method for finding combinatorial numbers)
- "Remake Apple product UI with Android" (2) -- silky Appstore card transition animation
- [redis foundation] understand redis master-slave architecture, sentinel mode and cluster together (Demo detailed explanation)
- 无心剑中译泰戈尔《漂鸟集(1~10)》
- Threejs Part 2: vertex concept, geometry structure
- pyinstaller不是内部或外部命令,也不是可运行的程序 或批处理文件
- Interviewer: how does the JVM allocate and recycle off heap memory
- Thinking about telecommuting under the background of normalization of epidemic | community essay solicitation
- pycharm错Error updating package list: connect timed out
猜你喜欢
Asemi rectifier bridge umb10f parameters, umb10f specifications, umb10f package
初试scikit-learn库
App mobile terminal test [4] APK operation
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)
Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (II)
Colab works with Google cloud disk
2022年Q2加密市场投融资报告:GameFi成为投资关键词
为抵制 7-Zip,列出 “三宗罪” ?网友:“第3个才是重点吧?”
Low level version of drawing interface (explain each step in detail)
远程文件包含实操
随机推荐
PHP secondary domain name session sharing scheme
Characteristic polynomial and constant coefficient homogeneous linear recurrence
Construction practice camp - graduation summary of phase 6
How to thicken the brush in the graphical interface
Rk3399 platform development series explanation (WiFi) 5.54. What is WiFi wireless LAN
Why can't strings be directly compared with equals; Why can't some integers be directly compared with the equal sign
Visual SLAM algorithms: a survey from 2010 to 2016
无心剑中译泰戈尔《漂鸟集(1~10)》
如何在本机搭建SVN服务器
Pointcut expression
Redis installation under windows and Linux systems
1287. Elements that appear more than 25% in an ordered array
用通达信炒股开户安全吗?
The accept attribute of the El upload upload component restricts the file type (detailed explanation of the case)
[combinatorics] non descending path problem (outline of non descending path problem | basic model of non descending path problem | non descending path problem expansion model 1 non origin starting poi
远程办公之大家一同实现合作编辑资料和开发文档 | 社区征文
近视:摘镜or配镜?这些问题必须先了解清楚
Chinese translation of Tagore's floating birds (1~10)
Unreal_DataTable 实现Id自增与设置RowName
利用MySQL中的乐观锁和悲观锁实现分布式锁