当前位置:网站首页>[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 )
边栏推荐
- PIP version update timeout - download using domestic image
- Ransack combined condition search implementation
- scrcpy这款软件解决了和同事分享手机屏幕的问题| 社区征文
- System (hierarchical) clustering method and SPSS implementation
- Scrcpy this software solves the problem of sharing mobile screen with colleagues | community essay solicitation
- 地理探测器原理介绍
- Browser - clean up the cache of JS in the page
- D4: unpaired image defogging, self enhancement method based on density and depth decomposition (CVPR 2022)
- 腾讯三面:进程写文件过程中,进程崩溃了,文件数据会丢吗?
- 关于PHP-数据库的 数据读取,Trying to get property 'num_rows' of non-object?
猜你喜欢
"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!
【零基础一】Navicat下载链接
PIP audit: a powerful security vulnerability scanning tool
MySQL learning record (6)
Etcd Raft 协议
Read a doctor, the kind that studies cows! Dr. enrollment of livestock technology group of Leuven University, milk quality monitoring
The book "new programmer 002" is officially on the market! From "new database era" to "software defined car"
The neo4j skill tree was officially released to help you easily master the neo4j map database
C language, to achieve three chess games
LandingSite eBand B1冒烟测试用例
随机推荐
Blue Bridge Cup Eliminate last one (bit operation, code completion)
一周生活
分享一下如何制作专业的手绘电子地图
Les trois principaux points de douleur traités par servicemesh
2019 Nanchang (relive the classic)
如何防止你的 jar 被反编译?
pyqt圖片解碼 編碼後加載圖片
Daily book - low code you must understand in the era of digital transformation
Basic knowledge of tree and binary tree (detailed illustration)
[sword finger offer] 56 - I. the number of numbers in the array
The web version of xshell supports FTP connection and SFTP connection [detailed tutorial] continued from the previous article
What is it that makes you tremble? Those without fans can learn
MySQL learning record (7)
[Jianzhi offer] 56 - ii Number of occurrences of numbers in the array II
加了定位的文字如何水平垂直居中
Web侧防御指南
#include<>和#include“”的区别
The web version of xshell supports FTP connection and SFTP connection
Ransack组合条件搜索实现
100 important knowledge points that SQL must master: using cursors