refactor(client): widgets 颜色迁移到 context.tokens
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import '../core/responsive/responsive.dart';
|
||||
import '../core/theme/app_theme.dart';
|
||||
import '../core/theme/context_tokens.dart';
|
||||
|
||||
class DataTableCard extends StatefulWidget {
|
||||
final List<DataColumn> columns;
|
||||
@@ -53,7 +53,7 @@ class _DataTableCardState extends State<DataTableCard> {
|
||||
children: [
|
||||
if (widget.toolbar != null)
|
||||
Container(
|
||||
color: AppTheme.surface,
|
||||
color: context.tokens.surface,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 12, vertical: 6),
|
||||
child: widget.toolbar!,
|
||||
),
|
||||
@@ -67,14 +67,14 @@ class _DataTableCardState extends State<DataTableCard> {
|
||||
if (widget.totalCount != null)
|
||||
Container(
|
||||
height: 48,
|
||||
color: AppTheme.surface,
|
||||
color: context.tokens.surface,
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16),
|
||||
child: Row(
|
||||
children: [
|
||||
Text(
|
||||
'共 ${widget.totalCount} 条记录',
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textSecondary),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.muted),
|
||||
),
|
||||
const Spacer(),
|
||||
_PaginationBar(
|
||||
@@ -132,11 +132,11 @@ class _DataTableCardState extends State<DataTableCard> {
|
||||
Widget _buildMobileList() {
|
||||
final cards = widget.mobileCards!;
|
||||
if (cards.isEmpty) {
|
||||
return const Center(
|
||||
return Center(
|
||||
child: Padding(
|
||||
padding: EdgeInsets.all(32),
|
||||
padding: const EdgeInsets.all(32),
|
||||
child: Text('暂无数据',
|
||||
style: TextStyle(color: AppTheme.textSecondary, fontSize: 14)),
|
||||
style: TextStyle(color: context.tokens.muted, fontSize: 14)),
|
||||
),
|
||||
);
|
||||
}
|
||||
@@ -155,10 +155,10 @@ class _DataTableCardState extends State<DataTableCard> {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(horizontal: 16, vertical: 12),
|
||||
child: DefaultTextStyle(
|
||||
style: const TextStyle(
|
||||
style: TextStyle(
|
||||
fontSize: 13,
|
||||
fontWeight: FontWeight.w600,
|
||||
color: AppTheme.primaryDark,
|
||||
color: context.tokens.primaryDark,
|
||||
),
|
||||
child: col.numeric
|
||||
? Align(alignment: Alignment.centerRight, child: col.label)
|
||||
@@ -189,8 +189,8 @@ class _DataTableCardState extends State<DataTableCard> {
|
||||
padding:
|
||||
const EdgeInsets.symmetric(horizontal: 16, vertical: 10),
|
||||
child: DefaultTextStyle(
|
||||
style: const TextStyle(
|
||||
fontSize: 13, color: AppTheme.textPrimary),
|
||||
style: TextStyle(
|
||||
fontSize: 13, color: context.tokens.text),
|
||||
child: cell.child,
|
||||
),
|
||||
),
|
||||
@@ -227,13 +227,13 @@ class _PaginationBar extends StatelessWidget {
|
||||
children: [
|
||||
// 每页条数选择器
|
||||
if (onPageSizeChanged != null) ...[
|
||||
const Text('每页', style: TextStyle(fontSize: 13, color: AppTheme.textSecondary)),
|
||||
Text('每页', style: TextStyle(fontSize: 13, color: context.tokens.muted)),
|
||||
const SizedBox(width: 4),
|
||||
DropdownButtonHideUnderline(
|
||||
child: DropdownButton<int>(
|
||||
value: effectiveSize,
|
||||
isDense: true,
|
||||
style: const TextStyle(fontSize: 13, color: AppTheme.textPrimary),
|
||||
style: TextStyle(fontSize: 13, color: context.tokens.text),
|
||||
items: _pageSizeOptions
|
||||
.map((n) => DropdownMenuItem(value: n, child: Text('$n 条')))
|
||||
.toList(),
|
||||
|
||||
Reference in New Issue
Block a user