Skip to content

Instantly share code, notes, and snippets.

@Aaron009
Created December 21, 2019 08:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aaron009/c9c6a67f8952d51d7f79e98680bb0cf3 to your computer and use it in GitHub Desktop.
Save Aaron009/c9c6a67f8952d51d7f79e98680bb0cf3 to your computer and use it in GitHub Desktop.
Container包含Container出现的问题。
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(),
home: new MyHomePage(title: 'Flutter Demo Home Page'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => new _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return new Scaffold(
appBar: new AppBar(
title: new Text(widget.title),
),
body: new Center(
child: new Column(
children: <Widget>[
Container(
margin: EdgeInsets.only(top: 10),
width: 200,
height: 200,
decoration: BoxDecoration(
border: Border.all(color: Colors.orange[400], width: 0.5),
borderRadius: BorderRadius.circular(6),
color: Colors.orange[100]),
child: Container(
margin: EdgeInsets.only(top: 10),
width: 50,
height: 50,
decoration: BoxDecoration(
borderRadius: BorderRadius.circular(6),
color: Colors.orange),
child: Text('22'),
),
),
],
),
),
);
}
}
@Aaron009
Copy link
Author

我想实现这个效果
1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment