cdharris / flutter_duration_picker Goto Github PK
View Code? Open in Web Editor NEWA Flutter Widget for allowing a user to pick a duration (e.g. 5mins, 1h 30mins, etc)
License: MIT License
A Flutter Widget for allowing a user to pick a duration (e.g. 5mins, 1h 30mins, etc)
License: MIT License
First leap of circle have to set seconds, the second one is for minutes, and then hours.
setting a 1hour initial duration with:
initialTime: Duration(minutes: 60),
as soon as the user start moving the dot, this value becomes 2h
Version Info
flutter_duration_picker:
dependency: "direct main"
description:
name: flutter_duration_picker
url: "https://pub.dartlang.org"
source: hosted
version: "1.0.4"
My flutter Version :
Flutter 1.27.0-2.0.pre.98 • channel master • https://github.com/flutter/flutter.git
Framework • revision 696e4f70d1 (3 days ago) • 2021-02-13 18:31:02 -0500
Engine • revision 1d537824d6
Tools • Dart 2.13.0 (build 2.13.0-30.0.dev)
Error Stacktrace :
../../../../../../../../../.pub-cache/hosted/pub.dartlang.org/flutter_duration_picker-1.0.4/lib/flutter_duration_picker.dart:506:44: Error: Method not found: 'ButtonTheme.bar'.
final Widget actions = new ButtonTheme.bar(
^^^
As per SO post : https://stackoverflow.com/questions/66027441/error-method-not-found-buttontheme-bar
ButtonTheme.bar is Deprecated. We need to use ButtonBarTheme instead which offers more flexibility to configure ButtonBar widgets. This feature was deprecated after v1.9.1.
So need to change
final Widget actions = new ButtonTheme.bar(
to
final Widget actions = new ButtonBarTheme(
on line 506
of flutter_duration_picker.dart
I am happy to submit PR for the same.
I have been using duration picker package for my project . The duration picker placed in a singlechildscroll view . When the page scrolls the duration picker not working .
Recent changes since v1.0.4 made it possible to select negative durations by spinning multiple times anti clock-wise. In addition sometimes 1min glitches to 59min while jiggling the spinner a bit.
Repro steps:
Hello, thanks for this wonderfull widget, it seems that when you set the default duration with more than 60 minutes it always defaults to 30 although the real value is correct and returns 90 minutes.
new IconButton(
icon: new Icon(Icons.av_timer),
tooltip: 'Elige duración',
onPressed: (() async {
Duration newDuration = await showDurationPicker(
context: context,
initialTime: Duration(minutes: 90);
setState(() {
_durationCtrler.text =
"${newDuration.inMinutes.toString()} minutos.";
partidoDuration = newDuration;
});
}),
Is there any change this library getting null safety support?
Hi! I'm a flutter newbie and I want to change the color of picker, but I don't know how to do. Plz anyone help me
It would be great if this library could provide feedback to the user on scroll via the HapticFeedback API. Options for enabling this as I see it:
have an enableHapticFeedback: bool
in the settings which calls HapticFeedback.selectionClick()
in the _handleTimeChanged
method of _DurationPickerDialogState
provide a callback to the consumer on calls to the _handleTimeChanged
method of _DurationPickerDialogState
I personally prefer option 2. It's a bit more generic.
Upon checking on the code imported from the package and the code in the repo, some changes are out of date
On clicking the center text, It should enable few actions.
Maximum and minimum limits for the widget will be useful.
The clock circle being painted in your flutter_duration_picker.dart file is always white in color even when I change the brightness in ThemeData to Brightness.dark.
In the flutter_duration_picket.dart file inside the CustomPainter class named _DialPainter
inside paint overridden function
see this code ( Images attatched are in Brightness.dark mode )
// Draw the inner background circle
canvas.drawCircle(centerPoint, radius * 0.88,
new Paint()..color = Colors.white);
// Draw the inner background circle
canvas.drawCircle(centerPoint, radius * 0.88,
new Paint()..color = Theme.of(context).canvasColor);
so that the color of clock background depends on the theme of the app i.e if the app is in Dark theme or in Light theme( brightness in ThemeData).
It will be great to have the option to define text color and background.
When the dot has completed one or more rounds and is at the top (1h 0, 2h 0, etc), if you drag directly from before (say beginning the tap on 55 and dragging over 0 towards 5) a new hour is counted, and it shouldn't.
There is no option in the date picker to enable or disable.
If the duration picker is disabled, then it should not allow to change the default (selected) value.
I need a circular slider widget to select value between V1 and V2 with configurable step. (by example select value between 1 and 5 with step of 0.5).
Do you think you can adapt your component and provide this kind of component that does not exist yet in flutter.
Tx in advance.
Could you provide the shape property for the duration popup so we can easier implement rounded corners?
This widget is great, but it creates a new layer for each hour. I get that this creates the effect of darker color, but it stops making any difference after 10h, and the bigger the value, the slower it becomes, until it just crashes the app. 500h is enough to crash the app on some devices.
I would sugest that it should stop creating layers after 10 iterations, or use only two layers by multiplying the color of the firs before going to the next.
If the DurationPicker
is in a scrollviewer it is unusable. For instance, It's extremely difficult to get the slider circle to respond to touch.
The first bug occurs when initially trying to reach 1 h. It zeroes out.
The second bug occurs when reaching more than 2 h, it is always 2h60 and not 3h, 3h60 and not 4.
Hello, when the circle slider is brought back to zero, the "0" is not displayed. An empty space is there instead
hi chris,
I really liked the picker you did, I'm a bit new in the field and unable to add it to Android Studio. I'd love to get help :)
Thanks in advance!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.