Untitled
unknown
dart
2 years ago
3.9 kB
24
Indexable
import 'package:flutter/material.dart'; import 'package:get/get.dart'; import 'package:stedzin/app/utilities/constants/app_colors.dart'; class TimeDialog extends StatelessWidget { final dynamic Function() onSelectTime; final void Function(int)? onSelectedHour; final void Function(int)? onSelectedMinute; final void Function(int)? onSelectedAmPm; final List<Widget> minutes; final List<Widget> hours; final List<Widget> amPm; const TimeDialog({ super.key, required this.onSelectTime, required this.minutes, required this.onSelectedHour, required this.onSelectedMinute, required this.onSelectedAmPm, required this.hours, required this.amPm, }); @override Widget build(BuildContext context) { return AlertDialog( content: Column( mainAxisSize: MainAxisSize.min, children: [ const Text( 'Choose Time', style: TextStyle( fontWeight: FontWeight.bold, fontSize: 18, ), ), const Divider(), Row( children: [ Expanded( child: Container( height: 64, width: 64, color: Colors.grey[300], child: ListWheelScrollView( overAndUnderCenterOpacity: 0.3, itemExtent: 30, squeeze: 0.5, scrollBehavior: const ScrollBehavior(), physics: const FixedExtentScrollPhysics(), children: hours, onSelectedItemChanged: onSelectedHour), ), ), const SizedBox( width: 16, ), Expanded( child: Container( height: 64, width: 64, color: Colors.grey[300], child: ListWheelScrollView( overAndUnderCenterOpacity: 0.3, itemExtent: 20, physics: const FixedExtentScrollPhysics(), onSelectedItemChanged: onSelectedMinute, children: minutes), ), ), const SizedBox( width: 16, ), Expanded( child: Container( height: 64, width: 64, color: Colors.grey[300], child: ListWheelScrollView( overAndUnderCenterOpacity: 0.3, itemExtent: 20, physics: const FixedExtentScrollPhysics(), children: amPm, onSelectedItemChanged: onSelectedAmPm), ), ), ], ), const SizedBox(height: 16), Row( mainAxisAlignment: MainAxisAlignment.end, children: [ TextButton( onPressed: () { Get.back(); }, child: Text( 'Cancel', style: Get.textTheme.bodyLarge?.copyWith( color: AppColors.primary, fontSize: 16, fontWeight: FontWeight.w400), ), ), const SizedBox( width: 40, ), ElevatedButton( onPressed: onSelectTime, child: Padding( padding: const EdgeInsets.symmetric(horizontal: 30), child: Text('Save', style: Get.textTheme.bodyLarge?.copyWith( color: AppColors.white, fontSize: 16, fontWeight: FontWeight.w400)), )), ], ), ], )); } }
Editor is loading...