flutter_holo_date_picker 0.1.2+1 flutter_holo_date_picker: ^0.1.2+1 copied to clipboard
A Flutter package of Datepicker that looks like Holo Theme in Android.
import 'package:flutter/material.dart';
import 'package:flutter_holo_date_picker/flutter_holo_date_picker.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'example',
theme: ThemeData(primarySwatch: Colors.blue),
home: Scaffold(
appBar: AppBar(
title: Text('Holo Datepicker Example'),
),
body: MyHomePage()),
debugShowCheckedModeBanner: false,
);
}
}
class MyHomePage extends StatelessWidget {
Widget build(BuildContext context) {
return Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.center,
children: <Widget>[
RaisedButton(
child: Text("open picker dialog"),
onPressed: () async {
var datePicked = await DatePicker.showSimpleDatePicker(
context,
initialDate: DateTime(1994),
firstDate: DateTime(1960),
lastDate: DateTime(2012),
dateFormat: "dd-MMMM-yyyy",
locale: DateTimePickerLocale.en_us,
);
final snackBar =
SnackBar(content: Text("Date Picked $datePicked"));
Scaffold.of(context).showSnackBar(snackBar);
},
),
],
),
);
}
}