Skip to content

Instantly share code, notes, and snippets.

@ryanlid
Created February 15, 2020 16:38
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 ryanlid/0fd152bf916ab79a8eacd35173659001 to your computer and use it in GitHub Desktop.
Save ryanlid/0fd152bf916ab79a8eacd35173659001 to your computer and use it in GitHub Desktop.
Padding 填充布局
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: "Padding 填充布局示例",
home: LayoutDemo(),
));
}
class LayoutDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Padding 填充布局示例"),
),
body: Center(
child: Container(
width: 300.0,
height: 300.0,
padding: EdgeInsets.all(6.0),
decoration: BoxDecoration(
color: Colors.white,
border: Border.all(color: Colors.green, width: 8.0),
),
child: Container(
width: 200.0,
height: 200.0,
decoration: BoxDecoration(
color: Colors.blue,
border: Border.all(
color: Colors.blue,
width: 8.0,
)),
child: FlutterLogo(),
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment