Minor change.

This commit is contained in:
stonega 2021-01-02 22:54:10 +08:00
parent 17b45abe47
commit b2c4a2050e
1 changed files with 13 additions and 11 deletions

View File

@ -1303,8 +1303,8 @@ class _SleepTimerPickerState extends State<SleepTimerPicker> {
} }
_initTimer() { _initTimer() {
int h = DateTime.now().hour; var h = DateTime.now().hour;
int m = DateTime.now().minute; var m = DateTime.now().minute;
if (m > 50) { if (m > 50) {
hour = (h + 1) % 24; hour = (h + 1) % 24;
minute = 0; minute = 0;
@ -1315,9 +1315,9 @@ class _SleepTimerPickerState extends State<SleepTimerPicker> {
} }
_getDuration() { _getDuration() {
int h = DateTime.now().hour; var h = DateTime.now().hour;
int m = DateTime.now().minute; var m = DateTime.now().minute;
Duration d = var d =
Duration(hours: hour, minutes: minute) - Duration(hours: h, minutes: m); Duration(hours: hour, minutes: minute) - Duration(hours: h, minutes: m);
if (d >= Duration.zero) { if (d >= Duration.zero) {
return d; return d;
@ -1336,10 +1336,11 @@ class _SleepTimerPickerState extends State<SleepTimerPicker> {
GestureDetector( GestureDetector(
onTap: () { onTap: () {
setState(() { setState(() {
if (hour >= 23) if (hour >= 23) {
hour = 0; hour = 0;
else } else {
hour++; hour++;
}
}); });
widget.onChange(_getDuration()); widget.onChange(_getDuration());
}, },
@ -1367,10 +1368,11 @@ class _SleepTimerPickerState extends State<SleepTimerPicker> {
GestureDetector( GestureDetector(
onTap: (() { onTap: (() {
setState(() { setState(() {
if (minute >= 55) if (minute >= 55) {
minute = 0; minute = 0;
else } else {
minute += 5; minute += 5;
}
}); });
widget.onChange(_getDuration()); widget.onChange(_getDuration());
}), }),
@ -1397,7 +1399,7 @@ class _SleepTimerPickerState extends State<SleepTimerPicker> {
class UpDownIndicator extends StatefulWidget { class UpDownIndicator extends StatefulWidget {
final bool status; final bool status;
final Color color; final Color color;
UpDownIndicator(this.status, {this.color = Colors.white, Key key}) UpDownIndicator({this.status, this.color = Colors.white, Key key})
: super(key: key); : super(key: key);
@override @override
@ -1440,7 +1442,7 @@ class _UpDownIndicatorState extends State<UpDownIndicator>
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Transform.rotate( return Transform.rotate(
angle: widget.status ? -math.pi * _value : math.pi * _value, angle: widget.status ? math.pi * _value : -math.pi * _value,
child: Icon( child: Icon(
Icons.keyboard_arrow_down, Icons.keyboard_arrow_down,
color: widget.color, color: widget.color,