Calendario svolazzante ordinato e pulito

Blog

Calendario svolazzante ordinato e pulito

flutter_neat_and_clean_calendar

Calendario fluttuante semplice basato su flutter_clean_calendar pacchetto. Questo pacchetto offre alcune funzionalità extra. Ha introdotto un nuovo NeatCleanCalendarEvent oggetto, che viene utilizzato come componente dati trasferito il widget del calendario come parametro. Quindi ora è possibile colorare i punti nel Calendartiles con un colore corrispondente all'evento.



L'elenco degli eventi sotto la vista del calendario viene generato nel pacchetto. Qui i dati extra del NetCleanCalendarEvent gli oggetti tornano in gioco.

Il pacchetto è altamente personalizzabile.



batteria ombra x drone

Immagine dello schermo Immagine dello schermo Immagine dello schermo

utilizzo

Incorpora il widget 'Calendario' in una colonna. Sotto il calendario (come secondo widget nella colonna) posiziona un widget 'ListView.builder' per il rendering dell'elenco degli eventi.



Imposta dipendenza

dependencies: flutter_neat_and_clean_calendar: ^0.1.2+4

Installare

flutter pub get

Importalo

import 'package:flutter_neat_and_clean_calendar/flutter_neat_and_clean_calendar.dart';

Usalo

Widget build(BuildContext context) { return Scaffold( body: SafeArea( child: Calendar( startOnMonday: true, weekDays: ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'], events: _events, isExpandable: true, eventDoneColor: Colors.green, selectedColor: Colors.pink, todayColor: Colors.blue, // dayBuilder: (BuildContext context, DateTime day) { // return new Text('!'); // }, eventListBuilder: (BuildContext context, List _selectesdEvents) { return new Text('!'); }, eventColor: Colors.grey, locale: 'de_DE', todayButtonText: 'Heute', expandableDateFormat: 'EEEE, dd. MMMM yyyy', dayOfWeekStyle: TextStyle( color: Colors.black, fontWeight: FontWeight.w800, fontSize: 11), ), ), ); }

Per maggiori dettagli vedere il esempio .

Proprietà

/// [onDateSelected] is of type [ValueChanged] and it containes the callback function /// extecuted when tapping a date /// [onMonthChanged] is of type [ValueChanged] and it containes the callback function /// extecuted when changing to another month /// [onExpandStateChanged] is of type [ValueChanged] and it contains a callback function /// executed when the view changes to expanded or to condensed /// [onRangeSelected] contains a callback function of type [ValueChanged], that gets called on changes /// of the range (switch to next or previous week or month) /// [onEventSelected] is of type [ValueChanged] and it contains a callback function /// executed when an event of the event list is selected /// [isExpandable] is a [bool]. With this parameter you can control, if the view can expand from week view /// to month view. Default is [false]. /// [dayBuilder] can contain a [Widget]. If this property is not null (!= null), this widget will get used to /// render the calenar tiles (so you can customize the view) /// [eventListBuilder] can optionally contain a [Widget] that gets used to render the event list /// [hideArrows] is a bool. When set to [true] the arrows to navigate to the next or previous week/month in the /// top bar well get suppressed. Default is [false]. /// [hideTodayIcon] is a bool. When set to [true] the dispaly of the Today-Icon (button to navigate to today) in the /// top bar well get suppressed. Default is [false]. /// [hideBottomBar] at the moment has no function. Default is [false]. /// [events] are of type [Map]. This data structure containes the events to display /// [selctedColor] this is the color, applied to the circle on the selcted day /// [todayColor] this is the color of the date of today /// [todayButtonText] is a [String]. With this property you can set the caption of the today icon (button to navigate to today). /// If left empty, the calendar will use the string 'Today'. /// [eventColor] lets you optionally specify the color of the event (dot). If the [CleanCaendarEvents] property color is not set, the /// calendar will use this parameter. /// [eventDoneColor] with this property you can define the color of 'done' events, that is events in the past. /// [initialDate] is of type [DateTime]. It can contain an optional start date. This is the day, that gets initially selected /// by the calendar. The default is to not set this parameter. Then the calendar uses [DateTime.now()] /// [isExpanded] is a bool. If is us set to [true], the calendar gets rendered in month view. /// [weekDays] contains a [List] defining the names of the week days, so that it is possible to name them according /// to your current locale. /// [locale] is a [String]. This setting gets used to format dates according to the current locale. /// [startOnMonday] is a [bool]. This parameter allows the calendar to determine the first day of the week. /// [dayOfWeekStyle] is a [TextStyle] for styling the text of the weekday names in the top bar. /// [bottomBarTextStyle] is a [TextStyle], that sets the style of the text in the bottom bar. /// [bottomBarArrowColor] can set the [Color] of the arrow to expand/compress the calendar in the bottom bar. /// [bottomBarColor] sets the [Color] of the bottom bar /// [expandableDateFormat] defines the formatting of the date in the bottom bar final ValueChanged onDateSelected; final ValueChanged onMonthChanged; final ValueChanged onExpandStateChanged; final ValueChanged onRangeSelected; final ValueChanged onEventSelected; final bool isExpandable; final DayBuilder dayBuilder; final EventListBuilder eventListBuilder; final bool hideArrows; final bool hideTodayIcon; final Map events; final Color selectedColor; final Color todayColor; final String todayButtonText; final Color eventColor; final Color eventDoneColor; final DateTime initialDate; final bool isExpanded; final List weekDays; final String locale; final bool startOnMonday; final bool hideBottomBar; final TextStyle dayOfWeekStyle; final TextStyle bottomBarTextStyle; final Color bottomBarArrowColor; final Color bottomBarColor; final String expandableDateFormat;

Dati evento di esempio

La sintassi della mappa degli eventi è cambiata a causa dell'introduzione della classe 'NeatCleanCalendarEvent'.

final Map _events = { DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day): [ NeatCleanCalendarEvent('Event A', startTime: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 10, 0), endTime: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day, 12, 0), description: 'A special event', color: Colors.blue[700]), ], DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 2): [ NeatCleanCalendarEvent('Event B', startTime: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 2, 10, 0), endTime: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 2, 12, 0), color: Colors.orange), NeatCleanCalendarEvent('Event C', startTime: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 2, 14, 30), endTime: DateTime(DateTime.now().year, DateTime.now().month, DateTime.now().day + 2, 17, 0), color: Colors.pink), ], };

Esempi

Wirget di base con colori personalizzati

Alcuni colori sono stati personalizzati in questo esempio:

Calendar( eventDoneColor: Colors.green, selectedColor: Colors.pink, todayColor: Colors.blue, eventColor: Colors.grey, )

Immagine dello schermo

Visualizzazione calendario espandibile

Calendar( isExpandable: true; )

Immagine dello schermo Immagine dello schermo

minatore di bitcoin lampone pi a energia solare

Generatore di giorni personalizzato

Calendar( // A builder function that renders each calendar tile how you'd like. dayBuilder: (BuildContext context, DateTime day) { return new Text('!'); }, )

Immagine dello schermo

Generatore di elenchi di eventi personalizzati

Calendar( // A builder function that renders the event list eventListBuilder: (BuildContext context, List _selectesdEvents) { return new Text('!'); }, )

Immagine dello schermo

Scarica i dettagli:

Autore: strofinare

come ridimensionare i segnalibri in Chrome

Codice sorgente: https://github.com/rwbr/flutter_neat_and_clean_calendar

#flutter #dart #mobile-apps