import 'package:flutter/cupertino.dart'; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:syncrow_app/features/scene/bloc/create_scene/create_scene_bloc.dart'; class AlertDialogCountdown extends StatefulWidget { const AlertDialogCountdown({super.key, required this.durationValue}); final int durationValue; @override State createState() => _AlertDialogCountdownState(); } class _AlertDialogCountdownState extends State { int durationInSeconds = 0; // Convert seconds to Duration. Duration get duration => Duration(seconds: widget.durationValue) ; @override Widget build(BuildContext context) { return Container( height: 120, color: Colors.white, child: CupertinoTimerPicker( itemExtent: 120, mode: CupertinoTimerPickerMode.hm, initialTimerDuration: duration, onTimerDurationChanged: (newDuration) { setState(() { durationInSeconds = newDuration.inSeconds; }); context .read() .add(SelectedValueEvent(value: newDuration.inSeconds)); }, ), ); } }