chore: release v1.0.18
Deploy / build-linux-web (push) Successful in 53s
Deploy / build-windows (push) Successful in 1m48s
Deploy / build-macos (push) Successful in 1m17s
Deploy / build-android (push) Successful in 4m13s
Deploy / build-ios (push) Successful in 9s
Deploy / release-deploy (push) Successful in 1m37s
Deploy / build-linux-web (push) Successful in 53s
Deploy / build-windows (push) Successful in 1m48s
Deploy / build-macos (push) Successful in 1m17s
Deploy / build-android (push) Successful in 4m13s
Deploy / build-ios (push) Successful in 9s
Deploy / release-deploy (push) Successful in 1m37s
移动端响应式适配(抽屉导航/列表卡片/弹窗自适应)、Android 正式签名与 APK 发布、 iOS(TestFlight) 工程与 CI、多平台构建流水线、相关文档同步。 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../core/responsive/responsive.dart';
|
||||
import '../core/theme/app_theme.dart';
|
||||
|
||||
class DataTableCard extends StatefulWidget {
|
||||
@@ -11,6 +12,10 @@ class DataTableCard extends StatefulWidget {
|
||||
final ValueChanged<int>? onPageChanged;
|
||||
final ValueChanged<int>? onPageSizeChanged;
|
||||
|
||||
/// 窄屏(手机)卡片列表。与 [rows] 同序、同数量;提供后窄屏渲染卡片流,
|
||||
/// 宽屏仍渲染表格。为 null 时窄屏也保持表格(横向滚动)。
|
||||
final List<Widget>? mobileCards;
|
||||
|
||||
const DataTableCard({
|
||||
super.key,
|
||||
required this.columns,
|
||||
@@ -21,6 +26,7 @@ class DataTableCard extends StatefulWidget {
|
||||
this.pageSize = 20,
|
||||
this.onPageChanged,
|
||||
this.onPageSizeChanged,
|
||||
this.mobileCards,
|
||||
});
|
||||
|
||||
@override
|
||||
@@ -49,30 +55,9 @@ class _DataTableCardState extends State<DataTableCard> {
|
||||
),
|
||||
if (widget.toolbar != null) const Divider(height: 1),
|
||||
Expanded(
|
||||
child: LayoutBuilder(
|
||||
builder: (context, constraints) => SingleChildScrollView(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(minWidth: constraints.maxWidth),
|
||||
child: Table(
|
||||
defaultColumnWidth: const IntrinsicColumnWidth(),
|
||||
border: TableBorder(
|
||||
horizontalInside: BorderSide(
|
||||
color: Colors.grey.shade200,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
children: [
|
||||
_buildHeaderRow(),
|
||||
for (int i = 0; i < widget.rows.length; i++)
|
||||
_buildDataRow(i, widget.rows[i]),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
child: (context.isMobile && widget.mobileCards != null)
|
||||
? _buildMobileList()
|
||||
: _buildTable(),
|
||||
),
|
||||
// Pagination
|
||||
if (widget.totalCount != null)
|
||||
@@ -102,6 +87,52 @@ class _DataTableCardState extends State<DataTableCard> {
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildTable() {
|
||||
return LayoutBuilder(
|
||||
builder: (context, constraints) => SingleChildScrollView(
|
||||
child: SingleChildScrollView(
|
||||
scrollDirection: Axis.horizontal,
|
||||
child: ConstrainedBox(
|
||||
constraints: BoxConstraints(minWidth: constraints.maxWidth),
|
||||
child: Table(
|
||||
defaultColumnWidth: const IntrinsicColumnWidth(),
|
||||
border: TableBorder(
|
||||
horizontalInside: BorderSide(
|
||||
color: Colors.grey.shade200,
|
||||
width: 0.5,
|
||||
),
|
||||
),
|
||||
children: [
|
||||
_buildHeaderRow(),
|
||||
for (int i = 0; i < widget.rows.length; i++)
|
||||
_buildDataRow(i, widget.rows[i]),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildMobileList() {
|
||||
final cards = widget.mobileCards!;
|
||||
if (cards.isEmpty) {
|
||||
return const Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(32),
|
||||
child: Text('暂无数据',
|
||||
style: TextStyle(color: AppTheme.textSecondary, fontSize: 14)),
|
||||
),
|
||||
);
|
||||
}
|
||||
return ListView.separated(
|
||||
padding: const EdgeInsets.all(12),
|
||||
itemCount: cards.length,
|
||||
separatorBuilder: (_, __) => const SizedBox(height: 10),
|
||||
itemBuilder: (_, i) => cards[i],
|
||||
);
|
||||
}
|
||||
|
||||
TableRow _buildHeaderRow() {
|
||||
return TableRow(
|
||||
decoration: const BoxDecoration(color: Color(0xFFF0F4FF)),
|
||||
|
||||
@@ -0,0 +1,131 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../core/theme/app_theme.dart';
|
||||
|
||||
/// 移动端列表卡片的单个字段(label: value)。
|
||||
class MobileCardField {
|
||||
final String label;
|
||||
final String? value;
|
||||
|
||||
/// 自定义值控件(如带颜色的金额、状态徽章);提供后忽略 [value]。
|
||||
final Widget? valueWidget;
|
||||
const MobileCardField(this.label, this.value, {this.valueWidget});
|
||||
}
|
||||
|
||||
/// 窄屏(手机)列表的通用卡片:标题 + 右上角徽章 + 字段竖排 + 底部操作。
|
||||
/// 替代宽屏的表格行,使一行数据在手机上可一屏读完、操作可点。
|
||||
class MobileListCard extends StatelessWidget {
|
||||
final Widget title;
|
||||
final Widget? subtitle;
|
||||
final Widget? trailing;
|
||||
final List<MobileCardField> fields;
|
||||
final List<Widget>? actions;
|
||||
final VoidCallback? onTap;
|
||||
|
||||
const MobileListCard({
|
||||
super.key,
|
||||
required this.title,
|
||||
this.subtitle,
|
||||
this.trailing,
|
||||
this.fields = const [],
|
||||
this.actions,
|
||||
this.onTap,
|
||||
});
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Card(
|
||||
margin: EdgeInsets.zero,
|
||||
elevation: 0,
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
side: BorderSide(color: Colors.grey.shade200),
|
||||
),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(8),
|
||||
onTap: onTap,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.all(12),
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
Expanded(
|
||||
child: Column(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
DefaultTextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 15,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppTheme.textPrimary,
|
||||
),
|
||||
child: title,
|
||||
),
|
||||
if (subtitle != null) ...[
|
||||
const SizedBox(height: 2),
|
||||
DefaultTextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 12,
|
||||
color: AppTheme.textSecondary),
|
||||
child: subtitle!,
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
if (trailing != null) ...[
|
||||
const SizedBox(width: 8),
|
||||
trailing!,
|
||||
],
|
||||
],
|
||||
),
|
||||
if (fields.isNotEmpty) ...[
|
||||
const SizedBox(height: 10),
|
||||
...fields.map(_buildField),
|
||||
],
|
||||
if (actions != null && actions!.isNotEmpty) ...[
|
||||
const Divider(height: 18),
|
||||
Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Wrap(
|
||||
spacing: 4,
|
||||
children: actions!,
|
||||
),
|
||||
),
|
||||
],
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
Widget _buildField(MobileCardField f) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 3),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
SizedBox(
|
||||
width: 64,
|
||||
child: Text(
|
||||
f.label,
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary),
|
||||
),
|
||||
),
|
||||
Expanded(
|
||||
child: f.valueWidget ??
|
||||
Text(
|
||||
f.value ?? '—',
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textPrimary),
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import '../core/utils/dialog_util.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import '../core/responsive/responsive.dart';
|
||||
import 'package:lpinyin/lpinyin.dart';
|
||||
import '../core/theme/app_theme.dart';
|
||||
|
||||
@@ -135,7 +136,7 @@ class _SearchDialogState extends State<_SearchDialog> {
|
||||
title: Text(widget.title, style: const TextStyle(fontSize: 16)),
|
||||
contentPadding: const EdgeInsets.fromLTRB(16, 12, 16, 0),
|
||||
content: SizedBox(
|
||||
width: 300,
|
||||
width: context.dialogWidth(300),
|
||||
height: 400,
|
||||
child: Column(
|
||||
children: [
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../core/responsive/responsive.dart';
|
||||
import 'package:lpinyin/lpinyin.dart';
|
||||
import '../models/product.dart';
|
||||
|
||||
@@ -69,7 +70,7 @@ class _SelectProductDialogState extends State<SelectProductDialog> {
|
||||
return Dialog(
|
||||
shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12)),
|
||||
child: SizedBox(
|
||||
width: 480,
|
||||
width: context.dialogWidth(480),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
|
||||
Reference in New Issue
Block a user