In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "what is the first three questions of Flutter". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what is the first three questions of Flutter"?
problem
When to use StatefulWidget and StatelessWidget?
How does Flutter load images (online or local)?
What is Scaffold?
Talk about State
In Android, you can update the view by making changes directly to the view. However, in Flutter, Widget is immutable and is not updated directly, but the state of Widget must be used.
This is the conceptual source of Stateful and Stateless widget. A Stateless Widget, like its name, is a widget with no status information.
For example, in Android, if you only want to display a logo using ImageView. Logo does not change at run time and can be implemented through StatelessWidget in Flutter.
However, if you want to request data over the network and then update your interface, you need to use StatefulWidget and notify the Flutter framework (setState) that the widget needs to be updated.
Remember an official rule: if a widget changes (users interact with it), it is stateful. However, if a child widget reacts to a change and its parent widget does not respond to the change, then the included parent widget can still be a stateless widget
Load Picture
Supported formats: JPEG, WebP, GIF, PNG, BMP, WBMP
Mainly through:
The network
1new Image.network (
2 imgUrl
3 scale:1.0)
Local
1 path / Note the image suffix should be included in the
2new Image.asset (path, width:24.0, height: 24.0)
In addition, when loading the resource image, you need to declare it in pubspec.yaml (the project in the previous section is an example):
1flutter:
2 uses-material-design: true
3 assets:
4-images/tab_association_grey.png
5-images/tab_association_yellow.png
6-images/tab_discovery_grey.png
7-images/tab_discovery_yellow.png
8-images/tab_me_grey.png
9-images/tab_me_yellow.png
10-images/tab_sport_grey.png
11-images/tab_sport_yellow.png
12-images/tab_training_yellow.png
13-images/tab_training_grey.png
Is that all of the above? The answer is no. There must be other ways. No introduction will be made in this issue, and we will supplement it when we use it later.
What is Scaffold?
Scaffold implements a Materia design (material Design) style layout structure. Scaffold widget provides API that implements appBar, floatingActionBar and other material design style controls. So when we want to use some of the layout of MateriaDesign, we choose Scaffoldwidget.
Thank you for your reading, the above is the content of "what is the first three questions of Flutter". After the study of this article, I believe you have a deeper understanding of the question of what is the first knowledge of Flutter, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.