Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.08 KB | None | 0 0
  1. import 'package:flutter/material.dart';
  2.  
  3. void main() => runApp(MyApp());
  4.  
  5. class MyApp extends StatelessWidget {
  6. // This widget is the root of your application.
  7. @override
  8. Widget build(BuildContext context) {
  9. return MaterialApp(
  10. title: 'Flutter Demo',
  11. theme: ThemeData(
  12. // This is the theme of your application.
  13. //
  14. // Try running your application with "flutter run". You'll see the
  15. // application has a blue toolbar. Then, without quitting the app, try
  16. // changing the primarySwatch below to Colors.green and then invoke
  17. // "hot reload" (press "r" in the console where you ran "flutter run",
  18. // or simply save your changes to "hot reload" in a Flutter IDE).
  19. // Notice that the counter didn't reset back to zero; the application
  20. // is not restarted.
  21. primarySwatch: Colors.blue,
  22. ),
  23. home: MyHomePage(title: 'Flutter Demo Home Page'),
  24. );
  25. }
  26. }
  27.  
  28. class MyHomePage extends StatefulWidget {
  29. MyHomePage({Key key, this.title}) : super(key: key);
  30.  
  31. // This widget is the home page of your application. It is stateful, meaning
  32. // that it has a State object (defined below) that contains fields that affect
  33. // how it looks.
  34.  
  35. // This class is the configuration for the state. It holds the values (in this
  36. // case the title) provided by the parent (in this case the App widget) and
  37. // used by the build method of the State. Fields in a Widget subclass are
  38. // always marked "final".
  39.  
  40. final String title;
  41.  
  42. @override
  43. _MyHomePageState createState() => _MyHomePageState();
  44. }
  45.  
  46. class _MyHomePageState extends State<MyHomePage> {
  47. int _counter = 0;
  48.  
  49. void _incrementCounter() {
  50. setState(() {
  51. // This call to setState tells the Flutter framework that something has
  52. // changed in this State, which causes it to rerun the build method below
  53. // so that the display can reflect the updated values. If we changed
  54. // _counter without calling setState(), then the build method would not be
  55. // called again, and so nothing would appear to happen.
  56. _counter++;
  57. });
  58. }
  59.  
  60. @override
  61. Widget build(BuildContext context) {
  62. // This method is rerun every time setState is called, for instance as done
  63. // by the _incrementCounter method above.
  64. //
  65. // The Flutter framework has been optimized to make rerunning build methods
  66. // fast, so that you can just rebuild anything that needs updating rather
  67. // than having to individually change instances of widgets.
  68. return Scaffold(
  69. appBar: AppBar(
  70. // Here we take the value from the MyHomePage object that was created by
  71. // the App.build method, and use it to set our appbar title.
  72. title: Text(widget.title),
  73. ),
  74. body: MyWidget(),
  75. // This trailing comma makes auto-formatting nicer for build methods.
  76. );
  77. }
  78. }
  79.  
  80. class MyWidget extends StatelessWidget{
  81. @override
  82. Widget build(BuildContext context) {
  83. return Container(
  84. margin: const EdgeInsets.all(15.0),
  85. padding: const EdgeInsets.all(3.0),
  86. width: 320,
  87. height: 130,
  88. decoration: BoxDecoration(
  89. border: Border.all(
  90. color: Colors.black,
  91. width: 8.0)),
  92. child:
  93. Column(children: <Widget>[
  94. Row(children: <Widget>[
  95. Padding(padding: const EdgeInsets.all(8.0),
  96. child: Icon(Icons.account_circle, size: 50),),
  97.  
  98. Column(
  99. children: <Widget>[
  100. Text('name', style: Theme.of(context).textTheme.headline,),
  101. Text('Beginner App Developer')
  102. ],
  103. ),
  104. ],),
  105. Row(mainAxisAlignment: MainAxisAlignment.spaceAround,
  106. children: <Widget>[
  107. Text('300 Jay Street'),
  108. Text('646-123-4567'),
  109. ],),
  110. Row(mainAxisAlignment: MainAxisAlignment.spaceAround,
  111. children: <Widget>[
  112. Icon(Icons.accessibility),Icon(Icons.timer),
  113. Icon(Icons.phone_iphone), Icon(Icons.phone_android),
  114. ],)
  115. ],)
  116. );
  117. }
  118.  
  119. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement