An elegant and customizable Flutter widget for selecting time ranges with an intuitive picker UI.
📦 Ready for pub.dev! The go-to solution for Flutter apps that need time range selection — booking apps, attendance trackers, schedules, and more.
- 🕐 Intuitive Picker — Two scrollable time wheels for start & end time
- 📱 12h / 24h Format — Toggle between AM/PM and 24-hour format
- 🎨 Fully Customizable — Colors, dimensions, item count, text styles
- ✅ Validation — Built-in checks for invalid ranges (end before start)
- 🔗 Auto Fill Mode — Auto-calculate duration as user picks times
- 📅 Presets — Quick-select common ranges (Last Hour, Today, This Week)
- ♿ Accessible — Semantic labels and screen reader support
- 📱 Platform Ready — Android, iOS, Web, macOS, Windows, Linux
flutter pub add time_range_selector_widgetOr add manually to pubspec.yaml:
dependencies:
time_range_selector_widget: ^1.0.0import 'package:time_range_selector_widget/time_range_selector_widget.dart';
// Basic usage
TimeRangeSelectorWidget(
onRangeSelected: (startTime, endTime) {
print('Start: $startTime, End: $endTime');
},
)
// With initial values
TimeRangeSelectorWidget(
initialStartTime: TimeOfDay(hour: 9, minute: 0),
initialEndTime: TimeOfDay(hour: 17, minute: 0),
onRangeSelected: (start, end) => scheduleShift(start, end),
)
// 24-hour format
TimeRangeSelectorWidget(
use24HourFormat: true,
onRangeSelected: (start, end) => print('Shift: ${formatDuration(start, end)}'),
)| Property | Type | Default | Description |
|---|---|---|---|
initialStartTime |
TimeOfDay |
TimeOfDay(hour: 0, minute: 0) |
Initial start |
initialEndTime |
TimeOfDay |
TimeOfDay(hour: 23, minute: 59) |
Initial end |
use24HourFormat |
bool |
false |
24h or 12h AM/PM |
onRangeSelected |
void Function(TimeOfDay, TimeOfDay) |
required |
Selection callback |
minTime |
TimeOfDay |
null |
Minimum selectable time |
maxTime |
TimeOfDay |
null |
Maximum selectable time |
minuteInterval |
int |
1 |
Minute steps (5, 10, 15, 30) |
wheelHeight |
double |
40.0 |
Height of each scroll wheel |
backgroundColor |
Color |
null |
Widget background |
accentColor |
Color |
Theme.of(context).primaryColor |
Selection highlight |
textStyle |
TextStyle |
null |
Time text style |
TimeRangeSelectorWidget(
minuteInterval: 30,
initialStartTime: TimeOfDay(hour: 10, minute: 0),
initialEndTime: TimeOfDay(hour: 11, minute: 0),
onRangeSelected: (start, end) => bookMeetingSlot(start, end),
)TimeRangeSelectorWidget(
minTime: TimeOfDay(hour: 9, minute: 0),
maxTime: TimeOfDay(hour: 18, minute: 0),
minuteInterval: 30,
use24HourFormat: true,
onRangeSelected: (start, end) => scheduleShift(start, end),
)TimeRangeSelectorWidget(
backgroundColor: Color(0xFFF5F5F5),
accentColor: Color(0xFF6C63FF),
wheelHeight: 48,
textStyle: TextStyle(fontSize: 18, fontWeight: FontWeight.w600),
onRangeSelected: (start, end) => logHours(start, end),
)| 12-Hour | 24-Hour |
|---|---|
![]() |
![]() |
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
MIT License
Copyright (c) 2024 Shajedur Rahman Panna
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Made with ❤️ by Shajedur Rahman Panna

