ifgyong 4 years ago
parent fe04f186db
commit 5dccd93949

@ -8,7 +8,8 @@
<component name="ChangeListManager">
<list default="true" id="18463f0e-cf10-4ee2-975b-376476396e12" name="Default Changelist" comment="">
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/main.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/main.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pubspec.yaml" beforeDir="false" afterPath="$PROJECT_DIR$/pubspec.yaml" afterDir="false" />
</list>
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
<option name="SHOW_DIALOG" value="false" />

@ -58,6 +58,9 @@ Now in your Dart code, you can use:
import 'package:flutter_custom_calendar/flutter_custom_calendar.dart';
```
### 动画演示
![](./img.gif)
### [查看API](https://github.com/ifgyong/flutter_custom_calendar/blob/master/API.md)
### [查看一个例子 如何使用](https://github.com/ifgyong/flutter_custom_calendar/blob/master/example/lib/main.dart)

@ -106,70 +106,19 @@ class _MyHomePageState extends State<MyHomePage> {
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Wrap(
direction: Axis.vertical,
crossAxisAlignment: WrapCrossAlignment.start,
children: <Widget>[
Text('请选择mode'),
FlatButton(
child: Text(
'singleSelect',
style: TextStyle(color: Colors.white),
),
onPressed: () {
setState(() {
controller.calendarConfiguration.selectMode =
CalendarSelectedMode.singleSelect;
});
},
color: controller.calendarConfiguration.selectMode ==
CalendarSelectedMode.singleSelect
? Colors.teal
: Colors.black38,
),
FlatButton(
child: Text(
'multiSelect',
style: TextStyle(color: Colors.white),
),
onPressed: () {
setState(() {
controller.calendarConfiguration.selectMode =
CalendarSelectedMode.multiSelect;
});
},
color: controller.calendarConfiguration.selectMode ==
CalendarSelectedMode.multiSelect
? Colors.teal
: Colors.black38,
),
FlatButton(
child: Text(
'mutltiStartToEndSelect',
style: TextStyle(color: Colors.white),
),
onPressed: () {
setState(() {
controller.calendarConfiguration.selectMode =
CalendarSelectedMode.mutltiStartToEndSelect;
});
},
color: controller.calendarConfiguration.selectMode ==
CalendarSelectedMode.mutltiStartToEndSelect
? Colors.teal
: Colors.black38,
)
],
body: CupertinoScrollbar(
child: CustomScrollView(
slivers: <Widget>[
_topButtons(),
SliverToBoxAdapter(
child: calendar,
),
calendar,
Expanded(
child: Text(
' $_selectDate ',
style: TextStyle(color: Theme.of(context).focusColor),
SliverToBoxAdapter(
child: Container(
child: Text(
' $_selectDate ',
style: TextStyle(color: Theme.of(context).focusColor),
),
),
)
],
@ -177,4 +126,64 @@ class _MyHomePageState extends State<MyHomePage> {
),
);
}
Widget _topButtons() {
return SliverToBoxAdapter(
child: Wrap(
direction: Axis.vertical,
crossAxisAlignment: WrapCrossAlignment.start,
children: <Widget>[
Text('请选择mode'),
FlatButton(
child: Text(
'singleSelect',
style: TextStyle(color: Colors.white),
),
onPressed: () {
setState(() {
controller.calendarConfiguration.selectMode =
CalendarSelectedMode.singleSelect;
});
},
color: controller.calendarConfiguration.selectMode ==
CalendarSelectedMode.singleSelect
? Colors.teal
: Colors.black38,
),
FlatButton(
child: Text(
'multiSelect',
style: TextStyle(color: Colors.white),
),
onPressed: () {
setState(() {
controller.calendarConfiguration.selectMode =
CalendarSelectedMode.multiSelect;
});
},
color: controller.calendarConfiguration.selectMode ==
CalendarSelectedMode.multiSelect
? Colors.teal
: Colors.black38,
),
FlatButton(
child: Text(
'mutltiStartToEndSelect',
style: TextStyle(color: Colors.white),
),
onPressed: () {
setState(() {
controller.calendarConfiguration.selectMode =
CalendarSelectedMode.mutltiStartToEndSelect;
});
},
color: controller.calendarConfiguration.selectMode ==
CalendarSelectedMode.mutltiStartToEndSelect
? Colors.teal
: Colors.black38,
)
],
),
);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 809 KiB

@ -1,53 +1,55 @@
name: flutter_custom_calendar
description: A new Flutter Calendar package.
version: 0.0.1
author: xiaodong <450468291@qq.com>
homepage: https://github.com/LXD312569496/flutter_custom_calendar
description: A calendar control of flutter that supports three selection modes。
version: 1.0.4
homepage: http://www.fgyong.cn
author: fgyong
repository: https://github.com/ifgyong/flutter_custom_calendar
issue_tracker: https://github.com/ifgyong/flutter_custom_calendar/issues
environment:
sdk: ">=2.1.0 <3.0.0"
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
provider: ^4.0.4
provider: ^4.1.3
dev_dependencies:
flutter_test:
sdk: flutter
# For information on the generic Dart part of this file, see the
# following page: https://www.dartlang.org/tools/pub/pubspec
# following page: https://dart.dev/tools/pub/pubspec
# The following section is specific to Flutter.
flutter:
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# To add assets to your package, add an assets section, like this:
# assets:
# - images/a_dot_burr.jpeg
# - images/a_dot_ham.jpeg
#
# For details regarding assets in packages, see
# https://flutter.dev/assets-and-images/#from-packages
#
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware.
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages
# To add custom fonts to your package, add a fonts section here,
# in this "flutter" section. Each entry in this list should have a
# "family" key with the font family name, and a "fonts" key with a
# list giving the asset and other descriptors for the font. For
# example:
# fonts:
# - family: Schyler
# fonts:
# - asset: fonts/Schyler-Regular.ttf
# - asset: fonts/Schyler-Italic.ttf
# style: italic
# - family: Trajan Pro
# fonts:
# - asset: fonts/TrajanPro.ttf
# - asset: fonts/TrajanPro_Bold.ttf
# weight: 700
#
# For details regarding fonts in packages, see
# https://flutter.dev/custom-fonts/#from-packages

Loading…
Cancel
Save