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

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.xdnf.cn/news/16987.html

相关文章:

  • 【07】VisionMaster入门到精通——Blob分折
  • 2 安装 Docker 和 Jenkins:持续构建环境起步
  • 第三章 用户和权限
  • 基于落霞归雁思维框架的软件需求管理实践指南
  • MyBatis与MySQL
  • 深入理解C++中的Lazy Evaluation:延迟计算的艺术
  • PostGIS面试题及详细答案120道之 (081-090 )
  • uniapp倒计时计算
  • 称重传感器的价格迷局:定制化与规模化的博弈之道
  • C++11 -- 智能指针
  • PHP面向对象编程与数据库操作完全指南-上
  • pve 删除集群
  • 优化算法专栏——阅读导引
  • 损失函数和调度器相关类代码回顾理解 |nn.CrossEntropyLoss\CosineAnnealingLR
  • 1 前言:什么是 CICD 为什么要学 CICD
  • Java试题-选择题(3)
  • (28)运动目标检测之随机曲线上的离散点进行插值
  • 利用CompletableFuture优化查询效率
  • Android Material Components 全面解析:打造现代化 Material Design 应用
  • Prim算法
  • javascript中call、apply 和 bind 的区别详解
  • 2025新征程杯全国54校园足球锦标赛在北京世园公园隆重开幕
  • qt贝塞尔曲线演示工具
  • Nestjs框架: 请求生命周期与应用生命周期
  • Java向量化
  • python列表推导式
  • Android Frameworks从零开始
  • codex体验失败记录
  • 删除MicroGame
  • 基于单片机汽车少儿安全预警系统