generated from dellevin/template
编辑界面优化
This commit is contained in:
@@ -110,12 +110,15 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
|
||||
/// 构建右下角悬浮按钮组
|
||||
Widget _buildFloatingActionButtons(Movie movie) {
|
||||
final hasPoster = movie.posterPath != null && movie.posterPath!.isNotEmpty;
|
||||
|
||||
return Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: [
|
||||
// 删除按钮
|
||||
_buildFloatingButton(
|
||||
icon: Icons.edit_outlined,
|
||||
onPressed: () => _navigateToEdit(context),
|
||||
tooltip: '编辑',
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
_buildFloatingButton(
|
||||
icon: Icons.delete_outline,
|
||||
onPressed: () => _showDeleteDialog(context),
|
||||
@@ -123,23 +126,6 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
backgroundColor: Colors.red,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 清空海报按钮(仅当有海报时显示)
|
||||
if (hasPoster) ...[
|
||||
_buildFloatingButton(
|
||||
icon: Icons.hide_image_outlined,
|
||||
onPressed: () => _showClearPosterDialog(movie),
|
||||
tooltip: '清空海报',
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
],
|
||||
// 编辑按钮
|
||||
_buildFloatingButton(
|
||||
icon: Icons.edit_outlined,
|
||||
onPressed: () => _navigateToEdit(context),
|
||||
tooltip: '编辑',
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
// 分享按钮
|
||||
_buildFloatingButton(
|
||||
icon: Icons.share_outlined,
|
||||
onPressed: () => _showSharePoster(movie),
|
||||
@@ -244,67 +230,6 @@ class _MovieDetailPageState extends State<MovieDetailPage> {
|
||||
);
|
||||
}
|
||||
|
||||
/// 显示清空海报对话框
|
||||
void _showClearPosterDialog(Movie movie) {
|
||||
showDialog(
|
||||
context: context,
|
||||
builder: (context) => AlertDialog(
|
||||
backgroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
title: const Text(
|
||||
'清空海报',
|
||||
style: TextStyle(
|
||||
fontSize: 18,
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
),
|
||||
content: const Text(
|
||||
'确定要清空海报吗?清空后将使用默认占位图。',
|
||||
style: TextStyle(
|
||||
fontSize: 14,
|
||||
color: Color(0xFF666666),
|
||||
height: 1.5,
|
||||
),
|
||||
),
|
||||
actions: [
|
||||
TextButton(
|
||||
onPressed: () => Navigator.pop(context),
|
||||
style: TextButton.styleFrom(
|
||||
foregroundColor: const Color(0xFF666666),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
child: const Text('取消'),
|
||||
),
|
||||
ElevatedButton(
|
||||
onPressed: () async {
|
||||
Navigator.pop(context);
|
||||
final updatedMovie = movie.copyWith(
|
||||
posterPath: null,
|
||||
updatedAt: DateTime.now(),
|
||||
);
|
||||
await context.read<AppProvider>().updateMovie(updatedMovie);
|
||||
if (mounted) {
|
||||
ToastUtil.show(context, '海报已清空');
|
||||
}
|
||||
},
|
||||
style: ElevatedButton.styleFrom(
|
||||
backgroundColor: Colors.red,
|
||||
foregroundColor: Colors.white,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
),
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 8),
|
||||
),
|
||||
child: const Text('清空'),
|
||||
),
|
||||
],
|
||||
actionsPadding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
/// 构建基本信息
|
||||
Widget _buildBasicInfo(Movie movie) {
|
||||
return Padding(
|
||||
|
||||
@@ -446,10 +446,11 @@ class _MovieFormPageState extends State<MovieFormPage> {
|
||||
height: 90,
|
||||
child: _buildInfoCard(
|
||||
label: '别名',
|
||||
value: _alternateTitles.isEmpty
|
||||
? ''
|
||||
value: _alternateTitles.isEmpty
|
||||
? ''
|
||||
: '${_alternateTitles.length}个:${_alternateTitles.join('、')}',
|
||||
icon: Icons.alternate_email_outlined,
|
||||
scrollHorizontal: true,
|
||||
onTap: () => _showMultiValueDialog(
|
||||
title: '添加别名',
|
||||
initialValues: _alternateTitles,
|
||||
@@ -594,9 +595,10 @@ class _MovieFormPageState extends State<MovieFormPage> {
|
||||
IconData? icon,
|
||||
double? height,
|
||||
bool scrollable = false,
|
||||
bool scrollHorizontal = false,
|
||||
}) {
|
||||
final hasValue = value.isNotEmpty;
|
||||
|
||||
|
||||
// 构建值显示部分
|
||||
Widget buildContent() {
|
||||
if (scrollable && height != null) {
|
||||
@@ -614,6 +616,20 @@ class _MovieFormPageState extends State<MovieFormPage> {
|
||||
),
|
||||
),
|
||||
);
|
||||
} else if (scrollHorizontal) {
|
||||
// 水平可滚动模式(别名等长文本使用)
|
||||
return SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
physics: const BouncingScrollPhysics(),
|
||||
child: Text(
|
||||
hasValue ? value : '点击填写',
|
||||
style: TextStyle(
|
||||
fontSize: 15,
|
||||
color: hasValue ? const Color(0xFF1A1A1A) : const Color(0xFFCCCCCC),
|
||||
fontWeight: hasValue ? FontWeight.w500 : FontWeight.normal,
|
||||
),
|
||||
),
|
||||
);
|
||||
} else {
|
||||
// 普通模式:只显示一行
|
||||
return Text(
|
||||
|
||||
Reference in New Issue
Block a user