weekly_date_picker 1.1.2 weekly_date_picker: ^1.1.2 copied to clipboard
A weekly date picker where you can scroll between weeks and select a date.
import 'package:flutter/material.dart';
import 'package:weekly_date_picker/weekly_date_picker.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Weekly Date Picker Example',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: MyHomePage(title: 'Weekly Date Picker Example'),
);
}
}
class MyHomePage extends StatefulWidget {
MyHomePage({Key? key, required this.title}) : super(key: key);
final String title;
@override
_MyHomePageState createState() => _MyHomePageState();
}
class _MyHomePageState extends State<MyHomePage> {
DateTime _selectedDay = DateTime.now();
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Column(
children: [
WeeklyDatePicker(
selectedDay: _selectedDay,
changeDay: (value) => setState(() {
_selectedDay = value;
}),
enableWeeknumberText: false,
weeknumberColor: const Color(0xFF57AF87),
weeknumberTextColor: Colors.white,
backgroundColor: const Color(0xFF1A1A1A),
weekdayTextColor: const Color(0xFF8A8A8A),
digitsColor: Colors.white,
selectedBackgroundColor: const Color(0xFF57AF87),
weekdays: ["Mo", "Tu", "We", "Th", "Fr"],
daysInWeek: 5,
),
],
),
);
}
}