smoothdatepicker 0.0.2 smoothdatepicker: ^0.0.2 copied to clipboard
Horizontal and vertical date picker in Flutter, with the ability to change the scroll and card direction in any combination
import 'package:flutter/material.dart';
import 'package:flutter/rendering.dart';
import 'package:smoothdatepicker/smoothdatepicker.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'SQFlite Demo',
theme: ThemeData(
primarySwatch: Colors.blue,
),
home: MyHomePage(),
);
}
}
class MyHomePage extends StatefulWidget {
// reference to our single class that manages the database
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Color.fromRGBO(63, 136, 197, 1),
body: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(time.toString()),
HDatePicker(
scrollDirection: Axis.horizontal,
cardDirection: Axis.horizontal,
mainColor: Colors.blue,
secondColor: Colors.yellow,
onSelectionChanged: (selectedDate){
setState(() {
time = selectedDate;
});
},
),
],
),
);
}
}
DateTime time = DateTime.now();