123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- /*
- * @Author : WuWei
- * @LastEditors : WuWei
- * @Date : 2022-08-17 22:55:11
- * @LastEditTime : 2023-02-07 19:50:00
- * @Description : Do not edit
- */
- import 'package:flutter/material.dart';
- import 'icon_btn.dart';
- import 'semantic_sorting.dart';
- /// Month navigation widget for day based date pickers like
- /// [day_picker.DayPicker],
- /// [WeekPicker],
- /// [RangePicker].
- ///
- /// It is row with [title] of showing month in the center and icons to selects
- /// previous and next month around it.
- class MonthNavigationRow extends StatelessWidget {
- /// Key for previous page icon.
- ///
- /// Can be useful in integration tests to find icon.
- final Key? previousPageIconKey;
- /// Key for next page icon.
- ///
- /// Can be useful in integration tests to find icon.
- final Key? nextPageIconKey;
- /// Function called when [nextIcon] is tapped.
- final VoidCallback? onNextMonthTapped;
- /// Function called when [prevIcon] is tapped.
- final VoidCallback? onPreviousMonthTapped;
- /// Tooltip for the [nextIcon].
- final String? nextMonthTooltip;
- /// Tooltip for the [prevIcon].
- final String? previousMonthTooltip;
- /// Widget to use at the end of this row (after title).
- final Widget? nextIcon;
- /// Widget to use at the beginning of this row (before title).
- final Widget? prevIcon;
- /// Usually [Text] widget.
- final Widget? title;
- /// Creates month navigation row.
- const MonthNavigationRow(
- {Key? key,
- this.previousPageIconKey,
- this.nextPageIconKey,
- this.onNextMonthTapped,
- this.onPreviousMonthTapped,
- this.nextMonthTooltip,
- this.previousMonthTooltip,
- this.title,
- required this.nextIcon,
- required this.prevIcon})
- : super(key: key);
- @override
- // ignore: prefer_expression_function_bodies
- Widget build(BuildContext context) {
- return Row(
- mainAxisAlignment: MainAxisAlignment.spaceBetween,
- crossAxisAlignment: CrossAxisAlignment.center,
- children: <Widget>[
- Semantics(
- sortKey: MonthPickerSortKey.previousMonth,
- child: IconBtn(
- key: previousPageIconKey,
- icon: prevIcon,
- tooltip: previousMonthTooltip,
- onTap: onPreviousMonthTapped,
- ),
- ),
- Expanded(
- child: Container(
- alignment: Alignment.center,
- child: Center(
- child: ExcludeSemantics(
- child: title,
- ),
- ),
- ),
- ),
- Semantics(
- sortKey: MonthPickerSortKey.nextMonth,
- child: IconBtn(
- key: nextPageIconKey,
- icon: nextIcon,
- tooltip: nextMonthTooltip,
- onTap: onNextMonthTapped,
- ),
- ),
- ],
- );
- }
- }
|