40 lines
929 B
Dart
40 lines
929 B
Dart
import 'package:ducafe_ui_core/ducafe_ui_core.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:forui/forui.dart';
|
|
|
|
Widget appPrice(
|
|
BuildContext context,
|
|
dynamic price, {
|
|
TextStyle? textStyle,
|
|
}) {
|
|
final theme = FTheme.of(context);
|
|
textStyle ??= theme.typography.xl;
|
|
double? priceNum = price is double
|
|
? price
|
|
: double.tryParse(
|
|
price.toString(),
|
|
);
|
|
priceNum ??= 0;
|
|
if (priceNum != 0) {
|
|
priceNum /= 100;
|
|
}
|
|
return <Widget>[
|
|
FIcon(
|
|
FAssets.icons.japaneseYen,
|
|
color: theme.colorScheme.error,
|
|
size: theme.typography.sm.fontSize,
|
|
),
|
|
Text(
|
|
priceNum.toStringAsFixed(2),
|
|
style: textStyle.copyWith(
|
|
color: theme.colorScheme.error,
|
|
height: 1,
|
|
),
|
|
),
|
|
].toRow(
|
|
mainAxisSize: MainAxisSize.min,
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
crossAxisAlignment: CrossAxisAlignment.center,
|
|
);
|
|
}
|