Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -30,19 +30,18 @@ class _HomeScreenContentState extends State<HomeScreenContent> {
|
||||
final LockerApi _api = LockerApi();
|
||||
bool _isLoading = false;
|
||||
|
||||
Future<void> _runLockerAction(String name, Future<bool> Function() action) async {
|
||||
Future<void> _runLockerAction(String name, Future<bool> Function() action) async {
|
||||
if (_isLoading) return;
|
||||
|
||||
setState(() => _isLoading = true);
|
||||
|
||||
|
||||
// 실제 명령 전송
|
||||
final success = await action();
|
||||
|
||||
setState(() => _isLoading = false);
|
||||
|
||||
if (!mounted) return;
|
||||
}
|
||||
|
||||
setState(() => _isLoading = false);
|
||||
}
|
||||
// 25.12.03 지은 추가 끝
|
||||
|
||||
void test() async {
|
||||
@@ -108,7 +107,7 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
Widget _buildOverviewSection() {
|
||||
return Container(
|
||||
margin: const EdgeInsets.only(top: 5),
|
||||
child: Card(
|
||||
child: DashboardCard(
|
||||
shadow: _cleanShadow,
|
||||
cardColor: _cardBackgroundColor,
|
||||
child: Column(
|
||||
@@ -170,7 +169,7 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
_selectedImageIndex == 0
|
||||
? 'assets/images/storage.png'
|
||||
: 'assets/images/top.png',
|
||||
width: 100,
|
||||
width: 90,
|
||||
),
|
||||
),
|
||||
Positioned(
|
||||
@@ -261,7 +260,7 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
}
|
||||
|
||||
Widget _buildBatteryStatusCard() {
|
||||
return Card(
|
||||
return DashboardCard(
|
||||
shadow: _cleanShadow,
|
||||
cardColor: _cardBackgroundColor,
|
||||
child: Padding(
|
||||
@@ -342,7 +341,7 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
}
|
||||
|
||||
Widget _buildControlCard() {
|
||||
return Card(
|
||||
return DashboardCard(
|
||||
shadow: _cleanShadow,
|
||||
cardColor: _cardBackgroundColor,
|
||||
child: Padding(
|
||||
@@ -358,24 +357,24 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
child: Row(
|
||||
children: [
|
||||
Expanded(
|
||||
child: _buildStyledToggleSwitch(
|
||||
'UV LED',
|
||||
_controlToggles['UV LED']!,
|
||||
// 25.12.03 지은 수정 시작
|
||||
(val) {
|
||||
_runLockerAction("UV 제어", () async {
|
||||
bool success = await _api.setUV(val);
|
||||
child: _buildStyledToggleSwitch(
|
||||
'UV LED',
|
||||
_controlToggles['UV LED']!,
|
||||
// 25.12.03 지은 수정 시작
|
||||
(val) {
|
||||
_runLockerAction("UV 제어", () async {
|
||||
bool success = await _api.setUV(val);
|
||||
|
||||
if (success) {
|
||||
setState(() => _controlToggles['UV LED'] = val);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
// 25.12.03 지은 수정 끝
|
||||
if (success) {
|
||||
setState(() => _controlToggles['UV LED'] = val);
|
||||
}
|
||||
return success;
|
||||
}
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
// 25.12.03 지은 수정 끝
|
||||
VerticalDivider(color: _mainBlueColor.withOpacity(0.5), indent: 10, endIndent: 10),
|
||||
Expanded(
|
||||
child: _buildStyledToggleSwitch(
|
||||
@@ -390,24 +389,24 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
(val) => setState(() => _controlToggles['HELMET'] = val))),
|
||||
VerticalDivider(color: _subTextColor.withOpacity(0.5), indent: 10, endIndent: 10),
|
||||
Expanded(
|
||||
child: _buildStyledToggleSwitch('FAN',
|
||||
_controlToggles['FAN']!,
|
||||
// 25.12.03 지은 수정 시작
|
||||
(val) {
|
||||
print("👉 [디버깅] fan 눌림! 값: $val");
|
||||
_runLockerAction("FAN 제어", () async {
|
||||
print("👉 [디버깅] API 요청 시작...");
|
||||
bool success = await _api.setFan(val);
|
||||
|
||||
if (success) {
|
||||
setState(() => _controlToggles['FAN'] = val);
|
||||
}
|
||||
return success;
|
||||
});
|
||||
},
|
||||
// 25.12.03 지은 수정 끝
|
||||
),
|
||||
),
|
||||
child: _buildStyledToggleSwitch('FAN',
|
||||
_controlToggles['FAN']!,
|
||||
// 25.12.03 지은 수정 시작
|
||||
(val) {
|
||||
print("👉 [디버깅] fan 눌림! 값: $val");
|
||||
_runLockerAction("FAN 제어", () async {
|
||||
print("👉 [디버깅] API 요청 시작...");
|
||||
bool success = await _api.setFan(val);
|
||||
|
||||
if (success) {
|
||||
setState(() => _controlToggles['FAN'] = val);
|
||||
}
|
||||
return success;
|
||||
});
|
||||
},
|
||||
// 25.12.03 지은 수정 끝
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
)
|
||||
@@ -482,7 +481,7 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
}
|
||||
|
||||
Widget _buildEnvironmentSensorsCard() {
|
||||
return Card(
|
||||
return DashboardCard(
|
||||
shadow: _cleanShadow,
|
||||
cardColor: _cardBackgroundColor,
|
||||
child: Padding(
|
||||
@@ -552,7 +551,7 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
|
||||
Widget _buildMyLocationCard() {
|
||||
const LatLng exampleLocation = LatLng(37.5665, 126.9780);
|
||||
return Card(
|
||||
return DashboardCard(
|
||||
shadow: _cleanShadow,
|
||||
cardColor: _cardBackgroundColor,
|
||||
clipBehavior: Clip.antiAlias,
|
||||
@@ -620,7 +619,7 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
}
|
||||
|
||||
Widget _buildActivityCard() {
|
||||
return Card(
|
||||
return DashboardCard(
|
||||
shadow: _cleanShadow,
|
||||
cardColor: _cardBackgroundColor,
|
||||
child: Padding(
|
||||
@@ -647,9 +646,9 @@ Future<void> _runLockerAction(String name, Future<bool> Function() action) async
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
_activityText('10:45 AM - 헬멧 잠금 해제'),
|
||||
_activityText('10:45 AM - 안전모 잠금 해제'),
|
||||
const SizedBox(height: 8),
|
||||
_activityText('11:00 AM - 헬멧 착용 해제'),
|
||||
_activityText('11:00 AM - 안전모 착용 해제'),
|
||||
],
|
||||
),
|
||||
),
|
||||
@@ -721,7 +720,7 @@ class _LineChartPainter extends CustomPainter {
|
||||
}
|
||||
}
|
||||
|
||||
class Card extends StatelessWidget {
|
||||
class DashboardCard extends StatelessWidget {
|
||||
final Widget child;
|
||||
final EdgeInsetsGeometry? padding;
|
||||
final Clip clipBehavior;
|
||||
@@ -729,7 +728,7 @@ class Card extends StatelessWidget {
|
||||
final Color? cardColor;
|
||||
final BoxShadow? shadow;
|
||||
|
||||
const Card({
|
||||
const DashboardCard({
|
||||
super.key,
|
||||
required this.child,
|
||||
this.padding,
|
||||
|
||||
Reference in New Issue
Block a user