更新页面

This commit is contained in:
wyf
2025-04-16 14:27:10 +08:00
parent 146462b467
commit 1765403f21
58 changed files with 7821 additions and 433 deletions

View File

@@ -0,0 +1,45 @@
import 'package:flutter/material.dart';
class ClickableContainer extends StatelessWidget {
final Color backgroundColor; // 容器背景色
final Color highlightColor; // 点击时背景色
final EdgeInsetsGeometry padding; // 内部间距
final VoidCallback onTap; // 点击回调
final Widget child; // 子组件
final double borderRadius; // 容器圆角可选默认为0
const ClickableContainer({
Key? key,
required this.backgroundColor,
required this.highlightColor,
required this.padding,
required this.onTap,
required this.child,
this.borderRadius = 0, // 默认无圆角
}) : super(key: key);
@override
Widget build(BuildContext context) {
return GestureDetector(
onTap: onTap,
child: Material(
color: Colors.transparent,
child: Ink(
decoration: BoxDecoration(
color: backgroundColor,
borderRadius: BorderRadius.circular(borderRadius),
),
child: InkWell(
borderRadius: BorderRadius.circular(borderRadius),
onTap: onTap,
splashColor: highlightColor.withOpacity(0.3), // 点击时的波纹效果
child: Padding(
padding: padding,
child: child, // 内容自适应
),
),
),
),
);
}
}

View File

@@ -5,7 +5,6 @@ class CustomCard extends StatefulWidget {
final VoidCallback onTap; // 点击回调
final List<Color> colors; // 背景颜色列表
final Widget child; // 子组件
final String title; // 标题
final bool enableAnimation; // 是否启用动画效果
final bool enableGradient; // 是否启用渐变
@@ -15,7 +14,6 @@ class CustomCard extends StatefulWidget {
required this.onTap,
required this.colors,
required this.child,
required this.title,
this.enableAnimation = true, // 默认启用动画效果
this.enableGradient = true, // 默认启用渐变效果
}) : super(key: key);

View File

@@ -0,0 +1,37 @@
import 'dart:ui';
import 'package:flutter/material.dart';
class FrostedDialog extends StatelessWidget {
final Widget child;
final double blurSigma;
final Color barrierColor;
const FrostedDialog({
super.key,
required this.child,
this.blurSigma = 5.0,
this.barrierColor = const Color.fromRGBO(0, 0, 0, 0.5),
});
@override
Widget build(BuildContext context) {
return Stack(
children: [
// 毛玻璃背景
BackdropFilter(
filter: ImageFilter.blur(sigmaX: blurSigma, sigmaY: blurSigma),
child: Container(
color: Colors.transparent,
),
),
Dialog(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(20.0),
),
backgroundColor: Colors.transparent, // 背景透明,由 child 自己决定
child: child,
),
],
);
}
}