移到新目錄(gogs) 並優化 login 及上傳圖片機制
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
import './expense_model.dart';
|
||||
import '../services/generic_api_service.dart';
|
||||
|
||||
class ExpenseDetail extends StatelessWidget {
|
||||
final ExpenseApply expense;
|
||||
@@ -170,17 +171,32 @@ class ExpenseDetail extends StatelessWidget {
|
||||
height: 250,
|
||||
width: double.infinity,
|
||||
fit: BoxFit.cover,
|
||||
// [新增] 加載中的轉圈圈
|
||||
loadingBuilder: (context, child, loadingProgress) {
|
||||
if (loadingProgress == null) return child;
|
||||
return Container(
|
||||
height: 250,
|
||||
color: Colors.grey.shade100,
|
||||
child: const Center(child: CircularProgressIndicator()),
|
||||
);
|
||||
},
|
||||
// 處理圖片加載失敗
|
||||
errorBuilder: (context, error, stackTrace) => Container(
|
||||
height: 200,
|
||||
child: const Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
Icon(Icons.broken_image, color: Colors.grey, size: 40),
|
||||
Text('無法載入單據圖片', style: TextStyle(color: Colors.grey)),
|
||||
],
|
||||
),
|
||||
),
|
||||
errorBuilder: (context, error, stackTrace) {
|
||||
print("圖片載入失敗,試圖存取的網址為: ${expense.fullPicUrl}");
|
||||
return Container(
|
||||
height: 200,
|
||||
color: Colors.grey.shade100,
|
||||
child: Column(
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const Icon(Icons.broken_image, color: Colors.red, size: 40),
|
||||
const SizedBox(height: 8),
|
||||
Text('無法載入圖片', style: TextStyle(color: Colors.grey.shade600)),
|
||||
Text(expense.picPath ?? "無檔名", style: const TextStyle(fontSize: 10)),
|
||||
],
|
||||
),
|
||||
);
|
||||
},
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user