mirror of
https://github.com/SyncrowIOT/web.git
synced 2025-07-10 15:17:31 +00:00
push firmware update
This commit is contained in:
@ -73,7 +73,7 @@ class OneGangGlassSwitchBatchControlView extends StatelessWidget
|
|||||||
),
|
),
|
||||||
FirmwareUpdateWidget(
|
FirmwareUpdateWidget(
|
||||||
deviceId: deviceIds.first,
|
deviceId: deviceIds.first,
|
||||||
version: 12, // adjust the version according to your requirement
|
version: 12,
|
||||||
),
|
),
|
||||||
FactoryResetWidget(
|
FactoryResetWidget(
|
||||||
callFactoryReset: () {
|
callFactoryReset: () {
|
||||||
|
@ -1,43 +1,126 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:flutter_svg/flutter_svg.dart';
|
import 'package:flutter_svg/flutter_svg.dart';
|
||||||
|
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
|
||||||
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
import 'package:syncrow_web/pages/device_managment/shared/device_controls_container.dart';
|
||||||
import 'package:syncrow_web/utils/color_manager.dart';
|
import 'package:syncrow_web/utils/color_manager.dart';
|
||||||
import 'package:syncrow_web/utils/constants/assets.dart';
|
import 'package:syncrow_web/utils/constants/assets.dart';
|
||||||
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
import 'package:syncrow_web/utils/extension/build_context_x.dart';
|
||||||
|
|
||||||
class FirmwareUpdateWidget extends StatelessWidget {
|
class FirmwareUpdateWidget extends StatefulWidget {
|
||||||
const FirmwareUpdateWidget(
|
const FirmwareUpdateWidget(
|
||||||
{super.key, required String deviceId, required int version});
|
{super.key, required this.deviceId, required this.version});
|
||||||
|
|
||||||
|
final String deviceId;
|
||||||
|
final int version;
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<FirmwareUpdateWidget> createState() => _FirmwareUpdateWidgetState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _FirmwareUpdateWidgetState extends State<FirmwareUpdateWidget> {
|
||||||
|
bool _showConfirmation = false;
|
||||||
|
|
||||||
|
void _toggleConfirmation() {
|
||||||
|
setState(() {
|
||||||
|
_showConfirmation = !_showConfirmation;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return DeviceControlsContainer(
|
return DeviceControlsContainer(
|
||||||
child: Column(
|
child: _showConfirmation
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
? Column(
|
||||||
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
ClipOval(
|
children: [
|
||||||
child: Container(
|
Text(
|
||||||
color: ColorsManager.whiteColors,
|
'Firmware Update',
|
||||||
height: 60,
|
style: context.textTheme.titleMedium!.copyWith(
|
||||||
width: 60,
|
fontWeight: FontWeight.bold,
|
||||||
child: Padding(
|
color: ColorsManager.blackColor,
|
||||||
padding: const EdgeInsets.all(12.0),
|
),
|
||||||
child: SvgPicture.asset(
|
),
|
||||||
Assets.firmware,
|
Text(
|
||||||
fit: BoxFit.cover,
|
'Are you sure?',
|
||||||
|
style: context.textTheme.bodySmall!.copyWith(
|
||||||
|
color: ColorsManager.grayColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 16),
|
||||||
|
Row(
|
||||||
|
children: [
|
||||||
|
Flexible(
|
||||||
|
child: DefaultButton(
|
||||||
|
height: 20,
|
||||||
|
elevation: 0,
|
||||||
|
padding: 0,
|
||||||
|
onPressed: _toggleConfirmation,
|
||||||
|
backgroundColor: ColorsManager.greyColor,
|
||||||
|
child: Text(
|
||||||
|
'Cancel',
|
||||||
|
style: context.textTheme.bodyMedium!.copyWith(
|
||||||
|
color: ColorsManager.blackColor,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(width: 8),
|
||||||
|
Flexible(
|
||||||
|
child: DefaultButton(
|
||||||
|
height: 20,
|
||||||
|
elevation: 0,
|
||||||
|
padding: 0,
|
||||||
|
onPressed: () {
|
||||||
|
_toggleConfirmation();
|
||||||
|
},
|
||||||
|
backgroundColor: ColorsManager.primaryColor,
|
||||||
|
child: Text(
|
||||||
|
'Update',
|
||||||
|
style: context.textTheme.bodyMedium!.copyWith(
|
||||||
|
color: ColorsManager.whiteColors,
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
fontSize: 12,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
: GestureDetector(
|
||||||
|
onTap: _toggleConfirmation,
|
||||||
|
child: Column(
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
|
mainAxisAlignment: MainAxisAlignment.spaceBetween,
|
||||||
|
children: [
|
||||||
|
ClipOval(
|
||||||
|
child: Container(
|
||||||
|
color: ColorsManager.whiteColors,
|
||||||
|
height: 60,
|
||||||
|
width: 60,
|
||||||
|
child: Padding(
|
||||||
|
padding: const EdgeInsets.all(12.0),
|
||||||
|
child: SvgPicture.asset(
|
||||||
|
Assets.firmware,
|
||||||
|
fit: BoxFit.cover,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
Text(
|
||||||
|
'Firmware Update',
|
||||||
|
style: context.textTheme.titleMedium!.copyWith(
|
||||||
|
fontWeight: FontWeight.w400,
|
||||||
|
color: ColorsManager.blackColor,
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
)),
|
|
||||||
Text(
|
|
||||||
'Firmware Update',
|
|
||||||
style: context.textTheme.titleMedium!.copyWith(
|
|
||||||
fontWeight: FontWeight.w400,
|
|
||||||
color: ColorsManager.blackColor,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user