pax_date_picker 0.0.6 copy "pax_date_picker: ^0.0.6" to clipboard
pax_date_picker: ^0.0.6 copied to clipboard

A Date-picker timeline.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:pax_date_picker/pax_date_picker.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Pax Date Picker',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Color(0xff0A61B4)),
      ),
      home: const MyHomePage(title: 'Pax Date Picker'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String formatMonthYear(DateTime? dateTime) {
    return DateFormat('M/d/y').format(dateTime ?? DateTime.now());
  }

  DateTime? selectedTimelinedate;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Theme.of(context).colorScheme.inversePrimary,

        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[
            Text(formatMonthYear(selectedTimelinedate)),
            SizedBox(height: 20),
            Center(
              child: DatePicker(
                height: 100,
                selectedWidth: 70,
                DateTime.now(),
                initialSelectedDate: DateTime.now(),
                selectionColor: Color(0xff0A61B4),
                notSelectionColor: Color(0xFFDBEDFF),
                selectedTextColor: Colors.white,
                dayTextStyle: TextStyle(
                  // fontFamily: kFontFamily,
                  fontWeight: FontWeight.w400,
                  fontSize: 10,
                ),
                dateTextStyle: TextStyle(
                  // fontFamily: kFontFamily,
                  fontWeight: FontWeight.w600,
                  fontSize: 14,
                ),
                deactivatedColor: Color(0xFFDBEDFF),
                onDateChange: (date) {
                  // New date selected
                  setState(() {
                    selectedTimelinedate = date;
                  });
                },
                displayMonth: true,
              ),
            ),
          ],
        ),
      ),
    );
  }
}
0
likes
140
points
46
downloads

Publisher

unverified uploader

Weekly Downloads

A Date-picker timeline.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, intl

More

Packages that depend on pax_date_picker