koukibadr / Bottom-Picker

https://pub.dev/packages/bottom_picker
MIT License
32 stars 21 forks source link

Cannot compile using the time picker #77

Closed atkinsonline closed 10 months ago

atkinsonline commented 10 months ago

I was using the previous version (2.21) of Bottom_picker but I can no longer compile. The first error I was getting is that Time is not defined. To fix that I added your Time class as this:

class Time { final int hours; final int minutes;

Time({ this.hours = 0, this.minutes = 0, }) : assert(minutes < 60 && minutes >= 0 && hours >= 0 && hours < 24); }

But I now get the error

The argument type 'Time' can't be assigned to the parameter type 'Time?'.

in the below where it assigns requiredTime to initialTime. The error is:

The argument type 'Time' can't be assigned to the parameter type 'Time?'. which I don't understand because I have declared requiredTime as Time?

Time? requiredTime = Time(hours: 2, minutes: 15);

BottomPicker.time( title: 'Select Journey Time', titleStyle: TextStyle( fontWeight: FontWeight.bold, fontSize: 15, color: Colors.black, ), initialTime: requiredTime, use24hFormat: true, onSubmit: (value) { }, onClose: () { }, ).show(context); }

koukibadr commented 10 months ago

import the Time class from bottom_picker package is already defined for you there's no need to create it import 'package:bottom_picker/resources/time.dart';

koukibadr commented 10 months ago

@atkinsonline with the latest version 2.3.2 you don't need to import anything, the version it's just published

atkinsonline commented 10 months ago

Thank you @koukibadr that solved the problem I was having. Also pleased to see you've fixed a bug that was in 2.21 where setting the initialTime was not setting the minutes, only the hours.

Thank you for the quick response and turnaround.

koukibadr commented 10 months ago

Thanks for your feedback feel free to send me your future suggestions and bugs This issue will be closed