flutter sdk:快速下载:https://github.com/flutter/flutter/releases
翻译:
StatelessWidget 无状态小部件
Stateful 有状态 Scaffold 脚手架 repair 修理
spec 规格 inspector 检查员 Malformed lineFlutter: 线路格式错误
Because flutter_app2 depends on flutter_test any from sdk which doesn't exist (the Flutter SDK is not available), version solving failed.
由于flutter_app2依赖于flutter_test任何不存在的sdk(flutter sdk不可用),版本求解失败。
Flutter users should run `flutter packages get` instead of `pub get`.
用户应该运行“Flutter packages get”而不是“pub get”。
import 'package:flutter/material.dart';
void main() {
runApp(new MaterialApp(
title: 'Flutter Tutorial',
home: new Counter(),
));
}
class MyButton extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new GestureDetector(
onTap: () {
print('MyButton was tapped!');
},
child: new Container(
height: 36.0,
padding: const EdgeInsets.all(8.0),
margin: const EdgeInsets.symmetric(horizontal: 8.0),
decoration: new BoxDecoration(
borderRadius: new BorderRadius.circular(5.0),
color: Colors.lightGreen[500],
),
child: new Center(
child: new Text('Engage'),
),
),
);
}
}
class Counter extends StatefulWidget {
// This class is the configuration for the state. It holds the
// values (in this nothing) provided by the parent and used by the build
// method of the State. Fields in a Widget subclass are always marked "final".
@override
_CounterState createState() => new _CounterState();
}
class _CounterState extends State {
int _counter = 0;
void _increment() {
setState(() {
// This call to setState tells the Flutter framework that
// something has changed in this State, which causes it to rerun
// the build method below so that the display can reflect the
// updated values. If we changed _counter without calling
// setState(), then the build method would not be called again,
// and so nothing would appear to happen.
_counter++;
});
}
@override
Widget build(BuildContext context) {
// This method is rerun every time setState is called, for instance
// as done by the _increment method above.
// The Flutter framework has been optimized to make rerunning
// build methods fast, so that you can just rebuild anything that
// needs updating rather than having to individually change
// instances of widgets.
return new Row(
children: [
new RaisedButton(
onPressed: _increment,
child: new Text('Increment'),
),
new Text('Count: $_counter'),
],
);
}
}
class MyButton1 extends StatelessWidget{
@override
Widget build(BuildContext context) {
// TODO: implement build
return new GestureDetector(
onTap: (){
print("on top");
},
child: new Container(
height: 55,
width: 33,
padding: EdgeInsets.all(6),
margin: EdgeInsets.all(3),
decoration: new BoxDecoration(
borderRadius: new BorderRadius.circular(433),
),
child: new Center(
child: new Text("ceshi"),
),
),
);
}
}
class Hone extends StatelessWidget{
@override
Widget build(BuildContext context) {
// TODO: implement build
return new Scaffold(
appBar: new AppBar(
// ignore: argument_type_not_assignable
leading: new IconButton(
icon: new Icon(Icons.menu),
onPressed: null),
),
body:new Center(
child: new Text("12"),
)
);
}
}