当前位置:网站首页>[shutter] shutter resource file use (import resource pictures | use image resources)
[shutter] shutter resource file use (import resource pictures | use image resources)
2022-07-02 22:05:00 【Programmer community】
List of articles
- One 、Flutter Import resource pictures
- Two 、Flutter Use resource pictures
- 3、 ... and 、 Complete code example
- Four 、 Related resources
One 、Flutter Import resource pictures
Flutter Resource path configuration : The resource path is in the root directory pubspec.yaml Configuration in profile ;
take flutter Node under assets The comment of the node opens , That is to delete the previous # Annotation symbols ;

And then in flutter Project root creation images Catalog , The picture hunter.png Copy to this images Directory ;
And in pubspec.yaml Profile's assets Under node configuration - images/hunter.png Information ;
# The following section is specific to Flutter.flutter: # The following line ensures that the Material Icons font is # included with your application, so that you can use the icons in # the material Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: assets: - images/hunter.pngAnd then you can go in flutter This file is used in the project ;
The following figure shows the directory structure of the resource file and the configuration information in the configuration file ;
Import resource picture styles :

Two 、Flutter Use resource pictures
Image Use resource images in components , In its image Fields use AssetImage Type of picture is enough ;
Code example : Set up a 200 x 200 The size of Image Components , Show images/hunter.png Resource pictures ;
Image( width: 200, height: 200, image: AssetImage("images/hunter.png"),)3、 ... and 、 Complete code example
Complete code example :
import 'package:flutter/material.dart';class ResourcePage extends StatefulWidget {
@override _ResourcePageState createState() => _ResourcePageState();}class _ResourcePageState extends State<ResourcePage> {
@override Widget build(BuildContext context) {
return MaterialApp( title: " Resource file usage ", theme: ThemeData(primarySwatch: Colors.blue), home: Scaffold( appBar: AppBar( title: Text(" Resource file usage "), leading: GestureDetector( onTap: (){
Navigator.pop(context); }, child: Icon(Icons.arrow_back_ios), ), ), body: Container( // centered alignment: Alignment.center, // Vertical linear layout child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Image( width: 200, height: 200, image: AssetImage("images/hunter.png"), ) ], ), ), ), ); }}Running effect :

Four 、 Related resources
Reference material :
- Flutter Official website : https://flutter.dev/
- Flutter Developing documents : https://flutter.cn/docs ( Strongly recommend )
- official GitHub Address : https://github.com/flutter
- Flutter The Chinese community : https://flutter.cn/
- Flutter Practical tutorial : https://flutter.cn/docs/cookbook
- Flutter CodeLab : https://codelabs.flutter-io.cn/
- Dart Chinese document : https://dart.cn/
- Dart Developer website : https://api.dart.dev/
- Flutter Chinese net ( unofficial , The translation is very good ) : https://flutterchina.club/ , http://flutter.axuer.com/docs/
- Flutter Related issues : https://flutterchina.club/faq/ ( It is recommended to watch it at the introductory stage )
Blog source download :
GitHub Address : https://github.com/han1202012/flutter_cmd ( Keep updating with the progress of the blog , There may not be the source code of this blog )
Blog source snapshot : https://download.csdn.net/download/han1202012/15539996 ( The source code snapshot of this blog , You can find the source code of this blog )
边栏推荐
- Using emqx cloud to realize one machine one secret verification of IOT devices
- 【C 题集】of Ⅴ
- Basic knowledge of tree and binary tree (detailed illustration)
- Off chip ADC commissioning record
- pip安装whl文件报错:ERROR: ... is not a supported wheel on this platform
- *C language final course design * -- address book management system (complete project + source code + detailed notes)
- From personal heroes to versatile developers, the era of programmer 3.0 is coming
- treevalue——Master Nested Data Like Tensor
- Three chess games
- Introduction to victoriametrics
猜你喜欢

C language, to achieve three chess games

Analysis of neural network

Read a doctor, the kind that studies cows! Dr. enrollment of livestock technology group of Leuven University, milk quality monitoring

"New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba

An overview of the development of affective computing and understanding research

Kubernetes resource object introduction and common commands (4)

LightGBM原理及天文数据中的应用

Ransack combined condition search implementation
![[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)](/img/fa/5c1b6c16d9aabd13e9a4f7c7b9c7da.jpg)
[shutter] shutter gesture interaction (click event handling | click OnTap | double click | long press | click Cancel | press ontapdown | lift ontapup)

Interpretation of CVPR paper | generation of high fidelity fashion models with weak supervision
随机推荐
Free open source web version of xshell [congratulations on a happy new year]
pyqt圖片解碼 編碼後加載圖片
【剑指 Offer 】56 - II. 数组中数字出现的次数 II
Lightgbm principle and its application in astronomical data
Basic knowledge of tree and binary tree (detailed illustration)
Record the functions of sharing web pages on wechat, QQ and Weibo
*C language final course design * -- address book management system (complete project + source code + detailed notes)
Gbase8s database type
[Jianzhi offer] 57 And are two numbers of S
pip安装whl文件报错:ERROR: ... is not a supported wheel on this platform
VictoriaMetrics 简介
PIP version update timeout - download using domestic image
APP页面分享口令Rails实现
Leetcode theme [array] -169- most elements
[use of pointer and pointer and array]
Etcd Raft 协议
How to prevent your jar from being decompiled?
发现你看不到的物体!南开&武大&ETH提出用于伪装目标检测SINet,代码已开源!...
Technical solution of vision and manipulator calibration system
MySQL learning record (7)