mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2025-07-16 10:06:16 +00:00
push countdown widget
This commit is contained in:
@ -1,19 +1,36 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
|
||||
class AlertDialogCountdown extends StatefulWidget {
|
||||
const AlertDialogCountdown({super.key});
|
||||
const AlertDialogCountdown({super.key, required this.durationValue});
|
||||
|
||||
final String durationValue;
|
||||
|
||||
@override
|
||||
State<AlertDialogCountdown> createState() => _AlertDialogCountdownState();
|
||||
}
|
||||
|
||||
class _AlertDialogCountdownState extends State<AlertDialogCountdown> {
|
||||
int durationInSeconds = 0;
|
||||
// Convert seconds to Duration.
|
||||
Duration get duration =>
|
||||
Duration(seconds: int.tryParse(widget.durationValue) ?? 0);
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Row(
|
||||
children: [
|
||||
|
||||
],
|
||||
return Container(
|
||||
height: 120,
|
||||
color: Colors.white,
|
||||
child: CupertinoTimerPicker(
|
||||
itemExtent: 120,
|
||||
mode: CupertinoTimerPickerMode.hm,
|
||||
initialTimerDuration: duration,
|
||||
onTimerDurationChanged: (newDuration) {
|
||||
setState(() {
|
||||
durationInSeconds = newDuration.inSeconds;
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user