Skip to content

Commit

Permalink
Add CalendarFormat button customization, bump to version 0.1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksanderwozniak committed Feb 23, 2019
1 parent 40ce16a commit 4b22ed1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## [0.1.1]

* Added CalendarFormat button customization

## [0.1.0]

* Added CalendarFormat button - toggle between month view and week view
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ Flutter Calendar organized neatly into a Table. Autosizes vertically, saving spa
<div style="text-align: center">
<table><tr>
<td style="text-align: center">
<img src="https://github.com/aleksanderwozniak/table_calendar/blob/assets/calendar_month.png" width="250" />
<img src="https://raw.githubusercontent.com/aleksanderwozniak/table_calendar/assets/calendar_month.png" width="250" />
</td>
<td style="text-align: center">
<img src="https://github.com/aleksanderwozniak/table_calendar/blob/assets/calendar_week.png" width="250" />
<img src="https://raw.githubusercontent.com/aleksanderwozniak/table_calendar/assets/calendar_week.png" width="250" />
</td>
</tr></table>
Taken from Example project.
Expand All @@ -33,5 +33,5 @@ Add to pubspec.yaml:

```yaml
dependencies:
table_calendar: ^0.1.0
table_calendar: ^0.1.1
```
4 changes: 2 additions & 2 deletions example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Demonstrates how to use [table_calendar](https://pub.dartlang.org/packages/table
<div style="text-align: center">
<table><tr>
<td style="text-align: center">
<img src="https://github.com/aleksanderwozniak/table_calendar/blob/assets/calendar_month.png" width="250" />
<img src="https://raw.githubusercontent.com/aleksanderwozniak/table_calendar/assets/calendar_month.png" width="250" />
</td>
<td style="text-align: center">
<img src="https://github.com/aleksanderwozniak/table_calendar/blob/assets/calendar_week.png" width="250" />
<img src="https://raw.githubusercontent.com/aleksanderwozniak/table_calendar/assets/calendar_week.png" width="250" />
</td>
</tr></table>
</div>
Expand Down
8 changes: 7 additions & 1 deletion example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisSize: MainAxisSize.max,
children: <Widget>[
_buildTableCalendar(),
const SizedBox(height: 8.0),
Expanded(child: _buildEventList()),
],
),
Expand All @@ -72,8 +73,13 @@ class _MyHomePageState extends State<MyHomePage> {
todayColor: Colors.deepOrange[200],
eventMarkerColor: Colors.brown[700],
calendarFormat: CalendarFormat.week,
formatToggleVisible: true,
centerHeaderTitle: false,
formatToggleVisible: true,
formatToggleTextStyle: TextStyle().copyWith(color: Colors.white, fontSize: 15.0),
formatToggleDecoration: BoxDecoration(
color: Colors.deepOrange[400],
borderRadius: BorderRadius.circular(16.0),
),
events: _events,
onDaySelected: (day) {
setState(() {
Expand Down
20 changes: 15 additions & 5 deletions lib/table_calendar.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ class TableCalendar extends StatefulWidget {
final Color eventMarkerColor;
final Color iconColor;
final CalendarFormat calendarFormat;
final TextStyle formatToggleTextStyle;
final Decoration formatToggleDecoration;
final EdgeInsets formatTogglePadding;
final bool formatToggleVisible;
final bool centerHeaderTitle;

Expand All @@ -32,6 +35,9 @@ class TableCalendar extends StatefulWidget {
this.eventMarkerColor,
this.iconColor = Colors.black,
this.calendarFormat = CalendarFormat.month,
this.formatToggleTextStyle,
this.formatToggleDecoration,
this.formatTogglePadding,
this.formatToggleVisible = false,
this.centerHeaderTitle = true,
}) : super(key: key);
Expand Down Expand Up @@ -120,12 +126,16 @@ class _TableCalendarState extends State<TableCalendar> {
});
},
child: Container(
decoration: BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.circular(12.0),
decoration: widget.formatToggleDecoration ??
BoxDecoration(
border: Border.all(),
borderRadius: BorderRadius.circular(12.0),
),
padding: widget.formatTogglePadding ?? const EdgeInsets.symmetric(horizontal: 10.0, vertical: 4.0),
child: Text(
_calendarLogic.headerToggleText,
style: widget.formatToggleTextStyle ?? TextStyle(),
),
padding: const EdgeInsets.symmetric(horizontal: 8.0, vertical: 4.0),
child: Text(_calendarLogic.headerToggleText),
),
);
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: table_calendar
description: Flutter Calendar organized neatly into a Table. Features events and different calendar formats. Autosizes vertically, saving space for other widgets.
version: 0.1.0
version: 0.1.1
author: Aleksander Woźniak <aleksanderwozniak96@gmail.com>
homepage: https://github.com/aleksanderwozniak/table_calendar

Expand Down

0 comments on commit 4b22ed1

Please sign in to comment.