rajath_pai

ninja10 Padding

Jul 30th, 2021
730
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Using margin in padding
  2.  
  3.       body: Container(
  4.         padding : EdgeInsets.fromLTRB(10.0, 20.0, 30.0, 40.0),
  5.         margin : EdgeInsets.all(30.0),
  6.         color : Colors.grey,
  7.         child : Text('Hello World'),
  8.       ),
  9. __________________________________________________________________
  10.  
  11. // Using a padding widget
  12.  
  13.       body: Padding(
  14.         padding: EdgeInsets.all(30.0),
  15.         child: Text('Hello'),
  16.       ),
  17.  
  18. __________________________________________________________________
  19.  
  20. // FULL CODE
  21.  
  22. import 'package:flutter/material.dart';
  23.  
  24. void main() => runApp(MaterialApp(
  25.       home: Home(),
  26.     ));
  27.  
  28. class Home extends StatelessWidget {
  29.   @override
  30.   Widget build(BuildContext context) {
  31.     return Scaffold(
  32.       appBar: AppBar(
  33.         title: Text(
  34.           'App bar',
  35.           style: TextStyle(color: Colors.white),
  36.         ),
  37.         centerTitle: true,
  38.         backgroundColor: Colors.red,
  39.       ),
  40.       body: Padding(
  41.         padding: EdgeInsets.all(30.0),
  42.         child: Text('Hello'),
  43.       ),
  44.       floatingActionButton: FloatingActionButton(
  45.         child: Text('click me'),
  46.         onPressed: null,
  47.         backgroundColor: Colors.red,
  48.       ),
  49.     );
  50.   }
  51. }
  52.  
RAW Paste Data