mirror of
https://github.com/SyncrowIOT/syncrow-app.git
synced 2026-10-27 03:47:55 +00:00
count_down_ac
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class CustomHalfHourPicker extends StatefulWidget {
|
||||
final Function(double) onValueChanged;
|
||||
|
||||
const CustomHalfHourPicker({Key? key, required this.onValueChanged})
|
||||
: super(key: key);
|
||||
|
||||
@override
|
||||
_CustomHalfHourPickerState createState() => _CustomHalfHourPickerState();
|
||||
}
|
||||
|
||||
class _CustomHalfHourPickerState extends State<CustomHalfHourPicker> {
|
||||
double selectedValue = 0.0;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return SizedBox(
|
||||
height: 200,
|
||||
child: ListWheelScrollView.useDelegate(
|
||||
itemExtent: 50,
|
||||
perspective: 0.005,
|
||||
physics: const FixedExtentScrollPhysics(),
|
||||
overAndUnderCenterOpacity: 0.3,
|
||||
onSelectedItemChanged: (index) {
|
||||
setState(() {
|
||||
selectedValue =
|
||||
index * 0.5; // Convert index to half-hour increments
|
||||
widget.onValueChanged(selectedValue);
|
||||
});
|
||||
},
|
||||
childDelegate: ListWheelChildBuilderDelegate(
|
||||
builder: (context, index) {
|
||||
if (index < 0 || index > 48)
|
||||
return null; // Limit to 24.0 (48 * 0.5)
|
||||
return Center(
|
||||
child: Text(
|
||||
(index * 0.5)
|
||||
.toStringAsFixed(1), // Display value as 0.0, 0.5, etc.
|
||||
style: const TextStyle(
|
||||
fontSize: 25,
|
||||
color: Colors.black,
|
||||
fontWeight: FontWeight.w800),
|
||||
),
|
||||
);
|
||||
},
|
||||
childCount: 49, // 0.0 to 24.0 (inclusive)
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user