当前位置:网站首页>[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.png
And 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 )
边栏推荐
- Landingsite eband B1 smoke test case
- SQL必需掌握的100个重要知识点:使用游标
- Record the functions of sharing web pages on wechat, QQ and Weibo
- The neo4j skill tree was officially released to help you easily master the neo4j map database
- Les trois principaux points de douleur traités par servicemesh
- What "real skills" should a million year old cloud native developer master? Alibaba, Tencent, meituan and byte decrypt together
- ArrayList分析2 :Itr、ListIterator以及SubList中的坑
- Try to get property'num for PHP database data reading_ rows' of non-object?
- Scrcpy this software solves the problem of sharing mobile screen with colleagues | community essay solicitation
- Daily book - low code you must understand in the era of digital transformation
猜你喜欢
"Actbert" Baidu & Sydney University of technology proposed actbert to learn the global and local video text representation, which is effective in five video text tasks!
如何防止你的 jar 被反编译?
TinyMCE visual editor adds Baidu map plug-in
MySQL learning record (3)
What "real skills" should a million year old cloud native developer master? Alibaba, Tencent, meituan and byte decrypt together
[Yu Yue education] reference materials of analog electronic technology of Nanjing Institute of information technology
PIP version update timeout - download using domestic image
Pip install whl file Error: Error: … Ce n'est pas une roue supportée sur cette plateforme
地理探测器原理介绍
MySQL learning record (5)
随机推荐
How to test the process of restoring backup files?
What is it that makes you tremble? Those without fans can learn
pyqt圖片解碼 編碼後加載圖片
How to prevent your jar from being decompiled?
[sword finger offer] 56 - I. the number of numbers in the array
[staff] Sibelius 7.5.1 score software installation (software download | software installation)
Physical layer cables and equipment
:last-child 不生效解决
How to center the positioned text horizontally and vertically
Interpretation of CVPR paper | generation of high fidelity fashion models with weak supervision
From "bronze" to "King", there are three secrets of enterprise digitalization
LandingSite eBand B1冒烟测试用例
暑期第一周总结
Etcd raft protocol
读博士吧,研究奶牛的那种!鲁汶大学 Livestock Technology 组博士招生,牛奶质量监测...
"New programmer 003" was officially launched, and the cloud native and digital practical experience of 30+ companies such as Huawei and Alibaba
[use of pointer and pointer and array]
Les trois principaux points de douleur traités par servicemesh
C language, to achieve three chess games
The book "new programmer 002" is officially on the market! From "new database era" to "software defined car"