date_picker_timeline 1.0.0 date_picker_timeline: ^1.0.0 copied to clipboard
Flutter Date Picker Library that provides a calendar as a horizontal timeline.
import 'package:date_picker_timeline/date_picker_timeline.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(title: 'Date Picker Timeline Demo'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key key, this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
DateTime _selectedValue = DateTime.now();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Container(padding: EdgeInsets.all(20.0),
color: Colors.blueGrey[100],
child:
Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text("You Selected:"),
Padding(padding: EdgeInsets.all(10),),
Text(_selectedValue.toString()),
Padding(padding: EdgeInsets.all(20),),
DatePickerTimeline(
_selectedValue,
onDateChange: (date) {
// New date selected
setState(() {
_selectedValue = date;
});
},
),
],
),)
);
}
}