当前位置:网站首页>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 
边栏推荐
- Vite: scaffold assembly
- [personal notes] PHP common functions - custom functions
- Comment élaborer une stratégie nuageuse à l'ère des nuages mixtes
- [HCIA continuous update] working principle of OSPF Protocol
- One of the future trends of SAP ui5: embrace typescript
- 2022-07-01:某公司年会上,大家要玩一食发奖金游戏,一共有n个员工, 每个员工都有建设积分和捣乱积分, 他们需要排成一队,在队伍最前面的一定是老板,老板也有建设积分和捣乱积分, 排好队后,所有
- 蓝桥杯单片机省赛第六届
- u本位合约爆仓清算解决方案建议
- The fourth provincial competition of Bluebridge cup single chip microcomputer
- 蓝桥杯单片机省赛第十一届
猜你喜欢

Account management of MySQL
![[untitled] basic operation of raspberry pie (2)](/img/b4/cac22c1691181c1b09fe9d98963dbf.jpg)
[untitled] basic operation of raspberry pie (2)
![[designmode] Prototype Pattern](/img/ee/c4e48c2ce8ff66f50f0bf13e5a0418.png)
[designmode] Prototype Pattern

The 10th Blue Bridge Cup single chip microcomputer provincial competition

Basic syntax of unity script (6) - specific folder

高性能 低功耗Cortex-A53核心板 | i.MX8M Mini

This article describes the step-by-step process of starting the NFT platform project

u本位合约爆仓清算解决方案建议

蓝桥杯单片机第六届温度记录器

The fourth provincial competition of Bluebridge cup single chip microcomputer
随机推荐
The 10th Blue Bridge Cup single chip microcomputer provincial competition
Didi open source Delta: AI developers can easily train natural language models
In the era of programmers' introspection, five-year-old programmers are afraid to go out for interviews
The fourth provincial competition of Bluebridge cup single chip microcomputer
Pointer array & array pointer
《西线无战事》我们才刚开始热爱生活,却不得不对一切开炮
Knowing things by learning | self supervised learning helps improve the effect of content risk control
What kind of interview is more effective?
蓝桥杯单片机省赛第十一届第一场
L'avènement de l'ère 5G, une brève discussion sur la vie passée et présente des communications mobiles
Custom classloader that breaks parental delegation
数据库文件逻辑结构形式指的是什么
SQL Yiwen get window function
蓝桥杯单片机数码管技巧
蓝桥杯单片机省赛第八届
蓝桥杯单片机第六届温度记录器
《MATLAB 神经网络43个案例分析》:第42章 并行运算与神经网络——基于CPU/GPU的并行神经网络运算
Welcome the winter vacation multi school league game 2 partial solution (B, C, D, F, G, H)
Kotlin basic learning 13
毕设-基于SSM电影院购票系统