关怀模式

This commit is contained in:
Developer
2026-04-02 22:30:49 +08:00
parent 09fee0694c
commit 7872f2e78a
70 changed files with 4884 additions and 2752 deletions

View File

@@ -1,8 +1,9 @@
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import '../../../constants/app_constants.dart';
import '../../../services/get/theme_controller.dart';
/// 流动边框装饰器
class FlowingBorderDecoration extends Decoration {
@@ -61,7 +62,7 @@ class _FlowingBorderPainter extends BoxPainter {
class FlowingBorderContainer extends StatefulWidget {
final Widget child;
final Duration duration;
final Color color;
final Color? color;
final double width;
final bool autoStart;
@@ -69,7 +70,7 @@ class FlowingBorderContainer extends StatefulWidget {
super.key,
required this.child,
this.duration = const Duration(seconds: 10),
this.color = AppConstants.primaryColor,
this.color,
this.width = 4.0,
this.autoStart = true,
});
@@ -82,6 +83,7 @@ class _FlowingBorderContainerState extends State<FlowingBorderContainer>
with SingleTickerProviderStateMixin {
late AnimationController _controller;
late Animation<double> _animation;
final ThemeController _themeController = Get.find<ThemeController>();
@override
void initState() {
@@ -105,19 +107,22 @@ class _FlowingBorderContainerState extends State<FlowingBorderContainer>
@override
Widget build(BuildContext context) {
return AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Container(
padding: EdgeInsets.all(widget.width),
decoration: FlowingBorderDecoration(
animation: _animation,
color: widget.color,
width: widget.width,
),
child: widget.child,
);
},
);
return Obx(() {
final color = widget.color ?? _themeController.currentThemeColor;
return AnimatedBuilder(
animation: _animation,
builder: (context, child) {
return Container(
padding: EdgeInsets.all(widget.width),
decoration: FlowingBorderDecoration(
animation: _animation,
color: color,
width: widget.width,
),
child: widget.child,
);
},
);
});
}
}