range_calendar 0.0.2-dev.1 copy "range_calendar: ^0.0.2-dev.1" to clipboard
range_calendar: ^0.0.2-dev.1 copied to clipboard

outdated

The range_calendar package has a calendar with daily, weekly and monthly selection option. Just insert a Map<DateTime, List<Widgets>> to perform displaying and filtering events.

example/lib/main.dart

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:range_calendar/range_calendar.dart';

void main()=> 
  runApp(MaterialApp(
    home: HomeView(),
  ));

class HomeView extends StatefulWidget {
  HomeView({Key? key}) : super(key: key);

  @override
  _HomeViewState createState() => _HomeViewState();
}

class _HomeViewState extends State<HomeView> {
  Map<DateTime, List<Widget>> events = {};

  @override
  void initState() {
    setState(() {
      events[DateTime(2021, 10, 3)] = [generateWidget("Futebol"), generateWidget("Volei"), generateWidget("Futsal"), generateWidget("Xadrez")];
      events[DateTime(2021, 10, 4)] = [generateWidget("Flutter"), generateWidget("Dart")];
      events[DateTime(2021, 10, 5)] = [generateWidget("Faculdade"), generateWidget("Trabalho")];
    });
    super.initState();
  }

  Widget generateWidget(String title) {
    return InkWell(
      onTap: () => Navigator.push(
        context,
        MaterialPageRoute(
          builder: (context) => EventView(titleEvent: title),
        ),
      ),
      child: Card(
        child: Container(
          width: double.infinity,
          padding: EdgeInsets.all(10),
          child: Text("$title"),
        ),
      ),
    );
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text("Range Calendar"),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            RangeCalendar(
              onDateSelected: (DateTime date) => null,
              onTapRange: (CalendarRangeSelected range) => null,
              events: events,
            ),
          ],
        ),
      ),
    );
  }
}


class EventView extends StatelessWidget {
  const EventView({Key? key, required this.titleEvent}) : super(key: key);
  final String titleEvent;

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      appBar: AppBar(
        title: Text("Event"),
      ),
      body: Center(
        child: Text(
          "$titleEvent",
          style: TextStyle(
            fontSize: 25,
          ),
        ),
      ),
    );
  }
}
8
likes
0
pub points
15%
popularity

Publisher

unverified uploader

The range_calendar package has a calendar with daily, weekly and monthly selection option. Just insert a Map<DateTime, List<Widgets>> to perform displaying and filtering events.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, material_design_icons_flutter

More

Packages that depend on range_calendar