Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void main() => runApp(MyApp());
- class MyApp extends StatelessWidget {
- @override
- Widget build(BuildContext context) {
- return MaterialApp(
- title: 'Flutter Demo',
- theme: ThemeData(
- primarySwatch: Colors.blue,
- ),
- home: MyHomePage(title: 'Flutter + IoT :):):)'),
- );
- }
- }
- class MyHomePage extends StatefulWidget {
- MyHomePage({Key key, this.title}) : super(key: key);
- final String title;
- @override
- _MyHomePageState createState() => _MyHomePageState();
- }
- class _MyHomePageState extends State<MyHomePage> {
- int luz = 0;
- int temperatura = 0;
- @override
- Widget build(BuildContext context) {
- return Scaffold(
- appBar: AppBar(
- title: Text(widget.title),
- ),
- body: Center(
- child: Column(
- mainAxisAlignment: MainAxisAlignment.center,
- children: <Widget>[
- SizedBox(
- height: 100,
- child: Card(
- elevation: 20,
- child: Row(
- mainAxisAlignment: MainAxisAlignment.spaceAround,
- children: <Widget>[
- RaisedButton(
- onPressed: null,
- child: Text(
- 'ON',
- style: TextStyle(fontSize: 20)
- ),
- ),
- RaisedButton(
- onPressed: null,
- child: Text(
- 'OFF',
- style: TextStyle(fontSize: 20)
- ),
- ),
- ],
- ),
- ),
- ),
- SizedBox(
- child: Card(
- elevation: 20,
- child: Column(
- children: [
- ListTile(
- title: Text('Sensor de Luz',
- style: TextStyle(fontWeight: FontWeight.w500)),
- subtitle: Text('$luz'),
- leading: Icon(
- Icons.lightbulb_outline,
- color: Colors.blue[500],
- ),
- ),
- Divider(),
- ListTile(
- title: Text('Sensor de Temperatura:',
- style: TextStyle(fontWeight: FontWeight.w500)),
- subtitle: Text('$temperatura C'),
- leading: Icon(
- Icons.toys,
- color: Colors.blue[500],
- ),
- )
- ],
- ),
- ),
- )
- ],
- ),
- ),
- );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement