一个简单的flutter material APP应用Android IOS可运行建议收藏
2020-03-26 06:37:11
来源:互联网
阅读:-
title: "Simple Material App", # - asset: fonts/TrajanPro_Bold.ttf...
本头条核心宗旨
欢迎来到「技术刚刚好」作者,「技术刚刚好」是个人维护,每天至少更新一篇Flutter技术文章,实时为大家播报Flutter最新消息。如果你刚好也在关注Flutter这门技术,那就跟我一起学习进步吧,你的赞,收藏,转发是对我个人最大的支持,维护不易,欢迎关注。
技术刚刚好经历
近几年,移动端跨平台开发技术层出不穷,从Facebook家的ReactNative,到阿里家WEEX,前端技术在移动端跨平台开发中大展身手,技术刚刚好作为一名Android开发,经历了从Reactjs到Vuejs的不断学习。而在2018年,我们的主角变成了Flutter,这是Goolge开源的一个移动端跨平台解决方案,可以快速开发精美的移动App。希望跟大家一起学习,一起进步!
今天我来介绍一个简单入门的flutter应用,
项目结构
main.dart文件
import 'package:flutter/material.dart';void main() { runApp(MaterialApp( // Title title: "Simple Material App", // Home home: Scaffold( // Appbar appBar: AppBar( // Title title: Text("Simple Material App"), ), // Body body: Container( // Center the content child: Center( // Add Text child: Text("Hello World!"), ), ), )));}
pubspec.yaml文件
name: simple_material_appdescription: A new Flutter project.dependencies: flutter: sdk: flutterdev_dependencies: flutter_test: sdk: flutter# For information on the generic Dart part of this file, see the# following page: https://www.dartlang.org/tools/pub/pubspec# 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 Icons class. uses-material-design: true # To add assets to your application, add an assets section, like this: # assets: # - images/a_dot_burr.jpeg # - images/a_dot_ham.jpeg # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.io/assets-and-images/. # To add assets from package dependencies, first ensure the asset # is in the lib/ directory of the dependency. Then, # refer to the asset with a path prefixed with # `packages/PACKAGE_NAME/`. The `lib/` is implied, do not # include `lib/` in the asset path. # # Here is an example: # # assets: # - packages/PACKAGE_NAME/path/to/asset # To add custom fonts to your application, add a fonts section here, # in this "flutter" section. Each entry in this list should have a # "family" key with the font family name, and a "fonts" key with a # list giving the asset and other descriptors for the font. For # example: # 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
谢谢观看技术刚刚好的文章,技术刚刚好是个人维护,每天至少更新一篇Flutter技术文章,实时为大家播报Flutter最新消息。如果你刚好也在关注Flutter这门技术,那就跟我一起学习进步吧,你的赞,收藏,转发是对我个人最大的支持,维护不易,欢迎关注。
推荐阅读:oppo手机和vivo手机哪个好
免责声明:本文仅代表企业观点,与青岛网讯无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。