syncfusion / flutter-examples

This repository contains the Syncfusion Flutter UI widgets examples and the guide to use them.
Other
1.98k stars 775 forks source link

[syncfusion_flutter_datepicker: ^18.4.43-beta] How to modify bottom spacing in date range picker? #284

Closed MungaraJay closed 3 years ago

MungaraJay commented 3 years ago

Hello,

I've been trying to modify flutter date range picker using syncfusion,

Following is my code, But, I want to remove bottom spacing in datepicker dialog. syncfusion

import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_datepicker/datepicker.dart';
import 'package:syncfusion_flutter_core/theme.dart';

class DateRangePickerV4 extends StatefulWidget {
  @override
  _SelectedDatePickerState createState() => _SelectedDatePickerState();
}

class _SelectedDatePickerState extends State<DateRangePickerV4> {

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      body: SafeArea(
        child: SfDateRangePickerTheme(
          data: SfDateRangePickerThemeData(
            brightness: Brightness.light,
            backgroundColor: Colors.white,
          ),
          child: Card(
            elevation: 5,
            margin: const EdgeInsets.fromLTRB(40, 150, 40, 150),
            child: SfDateRangePicker(
              rangeSelectionColor: Colors.yellow,
              onSelectionChanged: _onSelectionChanged,
              selectionMode: DateRangePickerSelectionMode.range,
              initialSelectedRange: PickerDateRange(
                  DateTime.now().subtract(const Duration(days: 4)),
                  DateTime.now().add(const Duration(days: 3))),
            ),
          ),
        ),
      ),
    );
  }

  void _onSelectionChanged(DateRangePickerSelectionChangedArgs args) {
    print("args : ${args!=null && args.value is PickerDateRange? args.value.startDate : "Empty start"}");
    print("args : ${args!=null && args.value is PickerDateRange? args.value.endDate : "Empty end"}");
  }
}

I want to remove bottom red marked space as in image for card in syncfusion.

Thanks.

Indumathi1195R commented 3 years ago

Hi,

Based on the provided information, we have checked and your requirement is “Remove the bottom spacing in Flutter date range picker”. By default, showLeadingAndTrailingDays property value as false. As per the date range picker implementation, we have maintained 6 rows for month cell size, if you don’t specify the showLeadingAndTrailingDates value as true, the date range picker was rendering with the corresponding leading and trailing dates cell size and it is expected behavior. Kindly use the showLeadingAndTrailingDates property value as true for avoiding the bottom space. Please find the UG link for the same.

UG link: https://help.syncfusion.com/flutter/daterangepicker/customizations#month-cell-customization

We hope that this helps you. Please let us know if you need further assistance.

Regards, Indumathi R