TAAFT
Free mode
100% free
Freemium
Free Trial
Deals

kali tester's tools

  • TexttoFlutter
    Transform ideas into Flutter code instantly.
    Open
    ```dart import 'package:flutter/material.dart'; class LabDashboard extends StatefulWidget { @override _LabDashboardState createState() => _LabDashboardState(); } class _LabDashboardState extends State<LabDashboard> { bool fan1On = false; bool fan2On = false; bool light1On = false; bool light2On = false; @override Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Lab Automation Dashboard'), ), body: OrientationBuilder( builder: (context, orientation) { return GridView.count( crossAxisCount: orientation == Orientation.portrait ? 2 : 4, padding: EdgeInsets.all(16.0), children: <Widget>[ _buildControlCard('Fan 1', fan1On, () { setState(() { fan1On = !fan1On; }); }, Icons.air), _buildControlCard('Fan 2', fan2On, () { setState(() { fan2On = !fan2On; }); }, Icons.air), _buildControlCard('Light 1', light1On, () { setState(() { light1On = !light1On; }); }, Icons.lightbulb), _buildControlCard('Light 2', light2On, () { setState(() { light2On = !light2On; }); }, Icons.lightbulb), ], ); }, ), ); } Widget _buildControlCard(String title, bool isOn, VoidCallback onPressed, IconData icon) { return Card( elevation: 4.0, child: InkWell( onTap: onPressed, child: Column( mainAxisAlignment: MainAxisAlignment.center, children: <Widget>[ Icon( icon, size: 48.0, color: isOn ? Colors.green : Colors.grey, ), SizedBox(height: 16.0), Text( title, style: TextStyle(fontSize: 18.0, fontWeight: FontWeight.bold), ), SizedBox(height: 8.0), Text( isOn ? 'ON' : 'OFF', style: TextStyle( fontSize: 16.0, color: isOn ? Colors.green : Colors.red, ), ), ], ), ), ); } } ``` This code creates a responsive dashboard with controls for two fans and two lights. The layout adjusts based on the device orientation. Each control is represented by a card that can be tapped to toggle the device on or off. The status is visually indicated by colors and icons.
0 AIs selected
Clear selection
#
Name
Task