努力生活,终有一天自己的本事会配得上自己的情怀,然后从容不迫地去与岁月相遇。

flutter—启动项目,准备起飞

1、打开android studio,建立虚拟机
在这里插入图片描述
2、运行虚拟机。需要的空间比较大,删了好多东西
在这里插入图片描述
3、网页启动成功了
在这里插入图片描述
4、使用vs code编辑代码,比较轻量,占用内存空间小,需要下载flutter
在这里插入图片描述
5、编写脚本文件
在这里插入图片描述
6、ctrl+~ 启动命令行、flutter run启动项目
真费劲啊启动这么一个破玩意要这么久
天呐,终于成功了,想哭。。。。。。
在这里插入图片描述
7、牛刀小试
在这里插入图片描述

import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
        primarySwatch: Colors.red,
      ),
      // home: const MyHomePage(title: 'wangzilaoshihao'),
      home: Scaffold(
        appBar: new AppBar(title: new Text('王子老师最帅'),),
        body: Center(
            child: Container(
              child: new Image.network(
              "https://img-blog.csdnimg.cn/5e8f6b90b81f45b8a56dc731b70cf1ea.gif",
              // fit: BoxFit.scaleDown,
              // color: Colors.greenAccent,
              // colorBlendMode: BlendMode.lighten,
              repeat: ImageRepeat.repeatY
              ),
            width:500.0,
            height: 300.0,
            color: Colors.lightBlue,
            ),
          // child: Container(
          //   child: new Text(
          //   '我是王子老师', style: TextStyle(fontSize: 30.0)),
          //   alignment: Alignment.topLeft,
          //   height: 500.0,
          //   width: 600.0,
          //   //color: Colors.lightBlue,
          //   padding: const EdgeInsets.fromLTRB(10.0,20,1,1),
          //   margin: const EdgeInsets.all(10.0),
          //   decoration: new BoxDecoration(
          //   gradient:const LinearGradient(
          //     colors: [Colors.lightBlue,
          //      Colors.greenAccent, Colors.purple]),
          //   border: Border.all(width: 2.0,color: Colors.red)
          //   ),
          // )
          // child: Text(
          //   'Hello wangzi 老师,马上走上人生巅峰,要不要跟随王子老师一起呢?woyaowoyao',
          //   textAlign: TextAlign.center,
          //   maxLines: 1,
          //   overflow: TextOverflow.ellipsis,
          //   style: TextStyle(
          //     fontSize: 25.0,
          //     color:Color.fromARGB(255, 255, 125, 125),
          //     decoration: TextDecoration.underline,
          //     decorationStyle: TextDecorationStyle.solid
          //   ),
          // ),
        ),
      ),
    );
  }
}
Logo

华为开发者空间,是为全球开发者打造的专属开发空间,汇聚了华为优质开发资源及工具,致力于让每一位开发者拥有一台云主机,基于华为根生态开发、创新。

更多推荐