omni_datetime_picker 2.0.5 omni_datetime_picker: ^2.0.5 copied to clipboard
A datetime picker package with option to use a single datetime picker or a datetime range picker.
import 'package:flutter/material.dart';
import 'package:omni_datetime_picker/omni_datetime_picker.dart';
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Omni DateTime Picker',
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(
seedColor: Colors.cyan,
brightness: Brightness.light,
),
),
home: const OmniExample(),
);
}
}
class OmniExample extends StatelessWidget {
const OmniExample({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Column(
children: [
ElevatedButton(
onPressed: () async {
final DateTime? dateTime =
await showOmniDateTimePicker(context: context);
// Use dateTime here
debugPrint('dateTime: $dateTime');
},
child: const Text('Show DateTime Picker'),
),
ElevatedButton(
onPressed: () async {
final List<DateTime>? dateTime =
await showOmniDateTimeRangePicker(context: context);
// Use dateTime here
debugPrint('dateTime: $dateTime');
},
child: const Text('Show DateTime Picker'),
),
],
),
),
);
}
}