Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. void main() => runApp(MyApp());
  2.  
  3. class MyApp extends StatelessWidget {
  4. @override
  5. Widget build(BuildContext context) {
  6. return MaterialApp(
  7. title: 'Flutter Demo',
  8. theme: ThemeData(
  9. primarySwatch: Colors.blue,
  10. ),
  11. home: MyHomePage(title: 'Flutter + IoT :):):)'),
  12. );
  13. }
  14. }
  15.  
  16. class MyHomePage extends StatefulWidget {
  17. MyHomePage({Key key, this.title}) : super(key: key);
  18.  
  19. final String title;
  20.  
  21. @override
  22. _MyHomePageState createState() => _MyHomePageState();
  23. }
  24.  
  25. class _MyHomePageState extends State<MyHomePage> {
  26.  
  27. int luz = 0;
  28. int temperatura = 0;
  29.  
  30. @override
  31. Widget build(BuildContext context) {
  32. return Scaffold(
  33. appBar: AppBar(
  34. title: Text(widget.title),
  35. ),
  36. body: Center(
  37. child: Column(
  38. mainAxisAlignment: MainAxisAlignment.center,
  39. children: <Widget>[
  40. SizedBox(
  41. height: 100,
  42. child: Card(
  43. elevation: 20,
  44. child: Row(
  45. mainAxisAlignment: MainAxisAlignment.spaceAround,
  46. children: <Widget>[
  47. RaisedButton(
  48. onPressed: null,
  49. child: Text(
  50. 'ON',
  51. style: TextStyle(fontSize: 20)
  52. ),
  53. ),
  54. RaisedButton(
  55. onPressed: null,
  56. child: Text(
  57. 'OFF',
  58. style: TextStyle(fontSize: 20)
  59. ),
  60. ),
  61. ],
  62. ),
  63. ),
  64. ),
  65. SizedBox(
  66. child: Card(
  67. elevation: 20,
  68. child: Column(
  69. children: [
  70. ListTile(
  71. title: Text('Sensor de Luz',
  72. style: TextStyle(fontWeight: FontWeight.w500)),
  73. subtitle: Text('$luz'),
  74. leading: Icon(
  75. Icons.lightbulb_outline,
  76. color: Colors.blue[500],
  77. ),
  78. ),
  79. Divider(),
  80. ListTile(
  81. title: Text('Sensor de Temperatura:',
  82. style: TextStyle(fontWeight: FontWeight.w500)),
  83. subtitle: Text('$temperatura C'),
  84. leading: Icon(
  85. Icons.toys,
  86. color: Colors.blue[500],
  87. ),
  88. )
  89. ],
  90. ),
  91. ),
  92. )
  93. ],
  94. ),
  95. ),
  96. );
  97. }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement