opt.: settings

This commit is contained in:
lollipopkit
2023-08-16 15:11:22 +08:00
parent c62c8e2c43
commit 329922a836
19 changed files with 121 additions and 131 deletions

View File

@@ -4,6 +4,16 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
extension StringX on String {
/// Format: `#8b2252` or `8b2252`
Color? get hexToColor {
final hexCode = replaceAll('#', '');
final val = int.tryParse('FF$hexCode', radix: 16);
if (val == null) {
return null;
}
return Color(val);
}
int get i => int.parse(this);
Uri get uri {