当前位置:网站首页>Learn more about materialapp and common attribute parsing in fluent
Learn more about materialapp and common attribute parsing in fluent
2022-07-02 03:42:00 【Keke duck~】
One 、Flutter Middle structure diagram

Flutter Framework
Foundation、Animation、Painting、Gestures Synthesized Dart UI layer , The corresponding is Flutter in dart:ui package , The corresponding meaning is animation 、 gesture 、 Drawing ability .
Rendering Layer is an abstract layout layer , Depend on Dart UI layer ,Rendering Layer will build a UI Trees 、 When UI When the trees change , The accountant worked out what had changed , And then update UI Trees , Finally, it's drawn on the screen
Widgets Layer is Flutter Provide a set of basic component libraries
Material、Cupertino yes Flutter Two visual style component libraries are provided (Android、iOS)
Flutter Engine
This is a pure C++ Realized SDK, It mainly performs related rendering 、 Thread management 、 Platform events and other operations . Which includes Skia engine 、Dart Runtime 、 Typesetting engine, etc . Calling dart:ui Kuo is , In fact, it will eventually come to Engine layer , Realize the real drawing logic
Flutter Embedder
Provide four Task Runner, Run the engine all the way to the rendering settings of the platform middle tier code 、 Native plug-ins 、 pack 、 Thread management 、 Time cycle 、 Interactive operation, etc .
Two 、Material Introduce
MaterialApp It contains a lot of Widget , these Widget It is usually to implement Material Design
Necessary for your application , Contains Widget Can be in Material Components widgets View all .
| Field | attribute | describe |
|---|---|---|
| navigatorKey | GlobalKey<NavigatorState> | Navigation key |
| scaffoldMessengerKey | GlobalKey<ScaffoldMessengerState> | Scaffold key |
| home | Widget | Home page , The page displayed when the application opens |
| routes | Map<String, WidgetBuilder> | Application top-level routing table |
| initialRoute | String | If the navigator is built , The name of the first route will be displayed |
| onGenerateRoute | RouteFactory | Route management interceptor |
| onGenerateInitialRoutes | InitialRouteListFactory | Generate initialization route |
| onUnknownRoute | RouteFactory | When onGenerateRoute Called when a route cannot be generated |
| navigatorObservers | List<NavigatorObserver> | Create an observer list for the navigator |
| builder | TransitionBuilder | Insert a widget on the navigator |
| title | String | Title displayed during program switching |
| onGenerateTitle | GenerateAppTitle | Generate title string when program switching |
| color | Color | Apply icon background color when program switching ( Only Android works ) |
| theme | ThemeData | Theme color |
| darkTheme | ThemeData | Dark mode theme color |
| highContrastTheme | ThemeData | System request “ High Contrast ” Theme used |
| highContrastDarkTheme | ThemeData | System request “ High Contrast ” Theme color used in dark mode |
| themeMode | ThemeMode | The theme of which mode to use ( Default follow system ) |
| locale | Locale | Initial locale |
| localizationsDelegates | Iterable<LocalizationsDelegate<dynamic>> | Localization agent |
| localeListResolutionCallback | LocaleListResolutionCallback | Failed or did not provide the locale of the device |
| localeResolutionCallback | LocaleResolutionCallback | Responsible for computing language environment |
| supportedLocales | Iterable<Locale> | List of localized regions |
| debugShowMaterialGrid | bool | Draw baseline mesh overlay ( only debug Pattern ) |
| showPerformanceOverlay | bool | Show performance overlay |
| checkerboardRasterCacheImages | bool | Open the checkerboard of the grid cache image . |
| checkerboardOffscreenLayers | bool | Open the checkerboard of layers rendered to off screen bitmaps . |
| showSemanticsDebugger | bool | Open the overlay that displays accessibility information |
| debugShowCheckedModeBanner | bool | Debug display check mode banner |
| shortcuts | Map<LogicalKeySet, Intent> | Default mapping of keyboard shortcuts intended by the application . |
| actions | Map<Type, Action<Intent>> | Contains and defines mappings for user actions |
| restorationScopeId | String | Identifier of the application state recovery |
| scrollBehavior | ScrollBehavior | How scrollable widgets behave |
3、 ... and 、 Attribute resolution
1.navigatorKey
navigatorKey amount to Navigator.of(context) , If the application wants to implement no context Jump , Then you can set the key, adopt navigatorKey.currentState.overlay.context Get the big picture context.
Usage mode
GlobalKey<NavigatorState> navigatorKey = new GlobalKey();
navigatorKey: navigatorKey ,
2.home
Pass in Widget Components , Show the first page
3.debugShowCheckedModeBanner
Debug display check mode banner , Generally set as false
debugShowCheckedModeBanner: false,
4.onGenerateRoute
When jumping a route , If in routes No corresponding key , The callback will be executed , Will call and return a RouteSettings , The object contains name Routing name 、 arguments Routing parameters .
// In the previous article, I talked about how to configure unified routing
onGenerateRoute: AppRouteManager.getInstance().onGenerateRoute,
5.initialRoute
Initial route , If this parameter is set and in routes Found the corresponding key, The corresponding Widget , Otherwise show home
MaterialApp(
routes: {
"/home": (_) => Home(),
"/my": (_) => My()
},
initialRoute: "/home",
)
6.builder
In the build MaterialApp Of Widget tree when , That is, loading child Give to before child Add a parent node to the parameter . So some toast Libraries need to be global context Three party Library , Will use builder Add yourself to widget tree in .
builder: EasyLoading.init(),
7.theme
Specify the whole App Theme color
MaterialApp(
theme: ThemeData(
// Main colors
primaryColor: Colors.pink
),
)
8.scaffoldMessengerKey
scaffoldMessengerKey Mainly to manage future generations Scaffolds, Can be achieved without context call snack bars
GlobalKey<ScaffoldMessengerState> _Key = GlobalKey();
MaterialApp(
scaffoldMessengerKey: _Key,
);
_scaffoldKey.currentState.showSnackBar(SnackBar(content: Text("show SnackBar")));
9.onGenerateInitialRoutes
If provided initialRoute , The route generator callback used to generate the initial route , If this property is not set , Then the bottom layer Navigator.onGenerateInitialRoutes Default to Navigator.defaultGenerateInitialRoutes.
10.onUnknownRoute
Effect and onGenerateRoute equally , Just go first onGenerateRoute , If the route cannot be generated, call onUnknownRoute
MaterialApp(
routes: {
"/home": (_) => Home(),
},
initialRoute: "/home",
onGenerateRoute: (setting) {
return null;
},
onUnknownRoute: (setting) {
return MaterialPageRoute(builder: (_) => Home());
},
)
11.navigatorObservers
Listen for routing stack changes
static final RouteObserver<PageRoute> routeObserver =
RouteObserver<PageRoute>();
navigatorObservers: [MyApp.routeObserver],
12.title
Android: On top of the program snapshot of Task Manager
IOS: Program switch manager
return MaterialApp(
title: ' You Shangxing ',)
13.localizationsDelegates
Used to store customized multilingual resources
localizationsDelegates: [
RefreshLocalizations.delegate,
GlobalMaterialLocalizations.delegate,
GlobalWidgetsLocalizations.delegate,
GlobalCupertinoLocalizations.delegate
],
14.supportedLocales
When the application supports different languages , You need to internationalize the application
MaterialApp(
title: 'Flutter IntlApp',
supportedLocales: [
const Locale('zh'),
const Locale('en'),
],
)
15.localeResolutionCallback
Listen for system language switching events , Some Android features , Multi language list can be set , By default, the first list is the default language
localeResolutionCallback:
(Locale locale, Iterable<Locale> supportedLocales) {
//print("change language");
return locale;
},
appendix :
stay src in com File directory
1.Flutter Engine Use 
2.Flutter Embedder Use 
边栏推荐
- Basic syntax of unity script (7) - member variables and instantiation
- 潘多拉 IOT 开发板学习(HAL 库)—— 实验2 蜂鸣器实验(学习笔记)
- 蓝桥杯单片机省赛第十一届第一场
- PY3 link MySQL
- 《MATLAB 神经网络43个案例分析》:第42章 并行运算与神经网络——基于CPU/GPU的并行神经网络运算
- One of the future trends of SAP ui5: embrace typescript
- Unity脚本的基础语法(6)-特定文件夹
- 数据库文件逻辑结构形式指的是什么
- Eight steps of agile development process
- What kind of interview is more effective?
猜你喜欢

2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板,老板也有建设积分和捣乱积分, 排好队后,所有

Eight steps of agile development process

蓝桥杯单片机省赛第六届

Getting started with MQ

【DesignMode】建造者模式(Builder model)

《MATLAB 神经网络43个案例分析》:第41章 定制神经网络的实现——神经网络的个性化建模与仿真

《MATLAB 神經網絡43個案例分析》:第42章 並行運算與神經網絡——基於CPU/GPU的並行神經網絡運算

汇率的查询接口

跳出舒适区,5年点工转型自动化测试工程师,我只用了3个月时间

一天上手Aurora 8B/10B IP核(5)----从Framing接口的官方例程学起
随机推荐
2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板,老板也有建设积分和捣乱积分, 排好队后,所有
Kotlin基础学习 16
【无线图传】基于FPGA的简易无线图像传输系统verilog开发,matlab辅助验证
微信小程序中 在xwml 中使用外部引入的 js进行判断计算
Unity脚本的基础语法(8)-协同程序与销毁方法
汇率的查询接口
Which of PMP and software has the highest gold content?
Account management of MySQL
Unity脚本的基础语法(6)-特定文件夹
[HCIA continuous update] working principle of OSPF Protocol
蓝桥杯单片机省赛第十一届第二场
Class design basis and advanced
[punch in] flip the string (simple)
Set vscode. When double clicking, the selected string includes the $symbol - convenient for PHP operation
【人员密度检测】基于形态学处理和GRNN网络的人员密度检测matlab仿真
Knowing things by learning | self supervised learning helps improve the effect of content risk control
《MATLAB 神經網絡43個案例分析》:第42章 並行運算與神經網絡——基於CPU/GPU的並行神經網絡運算
Basic syntax of unity script (7) - member variables and instantiation
"Analysis of 43 cases of MATLAB neural network": Chapter 41 implementation of customized neural network -- personalized modeling and Simulation of neural network
0基础如何学习自动化测试?按照这7步一步一步来学习就成功了