mirror of
https://github.com/Such-Software/hash-wallet.git
synced 2026-10-27 06:18:50 +01:00
* charts (wip) * charts (wip) * wip * add asset grid * split files * logic wip * proper getPrices logic * viewmodel (wip) * charts * remove unused import * remove restricted import...? * fix background gradient when scrolling * add safeguards for broken db * save new pin on removal * add safeguards for concurrency * add haptic feedback * fix haptic feedback * fix fiat ticker * reduce chart padding * add line touch indicator * improve touch target size on range selector * add date/time display when viewing past amount * merge * remove iconSvgPath reference * merge * fix state for date display * merge * auto-reformat * only load charts when page is opened * merge * reformat and apply lints * refactor to use `Money` instead of storing amount in `String` * add slop comment * fix exception on division by zero * ci * workaround toDouble being removed * disable strict parsing and rounding * fix abs() * use new currency picker sheet * safeguard for max flutter-supported decimals * fix amount precision * adjust to new buy/sell * Update lib/new-ui/pages/charts_page.dart Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com> * adjust buy/sell di * replace -> ignore * reformat --------- Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>
22 lines
1.0 KiB
Dart
22 lines
1.0 KiB
Dart
class ChartRange {
|
|
const ChartRange._(this.duration, this.displayText, this.dataPrecision);
|
|
|
|
final Duration? duration;
|
|
final String displayText;
|
|
|
|
// api can handle any precision up to 5min, regardless of data range.
|
|
// we set a "preferred" precision for 2 reasons:
|
|
// - less precision means less data sent, less bandwidth used, and thus less load on the backend
|
|
// - less data points means the chart is easier to look through on a small screen
|
|
final Duration dataPrecision;
|
|
|
|
static const oneHour = ChartRange._(Duration(hours: 1), "1H", Duration(minutes: 5));
|
|
static const oneDay = ChartRange._(Duration(days: 1), "1D", Duration(minutes: 15));
|
|
static const sevenDays = ChartRange._(Duration(days: 7), "7D", Duration(hours: 1));
|
|
static const thirtyDays = ChartRange._(Duration(days: 30), "30D", Duration(hours: 4));
|
|
static const oneYear = ChartRange._(Duration(days: 365), "1Y", Duration(days: 1));
|
|
static const all = ChartRange._(null, "ALL", Duration(days: 1));
|
|
|
|
static const ranges = [oneHour, oneDay, sevenDays, thirtyDays, oneYear, all];
|
|
}
|