Mujiburrohman

Card & parsing - Flutter

May 27th, 2019
218
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Dart 1.51 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() {
  4.   runApp(new MaterialApp(
  5.     title: "Card & Parsing",
  6.     home: HalSatu(),
  7.   ));
  8. }
  9. class HalSatu extends StatelessWidget {
  10.   @override
  11.   Widget build(BuildContext context) {
  12.     // TODO: implement build
  13.     return new Scaffold(
  14.       appBar: new AppBar(
  15.         title: new Text("Card & Parsing"),
  16.       ),
  17.       body: new Container(
  18.         child: new Column(
  19.           crossAxisAlignment: CrossAxisAlignment.stretch,
  20.               children: <Widget>[
  21.                 new cardSaya(icon: Icons.home, warna: Colors.brown, text: "Home",),
  22.                 new cardSaya(icon: Icons.favorite, warna: Colors.pink, text: "Favorite",),
  23.                 new cardSaya(icon: Icons.place, warna: Colors.blue, text: "Place",),
  24.                 new cardSaya(icon: Icons.settings, warna: Colors.black, text: "Setting",)
  25.            
  26.           ],
  27.         ),
  28.       ),
  29.     );
  30.   }
  31. }
  32.  
  33. class cardSaya extends StatelessWidget {
  34.  
  35.   cardSaya ({this.icon, this.text, this.warna});
  36.   final IconData icon;
  37.   final String text;
  38.   final Color warna;
  39.  
  40.   @override
  41.   Widget build(BuildContext context) {
  42.     // TODO: implement build
  43.     return new Container(
  44.       padding: new EdgeInsets.all(10.0),
  45.       child: new Card(
  46.           child: new Column(
  47.         children: <Widget>[
  48.           new Icon(icon, size: 50.0, color: warna),
  49.           new Text(
  50.             text,
  51.             style: new TextStyle(fontSize: 20.0),
  52.           )
  53.         ],
  54.       )),
  55.     );
  56.   }
  57. }
Advertisement
Add Comment
Please, Sign In to add comment