当前位置: 首页 > news >正文

Flutter开发 初识目录结构

初识目录结构

在这里插入图片描述
.dart_tool:记录dart工具库所在位置及信息的json文件和一些dart编译文件。
.idea:存放IDE生成的一些临时文件
android:存放flutter与android原生交互的一些代码
build:存放运行时生成的编译文件
ios:存放flutter与ios原生交互的一些代码
lib:存放的dart语言编写的代码
test:存放项目测试代码文件
pubspec.yaml:用于管理第三方依赖库及资源的配置文件

主要文件介绍

main.dart 入口文件

import 'package:flutter/material.dart'; //导入包void main() {//入口函数runApp(const MyApp());
}class MyApp extends StatelessWidget { //无状态的const MyApp({super.key});// This widget is the root of your application.Widget build(BuildContext context) {return MaterialApp(title: 'Flutter Demo', //任务管理窗口中显示的应用程序标题theme: ThemeData(//主题colorScheme: ColorScheme.fromSeed(seedColor: Colors.red),),home: const MyHomePage(title: 'Flutter Demo Home Page222'), //应用程序默认显示的控件);}
}

pubspec.yaml

name: first_flutter
description: "A new Flutter project."
# The following line prevents the package from being accidentally published to
# pub.dev using `flutter pub publish`. This is preferred for private packages.
publish_to: 'none' # Remove this line if you wish to publish to pub.devversion: 1.0.0+1 #应用程序版本号environment:sdk: ^3.8.1   #适配的版本号
#依赖管理,第三方插件
dependencies:flutter:sdk: flutter# The following adds the Cupertino Icons font to your application.# Use with the CupertinoIcons class for iOS style icons.cupertino_icons: ^1.0.8  #ios样式的图标库#dependency_overrides:
#  path_provider:
#    hosted:
#      url: "https://mirrors.tuna.tsinghua.edu.cn/dart-pub/"#开发时需要的依赖包,不会包含在发布的包中
dev_dependencies:flutter_test:sdk: flutter# The "flutter_lints" package below contains a set of recommended lints to# encourage good coding practices. The lint set provided by the package is# activated in the `analysis_options.yaml` file located at the root of your# package. See that file for information about deactivating specific lint# rules and activating additional ones.flutter_lints: ^5.0.0# For information on the generic Dart part of this file, see the
# following page: https://dart.dev/tools/pub/pubspec# The following section is specific to Flutter packages.
flutter:uses-material-design: true  #是否使用material design# To add assets to your application, add an assets section, like this:
#项目使用的资源文件(图片、字体、JSON等)
#   assets:   #资源文件
#     - images/a_dot_burr.jpeg
#     - images/a_dot_ham.jpeg# fonts:  #字体#   - family: Schyler#     fonts:#       - asset: fonts/Schyler-Regular.ttf#       - asset: fonts/Schyler-Italic.ttf#         style: italic#   - family: Trajan Pro#     fonts:#       - asset: fonts/TrajanPro.ttf#       - asset: fonts/TrajanPro_Bold.ttf#         weight: 700## For details regarding fonts from package dependencies,# see https://flutter.dev/to/font-from-package
http://www.lryc.cn/news/607961.html

相关文章:

  • #Linux内存管理# 用一个案例详细介绍ARMv7-A架构 缺页中断处理的原理
  • C#多数据库批量执行脚本工具
  • 服装MES系统高效解决方案
  • Apache ShardingSphere 初识使用
  • 语音识别数据集
  • 力扣 二叉树遍历 中序/前序/后序(递归和迭代版)
  • Dify 从入门到精通(第 10/100 篇):使用 Dify 工具集扩展功能
  • 测试环境 PostgreSQL 库连接不上—案例分享
  • 设计Mock华为昇腾GPU的MindSpore和CANN的库的流程与实现
  • 音视频学习(四十六):声音的三要素
  • 【故障处理】redis会话连接满导致业务系统某个模块数据不显示
  • 【Flutter3.8x】flutter从入门到实战基础教程(八):公共state的集中管理机制
  • Kafka——关于Kafka动态配置
  • LeetCode 65:有效数字
  • OSPF综合实验(一)
  • 如何在 Ubuntu 24.04 或 22.04 LTS Linux 上安装 Guake 终端应用程序
  • 切换python多版本
  • Spring 中 Bean 的生命周期
  • 机器学习sklearn:聚类
  • 深入 Go 底层原理(四):GMP 模型深度解析
  • 深入 Go 底层原理(八):sync 包的实现剖析
  • 中科院自动化所机器人视觉中的多模态融合与视觉语言模型综述
  • Python 程序设计讲义(54):Python 的函数——函数概述
  • Java 集合框架: LinkedHashSet
  • innoDB的buffer pool
  • API征服者:Python抓取星链卫星实时轨迹
  • k8s集群部署(脚本版)
  • 【CVPR2025】计算机视觉|即插即用|GCNet:炸裂!实时语义分割新星GCNet,性能速度双突破!
  • 前端应用权限设计面面观
  • JVM中的垃圾回收暂停是什么,为什么会出现暂停,不同的垃圾回收机制暂停对比