Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:smarthomeui/util/smart_device_box.dart';
class HomePage extends StatefulWidget {
const HomePage({super.key});
@OverRide
State createState() => _HomePageState();
}
class _HomePageState extends State {
// padding constants
final double horizontalPadding = 40;
final double verticalPadding = 25;
// list of smart devices
List mySmartDevices = [
// [ smartDeviceName, iconPath , powerStatus ]
["Smart Light", "lib/icons/light-bulb.png", true],
["Smart AC", "lib/icons/air-conditioner.png", false],
["Smart TV", "lib/icons/smart-tv.png", false],
["Smart Fan", "lib/icons/fan.png", false],
];
// power button switched
void powerSwitchChanged(bool value, int index) {
setState(() {
mySmartDevices[index][2] = value;
});
}
@OverRide
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.grey[300],
body: SafeArea(
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
// app bar
Padding(
padding: EdgeInsets.symmetric(
horizontal: horizontalPadding,
vertical: verticalPadding,
),
child: Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
// menu icon
Image.asset(
'lib/icons/menu.png',
height: 45,
color: Colors.grey[800],
),
}
}