update order detail

This commit is contained in:
Phuoc Nguyen
2025-11-25 11:57:56 +07:00
parent c3b5653420
commit 039dfb9fb5
22 changed files with 1587 additions and 288 deletions

View File

@@ -7,6 +7,8 @@ library;
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:go_router/go_router.dart';
import 'package:intl/intl.dart';
// ============================================================================
// String Extensions
@@ -422,26 +424,26 @@ extension BuildContextExtensions on BuildContext {
}
/// Navigate to route
Future<T?> push<T>(Widget page) {
return Navigator.of(this).push<T>(MaterialPageRoute(builder: (_) => page));
}
// Future<T?> push<T>(Widget page) {
// return Navigator.of(this).push<T>(MaterialPageRoute(builder: (_) => page));
// }
/// Navigate and replace current route
Future<T?> pushReplacement<T>(Widget page) {
return Navigator.of(
this,
).pushReplacement<T, void>(MaterialPageRoute(builder: (_) => page));
}
// Future<T?> pushReplacement<T>(Widget page) {
// return Navigator.of(
// this,
// ).pushReplacement<T, void>(MaterialPageRoute(builder: (_) => page));
// }
/// Pop current route
void pop<T>([T? result]) {
Navigator.of(this).pop(result);
}
// void pop<T>([T? result]) {
// GoRouter.of(this).pop(result);
// }
/// Pop until first route
void popUntilFirst() {
Navigator.of(this).popUntil((route) => route.isFirst);
}
// void popUntilFirst() {
// Navigator.of(this).popUntil((route) => route.isFirst);
// }
}
// ============================================================================
@@ -466,4 +468,26 @@ extension NumExtensions on num {
final mod = math.pow(10.0, places);
return ((this * mod).round().toDouble() / mod);
}
/// Format as Vietnamese currency (đồng)
/// Returns formatted string like "1.153.434đ"
String get toVNCurrency {
final formatter = NumberFormat.currency(
locale: 'vi_VN',
symbol: 'đ',
decimalDigits: 0,
);
return formatter.format(this);
}
/// Format as Vietnamese currency with custom symbol
/// Returns formatted string with custom symbol
String toCurrency({String symbol = 'đ', int decimalDigits = 0}) {
final formatter = NumberFormat.currency(
locale: 'vi_VN',
symbol: symbol,
decimalDigits: decimalDigits,
);
return formatter.format(this);
}
}