当前位置:网站首页>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!;
}
}
边栏推荐
- Golang 装饰器模式以及在NSQ中的使用
- 用同花顺炒股开户安全吗?
- Record windows10 installation tensorflow-gpu2.4.0
- 架构实战营 - 第 6 期 毕业总结
- Is it safe to open an account with flush?
- Is it safe to open an account with tongdaxin?
- One article takes you to understand machine learning
- Deep understanding of grouping sets statements in SQL
- [combinatorics] combinatorial identity (sum of combinatorial identity products 1 | sum of products 1 proof | sum of combinatorial identity products 2 | sum of products 2 proof)
- Is it safe to open a stock account by mobile registration? Does it need money to open an account
猜你喜欢

Deep understanding of grouping sets statements in SQL

Mysql 将逗号隔开的属性字段数据由列转行

Q2 encryption market investment and financing report in 2022: gamefi becomes an investment keyword

Slam learning notes - build a complete gazebo multi machine simulation slam from scratch (4)

初试scikit-learn库

拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。

记一次jar包冲突解决过程

Explore Cassandra's decentralized distributed architecture

From the 18th line to the first line, the new story of the network security industry

One article takes you to understand machine learning
随机推荐
Uploads labs range (with source code analysis) (under update)
One article takes you to understand machine learning
The difference between calling by value and simulating calling by reference
《天天数学》连载56:二月二十五日
Visual SLAM algorithms: a survey from 2010 to 2016
Everyone in remote office works together to realize cooperative editing of materials and development of documents | community essay solicitation
Mysql 将逗号隔开的属性字段数据由列转行
Is it safe to open a stock account by mobile registration? Does it need money to open an account
8 cool visual charts to quickly write the visual analysis report that the boss likes to see
PHP中register_globals参数设置
【声明】关于检索SogK1997而找到诸多网页爬虫结果这件事
拼夕夕二面:说说布隆过滤器与布谷鸟过滤器?应用场景?我懵了。。
疫情常态化大背景下,关于远程办公的思考|社区征文
【LeetCode】94. Middle order traversal of binary tree
探索Cassandra的去中心化分布式架构
PHP CI (CodeIgniter) log level setting
How to use AAB to APK and APK to AAB of Google play apps on the shelves
如何在本机搭建SVN服务器
Using optimistic lock and pessimistic lock in MySQL to realize distributed lock
远程文件包含实操