当前位置: 首页 > 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.dtcms.com/a/311730.html

相关文章:

  • 自动布局视图来实现聊天室的界面
  • 【iOS】KVO
  • 20250802让飞凌OK3576-C开发板在飞凌的Android14下【rk3576_u选项】适配NXP的WIFIBT模块88W8987A的蓝牙
  • OTC焊接机器人节能技巧
  • Java内存模型(Java Memory Model,JMM)
  • 关于鸦片战争的历史
  • Dify 上次文件大小突破15MB,解决办法?
  • Store / Slice / Reducer
  • 麦肯锡咨询公司PEI经典面试题目汇总
  • Python编程基础与实践:Python循环结构基础
  • 洛谷 P3870 [TJOI2009] 开关-普及+/提高
  • 音视频学习(四十四):音频处理流程
  • 第三章 用户和权限
  • 线程池的实现
  • SQL Server从入门到项目实践(超值版)读书笔记 22
  • 内网穿透系列十:高性能内网穿透工具 rathole,支持Docker一键部署
  • 什么是DOM和BOM?
  • 机器学习-KNN
  • springboot大学生成绩管理系统设计与实现
  • Git 的基本使用指南(1)
  • 人类学家与建筑师:区分UX研究和项目管理的需求分析
  • TFS-2022《A Novel Data-Driven Approach to Autonomous Fuzzy Clustering》
  • LVGL代码框架简介
  • 从底层架构到多元场景:计算机构成与应用的深度剖析
  • Mac电脑安装HomeBrew
  • 从AI智能体出发,重构数据中台:迈向Agentic时代的数据能力体系
  • 微积分基础 | 核心概念 / 公式推导
  • 【51单片机6位数码管密码锁】2022-10-15
  • 入门MicroPython+ESP32:安装逗脑IDE及驱动
  • 深入 Go 底层原理(十一):Go 的反射(Reflection)机制