refactor(apps): 主题系统迁移至 ColorScheme + 扩展架构并支持 Dark Mode
This commit is contained in:
@@ -42,10 +42,13 @@ class _BackButtonState extends State<BackButton> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final background = _isPressed ? AppColors.surfaceInfo : AppColors.white;
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
final background = _isPressed
|
||||
? colorScheme.secondaryContainer
|
||||
: colorScheme.surface;
|
||||
final borderColor = _isPressed
|
||||
? AppColors.borderQuaternary
|
||||
: AppColors.borderTertiary;
|
||||
? colorScheme.outlineVariant
|
||||
: colorScheme.outline;
|
||||
|
||||
return AnimatedScale(
|
||||
scale: _isPressed ? 0.96 : 1,
|
||||
@@ -60,13 +63,13 @@ class _BackButtonState extends State<BackButton> {
|
||||
boxShadow: _isPressed
|
||||
? const []
|
||||
: [
|
||||
const BoxShadow(
|
||||
color: AppColors.white,
|
||||
BoxShadow(
|
||||
color: colorScheme.surface,
|
||||
blurRadius: AppRadius.sm,
|
||||
offset: Offset(0, -1),
|
||||
offset: const Offset(0, -1),
|
||||
),
|
||||
BoxShadow(
|
||||
color: AppColors.slate200.withValues(alpha: 0.42),
|
||||
color: colorScheme.shadow.withValues(alpha: 0.42),
|
||||
blurRadius: AppRadius.md,
|
||||
offset: const Offset(0, AppSpacing.xs),
|
||||
),
|
||||
@@ -76,39 +79,29 @@ class _BackButtonState extends State<BackButton> {
|
||||
width: AppSpacing.xl * 2,
|
||||
height: AppSpacing.xl * 2,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
color: colorScheme.surface.withValues(alpha: 0),
|
||||
child: InkWell(
|
||||
borderRadius: BorderRadius.circular(AppRadius.full),
|
||||
onTap: widget.onPressed ?? () => Navigator.of(context).pop(),
|
||||
onTapDown: (_) {
|
||||
if (_isPressed) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_isPressed = true;
|
||||
});
|
||||
if (_isPressed) return;
|
||||
setState(() => _isPressed = true);
|
||||
},
|
||||
onTapCancel: () {
|
||||
if (!_isPressed) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_isPressed = false;
|
||||
});
|
||||
if (!_isPressed) return;
|
||||
setState(() => _isPressed = false);
|
||||
},
|
||||
onTapUp: (_) {
|
||||
if (!_isPressed) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_isPressed = false;
|
||||
});
|
||||
if (!_isPressed) return;
|
||||
setState(() => _isPressed = false);
|
||||
},
|
||||
child: Center(
|
||||
child: Icon(
|
||||
Icons.chevron_left,
|
||||
size: AppSpacing.lg + AppSpacing.xs,
|
||||
color: _isPressed ? AppColors.blue600 : AppColors.slate700,
|
||||
color: _isPressed
|
||||
? colorScheme.primary
|
||||
: colorScheme.onSurfaceVariant,
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user