Add Pixel eye logic. Can comparison with 2 image and monitor
This commit is contained in:
1 parent
da7cb5ea23
commit
e8bd345be6
22 files changed
+993
-73
No files matched your search
@@ -0,0 +1,94 @@
|
||||
import 'dart:collection';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
const designWidth = 360;
|
||||
|
||||
Size screenSize = const Size(360, 690);
|
||||
|
||||
extension IterableExtension<E> on Iterable<E> {
|
||||
E? getOrNull(int index) {
|
||||
if (index >= 0 && index < length) {
|
||||
return elementAt(index);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Queue<E> toQueue() {
|
||||
return Queue<E>.from(this);
|
||||
}
|
||||
}
|
||||
|
||||
extension ListExtention<E> on List<E> {
|
||||
E? get firstOrNull {
|
||||
Iterator<E> it = iterator;
|
||||
if (!it.moveNext()) {
|
||||
return null;
|
||||
}
|
||||
return it.current;
|
||||
}
|
||||
|
||||
E? getAllowOverflow(int index) {
|
||||
if (index >= length) {
|
||||
return null;
|
||||
}
|
||||
return this[index];
|
||||
}
|
||||
|
||||
E? firstOrNullWhere(bool test(E element)) {
|
||||
for (E element in this) {
|
||||
if (test(element)) return element;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
extension MapExtention on Map {
|
||||
dynamic get(dynamic key) {
|
||||
return this[key];
|
||||
}
|
||||
}
|
||||
|
||||
extension ScopeFunc<T extends Object> on T {
|
||||
R let<R>(R Function(T it) op) => op(this);
|
||||
|
||||
T also(void Function(T it) op) {
|
||||
op(this);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
extension DoubleGap on double {
|
||||
SizedBox get gapColumn => SizedBox(height: this);
|
||||
|
||||
SizedBox get gapRow => SizedBox(width: this);
|
||||
|
||||
double get dp => this * screenSize.width / designWidth;
|
||||
}
|
||||
|
||||
extension IntGap on int {
|
||||
SizedBox get gapColumn => SizedBox(height: toDouble());
|
||||
|
||||
Widget gapColumnWithBg(Color color) => Container(color: color, height: toDouble());
|
||||
|
||||
SizedBox get gapRow => SizedBox(width: toDouble());
|
||||
|
||||
double get dp => this * screenSize.width / designWidth;
|
||||
}
|
||||
|
||||
extension Localization on String {
|
||||
Text toText({
|
||||
double? size,
|
||||
Color? color,
|
||||
FontWeight weight = FontWeight.w400,
|
||||
double? lineHeight,
|
||||
TextStyle? style,
|
||||
}) {
|
||||
size ??= 16.dp;
|
||||
style ??= TextStyle(fontWeight: weight, fontSize: size, color: color);
|
||||
if (lineHeight != null) {
|
||||
style = style.copyWith(height: lineHeight / size);
|
||||
}
|
||||
return Text(this, style: style);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user