Skip to content

Commit 9a5b7af

Browse files
committed
+chore: Simplified Scalable class
1 parent 410ea7f commit 9a5b7af

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

lib/src/sc_on_num_extension.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ import 'scalable.dart';
1717
extension ScOnNumExtension on num {
1818
/// Multiples the num with the current app scale.
1919
// ignore: invalid_use_of_protected_member
20-
double get sc => this * (Scalable.di.getSyncOrNull() ?? 1.0);
20+
double get sc => this * (Scalable.pScale.value ?? 1.0);
2121
}

lib/src/scalable.dart

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,17 @@
1010
// ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
1111
//.title~
1212

13-
import 'dart:async' show FutureOr;
14-
import 'package:df_di/df_di.dart' show DI;
15-
import 'package:df_pod/df_pod.dart'
16-
show SharedDoublePodCreator, TSharedGlobalDoublePod;
13+
import 'package:df_pod/df_pod.dart' show SharedPod;
1714
import 'package:flutter/foundation.dart' show protected;
1815

1916
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
2017

2118
final class Scalable {
2219
Scalable._();
2320
@protected
24-
static final di = DI();
25-
static final Future<TSharedGlobalDoublePod> _pScale =
26-
SharedDoublePodCreator.global('<AppScale.pValue>')
27-
.then((e) => di.register<TSharedGlobalDoublePod>(_pScale));
28-
static FutureOr<TSharedGlobalDoublePod> get pScale =>
29-
di.until<TSharedGlobalDoublePod>();
21+
static final pScale = SharedPod<double, double>(
22+
'<Scalable.pScale>',
23+
fromValue: (e) => e,
24+
toValue: (e) => e,
25+
)..refresh();
3026
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
name: df_scalable
1414
description: A package that provides a convenient method to scale your app UI up or down.
15-
version: 0.5.0
15+
version: 0.6.0
1616
repository: https://github.com/robmllze/df_scalable
1717
funding:
1818
- https://www.buymeacoffee.com/robmllze

0 commit comments

Comments
 (0)