64 lines
1.6 KiB
Dart
64 lines
1.6 KiB
Dart
import 'package:flutter/material.dart';
|
|
import '../../../core/app_theme.dart';
|
|
|
|
class ScheduleItem extends StatelessWidget {
|
|
final String id;
|
|
final String time;
|
|
final String repeat;
|
|
final bool isEnabled;
|
|
final void Function(String id, bool value) onToggle;
|
|
final void Function(String id) onRemove;
|
|
|
|
const ScheduleItem({
|
|
super.key,
|
|
required this.id,
|
|
required this.time,
|
|
required this.repeat,
|
|
required this.isEnabled,
|
|
required this.onToggle,
|
|
required this.onRemove,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
|
child: Row(
|
|
children: [
|
|
// Time & label
|
|
Column(
|
|
crossAxisAlignment: CrossAxisAlignment.start,
|
|
children: [
|
|
Text(
|
|
time,
|
|
style: TextStyle(
|
|
fontSize: 22,
|
|
fontWeight: FontWeight.w700,
|
|
color: isEnabled
|
|
? AppTheme.textPrimary
|
|
: AppTheme.textHint,
|
|
letterSpacing: 0.5,
|
|
),
|
|
),
|
|
Text(
|
|
repeat,
|
|
style: const TextStyle(
|
|
fontSize: 12, color: AppTheme.textHint),
|
|
),
|
|
],
|
|
),
|
|
const Spacer(),
|
|
Switch(
|
|
value: isEnabled,
|
|
onChanged: (val) => onToggle(id, val),
|
|
),
|
|
IconButton(
|
|
icon: const Icon(Icons.delete_outline, color: Colors.redAccent),
|
|
onPressed: () => onRemove(id),
|
|
),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
}
|