Giter Site home page Giter Site logo

jemuri / flutter_custom_calendar Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fluttercandies/flutter_custom_calendar

0.0 1.0 0.0 1.29 MB

Flutter的一个日历控件

License: BSD 2-Clause "Simplified" License

Dart 99.66% Swift 0.24% Objective-C 0.02% Java 0.08%

flutter_custom_calendar's Introduction

flutter_custom_calendar

本插件是基于flutter_custom_calendar做了稍微的修改进行上传的。

具体使用方法见flutter_custom_calendar

新增一个选择mode

支持选择开始和结束,选择范围内的日期,使用方法

controller = new CalendarController(
    minYear: 2019,
    minYearMonth: 1,
    maxYear: 2021,
    maxYearMonth: 12,
    showMode: CalendarConstants.MODE_SHOW_MONTH_AND_WEEK,
    selectedDateTimeList: _selectedDate,
    selectMode: CalendarSelectedMode.mutltiStartToEndSelect)
  ..addOnCalendarSelectListener((dateModel) {
    _selectedModels.add(dateModel);
  })
  ..addOnCalendarUnSelectListener((dateModel) {
    if (_selectedModels.contains(dateModel)) {
      _selectedModels.remove(dateModel);
    }
  });

CalendarSelectedMode.mutltiStartToEndSelect这个选择模式会选择开始和结束中间的 默认选择的。

安装和使用

Use this package as a library

  1. Depend on it Add this to your package's pubspec.yaml file:
dependencies:
  flutter_custom_calendar: ^1.0.4+0.5
  1. Install it You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

  1. Import it Now in your Dart code, you can use:
import 'package:flutter_custom_calendar/flutter_custom_calendar.dart';

监听月视图和周视图状态

  controller.addExpandChangeListener((value) {
    /// 添加改变 月视图和 周视图的监听
    _isMonthSelected = value;
    setState(() {});
  });
});

变更月视图和周视图

前提条件是showModelCalendarConstants.MODE_SHOW_MONTH_AND_WEEK或者CalendarConstants.MODE_SHOW_WEEK_AND_MONTH.

变更到周视图

 setState(() {
 controller.weekAndMonthViewChange(CalendarConstants.MODE_SHOW_ONLY_WEEK);
                  });

变更到月视图

setState(() {controller.weekAndMonthViewChange(CalendarConstants.MODE_SHOW_ONLY_MONTH);
                  });

动画演示

flutter_custom_calendar's People

Contributors

lxd312569496 avatar hqwlkj avatar 312569496 avatar ifgyong avatar zmtzawqlp avatar msidolphin avatar nicholasjela avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.