Reputation: 734
I have a ListView()
with horizontal scrolling. In this ListView I should display all the days of current month (without month name) starting from current day (which should be highlighted).
It should look like this:
Upvotes: 0
Views: 2549
Reputation: 165
Take a look at the Weekly Date Picker package, it may be exactly what you are looking for.
Upvotes: 0
Reputation: 54365
You can fork and use package https://pub.dev/packages/date_picker_timeline
And remark month code in date_widget.dart
/*Text(new DateFormat("MMM", locale).format(date).toUpperCase(), // Month
style: monthTextStyle),*/
working demo
full example code
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: Page1(title: 'Date Picker Timeline Demo'),
);
}
}
class Page1 extends StatefulWidget {
Page1({Key key, this.title}) : super(key: key);
final String title;
@override
_Page1State createState() => _Page1State();
}
class _Page1State extends State<Page1> {
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;
});
},
),
],
),
));
}
}
Upvotes: 1