Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Using margin in padding
- body: Container(
- padding : EdgeInsets.fromLTRB(10.0, 20.0, 30.0, 40.0),
- margin : EdgeInsets.all(30.0),
- color : Colors.grey,
- child : Text('Hello World'),
- ),
- __________________________________________________________________
- // Using a padding widget
- body: Padding(
- padding: EdgeInsets.all(30.0),
- child: Text('Hello'),
- ),
- __________________________________________________________________
- // FULL CODE
- import 'package:flutter/material.dart';
- void main() => runApp(MaterialApp(
- home: Home(),
- ));
- class Home extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text(
- 'App bar',
- style: TextStyle(color: Colors.white),
- ),
- centerTitle: true,
- backgroundColor: Colors.red,
- ),
- body: Padding(
- padding: EdgeInsets.all(30.0),
- child: Text('Hello'),
- ),
- floatingActionButton: FloatingActionButton(
- child: Text('click me'),
- onPressed: null,
- backgroundColor: Colors.red,
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement