Advertisement
rajath_pai

ninja10 Containers

Jul 30th, 2021
1,037
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.57 KB | None | 0 0
  1. // Containers
  2. __________________________________________________
  3. //symmetric
  4. body: Container(
  5.         padding : EdgeInsets.symmetric(horizontal : 20.0, vertical : 10.0),
  6.         color : Colors.grey,
  7.         child : Text('Hello World'),
  8.       ),
  9.  
  10. __________________________________________________
  11. // all
  12.       body: Container(
  13.         padding : EdgeInsets.all(20.0),
  14.         color : Colors.grey,
  15.         child : Text('Hello World'),
  16.       ),
  17. __________________________________________________
  18. // fromLTRB
  19.       body: Container(
  20.         padding : EdgeInsets.fromLTRB(10.0, 20.0, 30.0, 40.0),
  21.         color : Colors.grey,
  22.         child : Text('Hello World'),
  23.       ),
  24.  
  25. ---------------------------------
  26. //Entire code
  27. ---------------------------------
  28. import 'package:flutter/material.dart';
  29.  
  30. void main() => runApp(MaterialApp(
  31.       home: Home(),
  32.     ));
  33.  
  34. class Home extends StatelessWidget {
  35.   @override
  36.   Widget build(BuildContext context) {
  37.     return Scaffold(
  38.       appBar: AppBar(
  39.         title: Text(
  40.           'App bar',
  41.           style: TextStyle(color: Colors.white),
  42.         ),
  43.         centerTitle: true,
  44.         backgroundColor: Colors.red,
  45.       ),
  46.       body: Container(
  47.         padding : EdgeInsets.symmetric(horizontal : 20.0, vertical : 10.0),
  48.         color : Colors.grey,
  49.         child : Text('Hello World'),
  50.       ),
  51.       floatingActionButton: FloatingActionButton(
  52.         child: Text('click me'),
  53.         onPressed: null,
  54.         backgroundColor: Colors.red,
  55.       ),
  56.     );
  57.   }
  58. }
  59. __________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement