row_date_picker 0.0.6 row_date_picker: ^0.0.6 copied to clipboard
simple customize row date picker.
import 'package:flutter/material.dart';
import 'package:row_date_picker/row_date_picker.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return const MaterialApp(
title: 'Row Date Picker',
home: Example(),
);
}
}
class Example extends StatefulWidget {
const Example({Key? key}) : super(key: key);
@override
State<Example> createState() => _ExampleState();
}
class _ExampleState extends State<Example> {
String showText = 'Row Date Picker';
@override
Widget build(BuildContext context) {
return Scaffold(
body: SingleChildScrollView(
child: Container(
width: MediaQuery.of(context).size.width,
height: MediaQuery.of(context).size.height,
color: Colors.black.withOpacity(0.9),
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Padding(
padding: const EdgeInsets.only(top: 60, bottom: 20),
child: Text(
showText,
style: const TextStyle(color: Colors.white, fontSize: 18),
)),
Padding(
padding: const EdgeInsets.only(bottom: 15),
child: RowDatePicker(onTap: (final value) {
setState(() {
showText = value;
});
})),
Padding(
padding: const EdgeInsets.only(bottom: 15),
child: RowDatePicker(
type: DatePickerType.monthYear,
onTap: (final value) {
setState(() {
showText = value;
});
})),
Padding(
padding: const EdgeInsets.only(bottom: 15),
child: TextButton(
child: const Text(
'DIALOG Day Month',
style: TextStyle(color: Colors.green, fontSize: 16),
),
onPressed: () {
showDialog(
context: context,
builder: (_) {
return AlertDialog(
title: const Text('DIALOG'),
content: RowDatePicker(
type: DatePickerType.dayMonth,
onTap: (final value) {
setState(() {
showText = value;
});
Navigator.pop(context);
}));
});
})),
Padding(
padding: const EdgeInsets.only(bottom: 15),
child: TextButton(
child: const Text(
'DIALOG Day',
style: TextStyle(color: Colors.green, fontSize: 16),
),
onPressed: () {
showDialog(
context: context,
builder: (_) {
return AlertDialog(
title: const Text('DIALOG'),
content: RowDatePicker(
type: DatePickerType.day,
onTap: (final value) {
setState(() {
showText = value;
});
Navigator.pop(context);
}));
});
})),
],
),
)));
}
}