美文网首页
flutter 快速测试代码的基础app

flutter 快速测试代码的基础app

作者: iCloudEnd | 来源:发表于2019-02-13 05:26 被阅读5次

学习flutter过程中,我经常需要快速创建一个app然后测试一些功能,下面就是我常用的测试基础app

import 'package:flutter/material.dart';

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


class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  void initState() {
    super.initState();
   // TODO  初始化是代码
  }
 

  
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
          appBar: AppBar(
            title: const Text('基础 应用'),
          ),
          body:
          //TODO  step01 add SingleChildScrollView
          SingleChildScrollView(
            child: Center(
              child: Column(
                crossAxisAlignment: CrossAxisAlignment.center,
                mainAxisSize: MainAxisSize.min,
                children: <Widget>[
                  RaisedButton(
                    child: const Text('测试按钮'),
                    onPressed: (){
                      print("点击了一下");

                    },
                  )
                ],
              ),
            ),
          )
      ),
    );

  }
}

相关文章

网友评论

      本文标题:flutter 快速测试代码的基础app

      本文链接:https://www.haomeiwen.com/subject/kitreqtx.html