入门flutter

demo 课程:
https://jspang.com/detailed?id=41#toc222   

https://www.bilibili.com/video/BV15t411U7yf?p=5&spm_id_from=pageDriver

 

安装环境 遇到问题:

1、启动虚拟机的时候报错:unable to locate adb

解决:https://stackoverflow.com/questions/39036796/unable-to-locate-adb-using-android-studio

 

 

 


 

flutter run 项目跑起来;

r:热更新

p:显示网格

o:切换IOS

Flutter run key commands.
r Hot reload. 🔥🔥🔥
R Hot restart.
h Repeat this help message.
d Detach (terminate "flutter run" but leave application running).
c Clear the screen
q Quit (terminate the application on the device).
s Save a screenshot to flutter.png.
b Toggle the platform brightness setting (dark and light mode).                                                                     (debugBrightnessOverride)
w Dump widget hierarchy to the console.                                                                                                        (debugDumpApp)
t Dump rendering tree to the console.                                                                                                   (debugDumpRenderTree)
L Dump layer tree to the console.                                                                                                        (debugDumpLayerTree)
S Dump accessibility tree in traversal order.                                                                                            (debugDumpSemantics)
U Dump accessibility tree in inverse hit test order.                                                                                     (debugDumpSemantics)
i Toggle widget inspector.                                                                                           (WidgetsApp.showWidgetInspectorOverride)
I Toggle oversized image inversion 🖼️.                                                                                          (debugInvertOversizedImages)
p Toggle the display of construction lines.                                                                                           (debugPaintSizeEnabled)
o Simulate different operating systems.                                                                                               (defaultTargetPlatform)
z Toggle elevation checker.
g Run source code generators.
M Write SkSL shaders to a unique file in the project directory.
v Launch DevTools.
P Toggle performance overlay.                                                                                             (WidgetsApp.showPerformanceOverlay)
a Toggle timeline events for all widget build methods.                                                                             (debugProfileWidgetBuilds)
An Observatory debugger and profiler on sdk gphone x86 is available at: http://127.0.0.1:51189/uNV9UbpeHTc=/

  

 # Flutter hellow world demo

import 'package:flutter/material.dart';

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Welcome to Flutter',
      home: Scaffold (
        appBar: AppBar(
          title: Text('Welcome to Flutter')
        ),
        body: Center(
          child: Text('Hello World'),
        )
      )
    );
  }
}

  

vscode开发flutter

打开设备(虚拟机)

方法1:

mac 电脑就创建一个.sh文件:

/Users/XXXXXX/Library/Android/sdk/emulator/emulator -netdelay none -netspeed full -avd Nexus_5X_API_30
然后执行
 

方法2:

 

 

posted @ 2021-03-30 13:31  Sameen  阅读(101)  评论(0编辑  收藏  举报