Advertisement
rajath_pai

ninja11 Children and Alignment

Jul 30th, 2021
1,158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.26 KB | None | 0 0
  1. // 1) children
  2. // 2) MainAxisAlignment
  3. // 3) CrossAxisAlignment
  4.  
  5.  
  6. import 'package:flutter/material.dart';
  7.  
  8. void main() => runApp(MaterialApp(
  9.       home: Home(),
  10.     ));
  11.  
  12. class Home extends StatelessWidget {
  13.   @override
  14.   Widget build(BuildContext context) {
  15.     return Scaffold(
  16.       appBar: AppBar(
  17.         title: Text(
  18.           'App bar',
  19.           style: TextStyle(color: Colors.white),
  20.         ),
  21.         centerTitle: true,
  22.         backgroundColor: Colors.red,
  23.       ),
  24.       body: Row(
  25.         mainAxisAlignment: MainAxisAlignment.spaceEvenly,
  26.         crossAxisAlignment: CrossAxisAlignment.start,
  27.         children: <Widget>[
  28.           Text('Hello world'),
  29.           TextButton(
  30.             onPressed: () {},
  31.             style: TextButton.styleFrom(
  32.               primary: Colors.white,
  33.               backgroundColor: Colors.amber,
  34.             ),
  35.             child: Text('Click me'),
  36.           ),
  37.           Container(
  38.               color: Colors.cyan,
  39.               padding: EdgeInsets.all(30.0),
  40.               child: Text('Inside container')),
  41.         ],
  42.       ),
  43.       floatingActionButton: FloatingActionButton(
  44.         child: Text('click me'),
  45.         onPressed: null,
  46.         backgroundColor: Colors.red,
  47.       ),
  48.     );
  49.   }
  50. }
  51.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement