refactor(apps): 主题系统迁移至 ColorScheme + 扩展架构并支持 Dark Mode
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
import '../../core/theme/design_tokens.dart';
|
||||
|
||||
class AppPressable extends StatefulWidget {
|
||||
const AppPressable({
|
||||
super.key,
|
||||
@@ -25,25 +23,22 @@ class _AppPressableState extends State<AppPressable> {
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
final colorScheme = Theme.of(context).colorScheme;
|
||||
return AnimatedScale(
|
||||
scale: _isPressed ? widget.pressedScale : 1,
|
||||
duration: const Duration(milliseconds: 110),
|
||||
curve: Curves.easeOut,
|
||||
child: Material(
|
||||
color: Colors.transparent,
|
||||
color: colorScheme.surface.withValues(alpha: 0),
|
||||
child: InkWell(
|
||||
borderRadius: widget.borderRadius,
|
||||
onTap: widget.onTap,
|
||||
onHighlightChanged: (pressed) {
|
||||
if (_isPressed == pressed) {
|
||||
return;
|
||||
}
|
||||
setState(() {
|
||||
_isPressed = pressed;
|
||||
});
|
||||
if (_isPressed == pressed) return;
|
||||
setState(() => _isPressed = pressed);
|
||||
},
|
||||
splashColor: AppColors.blue100.withValues(alpha: 0.32),
|
||||
highlightColor: AppColors.blue50.withValues(alpha: 0.28),
|
||||
splashColor: colorScheme.primary.withValues(alpha: 0.12),
|
||||
highlightColor: colorScheme.primary.withValues(alpha: 0.08),
|
||||
child: widget.child,
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user