feat:参照研听的基础工程
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
enum MetalType {
|
||||
gold('gold', '黄金', '金', Color(0xFFB5862A)),
|
||||
platinum('platinum', '铂金', '铂', Color(0xFF7D8792)),
|
||||
silver('silver', '白银', '银', Color(0xFF9DA3AA));
|
||||
|
||||
const MetalType(this.id, this.label, this.shortLabel, this.color);
|
||||
|
||||
final String id;
|
||||
final String label;
|
||||
final String shortLabel;
|
||||
final Color color;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
String formatCny(num value) {
|
||||
final fixed = value.toStringAsFixed(2);
|
||||
final parts = fixed.split('.');
|
||||
final whole = parts.first.replaceAllMapped(
|
||||
RegExp(r'(\d)(?=(\d{3})+(?!\d))'),
|
||||
(match) => '${match[1]},',
|
||||
);
|
||||
return '¥$whole.${parts.last}';
|
||||
}
|
||||
|
||||
String formatGram(num value) => '${value.toStringAsFixed(2)}g';
|
||||
Reference in New Issue
Block a user