This commit is contained in:
2025-11-02 20:40:11 +07:00
parent efcc6306b0
commit 2495330bf5
11 changed files with 101 additions and 2249 deletions

View File

@@ -19,6 +19,7 @@ class PrintService {
required double issuedKg,
required int issuedPcs,
String? responsibleName,
String? receiverName,
String? barcodeData,
}) async {
// Load Vietnamese-compatible fonts using PdfGoogleFonts
@@ -323,6 +324,35 @@ class PrintService {
pw.SizedBox(height: 12),
pw.Container(
decoration: pw.BoxDecoration(
border: pw.Border.all(color: PdfColors.black, width: 0.5),
borderRadius: pw.BorderRadius.circular(8),
),
padding: const pw.EdgeInsets.all(8),
child: pw.Row(
children: [
pw.Text(
'Nhân viên tiếp nhận: ',
style: pw.TextStyle(
fontSize: 10,
color: PdfColors.grey700,
),
),
pw.Text(
receiverName ?? '-',
style: pw.TextStyle(
fontSize: 12,
fontWeight: pw.FontWeight.bold,
),
),
],
),
),
pw.SizedBox(height: 12),
// Barcode section
if (barcodeData != null && barcodeData.isNotEmpty)
pw.Center(

View File

@@ -52,6 +52,9 @@ class SecureStorage {
/// Key for storing username
static const String _usernameKey = 'username';
/// Key for storing email
static const String _emailKey = 'email';
// ==================== Token Management ====================
/// Save access token securely
@@ -126,6 +129,24 @@ class SecureStorage {
}
}
/// Save email
Future<void> saveEmail(String email) async {
try {
await _storage.write(key: _emailKey, value: email);
} catch (e) {
throw Exception('Failed to save email: $e');
}
}
/// Get email
Future<String?> getEmail() async {
try {
return await _storage.read(key: _emailKey);
} catch (e) {
throw Exception('Failed to read email: $e');
}
}
/// Check if user is authenticated (has valid access token)
Future<bool> isAuthenticated() async {
final token = await getAccessToken();