-
Notifications
You must be signed in to change notification settings - Fork 0
/
dimensions.dart
45 lines (39 loc) · 936 Bytes
/
dimensions.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import 'dart:ui';
import 'package:flutter/material.dart';
@immutable
class Dimensions extends ThemeExtension<Dimensions> {
final double small;
final double medium;
final double large;
const Dimensions({
required this.small,
required this.medium,
required this.large,
});
@override
Dimensions copyWith({
double? small,
double? medium,
double? large,
}) {
return Dimensions(
small: small ?? this.small,
medium: medium ?? this.medium,
large: large ?? this.large,
);
}
@override
Dimensions lerp(ThemeExtension<Dimensions>? other, double t) {
if (other is! Dimensions) return this;
return Dimensions(
small: lerpDouble(small, other.small, t)!,
medium: lerpDouble(medium, other.medium, t)!,
large: lerpDouble(large, other.large, t)!,
);
}
static const light = Dimensions(
small: 8.0,
medium: 16.0,
large: 24.0,
);
}