mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-15 17:47:28 +00:00
89 lines
2.9 KiB
Dart
89 lines
2.9 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:syncrow_app/features/devices/model/device_model.dart';
|
|
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
|
|
import 'package:syncrow_app/utils/context_extension.dart';
|
|
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
|
|
|
|
class CircularButton extends StatelessWidget {
|
|
const CircularButton({
|
|
super.key,
|
|
required this.device,
|
|
required this.label,
|
|
required this.onTap,
|
|
required this.icons,
|
|
});
|
|
|
|
final DeviceModel? device;
|
|
final String label;
|
|
final Function()? onTap;
|
|
final IconData icons;
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Column(
|
|
mainAxisSize: MainAxisSize.min,
|
|
children: [
|
|
Card(
|
|
elevation: 3,
|
|
shape: RoundedRectangleBorder(
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
child: GestureDetector(
|
|
onTap: onTap,
|
|
child: Stack(
|
|
alignment: Alignment.center,
|
|
children: [
|
|
Container(
|
|
width: 60,
|
|
height: 60,
|
|
decoration: BoxDecoration(
|
|
color: Colors.grey[300],
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
),
|
|
Container(
|
|
width: 40,
|
|
height: 40,
|
|
decoration: BoxDecoration(
|
|
color: Colors.white,
|
|
borderRadius: BorderRadius.circular(100),
|
|
),
|
|
child: Center(
|
|
child: label == 'All On'
|
|
? BodySmall(
|
|
text: "On",
|
|
style: context.bodyMedium.copyWith(
|
|
color: ColorsManager.primaryColorWithOpacity,
|
|
fontWeight: FontWeight.bold),
|
|
)
|
|
: label == 'All Off'
|
|
? BodySmall(
|
|
text: "Off",
|
|
style: context.bodyMedium.copyWith(
|
|
color:
|
|
ColorsManager.primaryColorWithOpacity,
|
|
fontWeight: FontWeight.bold),
|
|
)
|
|
: Icon(
|
|
icons,
|
|
color: ColorsManager.primaryColorWithOpacity,
|
|
size: 25,
|
|
),
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
const SizedBox(height: 10),
|
|
BodySmall(
|
|
// text: "Timer",
|
|
text: label,
|
|
style: context.bodyMedium.copyWith(
|
|
color: ColorsManager.textPrimaryColor,
|
|
),
|
|
),
|
|
],
|
|
);
|
|
}
|
|
}
|