-
-
Notifications
You must be signed in to change notification settings - Fork 326
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8bfb0eb
commit 26264ec
Showing
31 changed files
with
1,114 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import 'package:toolbox/core/extension/context/locale.dart'; | ||
|
||
extension DurationX on Duration { | ||
String get toStr { | ||
final days = inDays; | ||
if (days > 0) { | ||
return '$days ${l10n.day}'; | ||
} | ||
final hours = inHours % 24; | ||
if (hours > 0) { | ||
return '$hours ${l10n.hour}'; | ||
} | ||
final minutes = inMinutes % 60; | ||
if (minutes > 0) { | ||
return '$minutes ${l10n.minute}'; | ||
} | ||
final seconds = inSeconds % 60; | ||
return '$seconds ${l10n.second}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import 'package:flutter/material.dart'; | ||
|
||
extension WidgetX on Widget { | ||
Widget get card { | ||
return Card(child: this); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import 'package:hive_flutter/adapters.dart'; | ||
|
||
part 'custom.g.dart'; | ||
|
||
@HiveType(typeId: 7) | ||
final class ServerCustom { | ||
@HiveField(0) | ||
final String? temperature; | ||
@HiveField(1) | ||
final String? pveAddr; | ||
|
||
const ServerCustom({ | ||
this.temperature, | ||
this.pveAddr, | ||
}); | ||
|
||
static ServerCustom fromJson(Map<String, dynamic> json) { | ||
final temperature = json["temperature"] as String?; | ||
final pveAddr = json["pveAddr"] as String?; | ||
return ServerCustom( | ||
temperature: temperature, | ||
pveAddr: pveAddr, | ||
); | ||
} | ||
|
||
Map<String, dynamic> toJson() { | ||
final json = <String, dynamic>{}; | ||
if (temperature != null) { | ||
json["temperature"] = temperature; | ||
} | ||
if (pveAddr != null) { | ||
json["pveAddr"] = pveAddr; | ||
} | ||
return json; | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.