Advertisement
AbiMulya

(Belajar Flutter) Stack & Align Widget

Oct 7th, 2020
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 3.92 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() {
  4.   runApp(MyApp());
  5. }
  6.  
  7. class MyApp extends StatelessWidget {
  8.   @override
  9.   Widget build(BuildContext context) {
  10.     return MaterialApp(
  11.       home: Scaffold(
  12.         appBar: AppBar(
  13.           title: Text("Latihan Stack dan Align"),
  14.         ),
  15.         body: Stack(
  16.           children: <Widget>[
  17.             Column(
  18.               children: <Widget>[
  19.                 Flexible(
  20.                   flex: 1,
  21.                   child: Row(
  22.                     children: <Widget>[
  23.                       Flexible(
  24.                           flex: 1,
  25.                           child: Container(
  26.                             color: Colors.white,
  27.                           )),
  28.                       Flexible(
  29.                           flex: 1,
  30.                           child: Container(
  31.                             color: Colors.black12,
  32.                           ))
  33.                     ],
  34.                   ),
  35.                 ),
  36.                 Flexible(
  37.                   flex: 1,
  38.                   child: Row(
  39.                     children: <Widget>[
  40.                       Flexible(
  41.                           flex: 1,
  42.                           child: Container(
  43.                             color: Colors.black12,
  44.                           )),
  45.                       Flexible(
  46.                           flex: 1,
  47.                           child: Container(
  48.                             color: Colors.white,
  49.                           ))
  50.                     ],
  51.                   ),
  52.                 ),
  53.               ],
  54.             ),
  55.             ListView(
  56.               children: <Widget>[
  57.                 Column(
  58.                   children: <Widget>[
  59.                     Container(
  60.                       margin: EdgeInsets.all(10),
  61.                       child: Text(
  62.                         "Ini Adalah text yang ada di lapisan tengah dari Stack",
  63.                         style: TextStyle(fontSize: 30),
  64.                       ),
  65.                     ),
  66.                     Container(
  67.                       margin: EdgeInsets.all(10),
  68.                       child: Text(
  69.                         "Ini Adalah text yang ada di lapisan tengah dari Stack",
  70.                         style: TextStyle(fontSize: 30),
  71.                       ),
  72.                     ),
  73.                     Container(
  74.                       margin: EdgeInsets.all(10),
  75.                       child: Text(
  76.                         "Ini Adalah text yang ada di lapisan tengah dari Stack",
  77.                         style: TextStyle(fontSize: 30),
  78.                       ),
  79.                     ),
  80.                     Container(
  81.                       margin: EdgeInsets.all(10),
  82.                       child: Text(
  83.                         "Ini Adalah text yang ada di lapisan tengah dari Stack",
  84.                         style: TextStyle(fontSize: 30),
  85.                       ),
  86.                     ),
  87.                     Container(
  88.                       margin: EdgeInsets.all(10),
  89.                       child: Text(
  90.                         "Ini Adalah text yang ada di lapisan tengah dari Stack",
  91.                         style: TextStyle(fontSize: 30),
  92.                       ),
  93.                     ),
  94.                     Container(
  95.                       margin: EdgeInsets.all(10),
  96.                       child: Text(
  97.                         "Ini Adalah text yang ada di lapisan tengah dari Stack",
  98.                         style: TextStyle(fontSize: 30),
  99.                       ),
  100.                     ),
  101.                   ],
  102.                 )
  103.               ],
  104.             ),
  105.             Align(
  106.               alignment: Alignment(0, 0),
  107.               // alignment: Alignment.bottomCenter,
  108.               child: RaisedButton(
  109.                 child: Text("My Buton"),
  110.                 color: Colors.amber,
  111.                 onPressed: () {},
  112.               ),
  113.             )
  114.           ],
  115.         ),
  116.       ),
  117.     );
  118.   }
  119. }
  120.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement