Flutter简单启动
1.我们的代码片在lib里面写
2.记住别的包不要打开,因为会出现报错,虽然没有什么影响,但是影响美观
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(title: '我的程序',home: MyScaffold(),));
}
class MyScaffold extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Material(
child: Column(
children: [
MyappBar(),
Expanded(child: Center(child: Text("hellow,world"),))
],
),
);
}
}
class MyappBar extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Container(
height: 56.0,
padding: const EdgeInsets.symmetric(horizontal: 8.0),
decoration: BoxDecoration(color: Colors.blue) ,
child: Row(
children: [
],
),
);
}
}