time_interval_picker 0.0.3
time_interval_picker: ^0.0.3 copied to clipboard
Integrate a Custom Time Interval Picker with ease in your dart code.
import 'package:flutter/material.dart';
import 'package:time_interval_picker/time_interval_picker.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Time Interval Picker',
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.blue,
primary: Colors.blue,
brightness: Brightness.dark,
background: Colors.white,
),
useMaterial3: true,
scaffoldBackgroundColor: Colors.white,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: const MyHomePage(title: 'Time Interval Picker'),
);
}
}
class MyHomePage extends StatefulWidget {
const MyHomePage({super.key, required this.title});
final String title;
@override
State<MyHomePage> createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
appBar: AppBar(
backgroundColor: Theme.of(context).colorScheme.primary,
title: Text(widget.title, style: const TextStyle(color: Colors.white)),
),
body: Padding(
padding: const EdgeInsets.all(30),
child: TimeIntervalPicker(
endLimit: null,
startLimit: null,
onChanged: (DateTime? startTime, DateTime? endTime, bool isAllDay) {
print(startTime);
print(endTime);
print(isAllDay);
},
),
),
);
}
}
copied to clipboard