Merge branch 'main' of hiddify-github:hiddify/hiddify-next
This commit is contained in:
@@ -15,3 +15,5 @@ abstract class Constants {
|
||||
static const cfWarpTermsOfService =
|
||||
"https://www.cloudflare.com/application/terms/";
|
||||
}
|
||||
|
||||
const kAnimationDuration = Duration(milliseconds: 250);
|
||||
|
||||
53
lib/core/widget/animated_text.dart
Normal file
53
lib/core/widget/animated_text.dart
Normal file
@@ -0,0 +1,53 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:hiddify/core/model/constants.dart';
|
||||
|
||||
class AnimatedText extends Text {
|
||||
const AnimatedText(
|
||||
super.data, {
|
||||
super.key,
|
||||
super.style,
|
||||
this.duration = kAnimationDuration,
|
||||
this.size = true,
|
||||
this.slide = true,
|
||||
});
|
||||
|
||||
final Duration duration;
|
||||
final bool size;
|
||||
final bool slide;
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return AnimatedSwitcher(
|
||||
duration: duration,
|
||||
transitionBuilder: (child, animation) {
|
||||
child = FadeTransition(
|
||||
opacity: animation,
|
||||
child: child,
|
||||
);
|
||||
if (size) {
|
||||
child = SizeTransition(
|
||||
axis: Axis.horizontal,
|
||||
fixedCrossAxisSizeFactor: 1,
|
||||
sizeFactor: Tween<double>(begin: 0.88, end: 1).animate(animation),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
if (slide) {
|
||||
child = SlideTransition(
|
||||
position: Tween<Offset>(
|
||||
begin: const Offset(0.0, -0.2),
|
||||
end: Offset.zero,
|
||||
).animate(animation),
|
||||
child: child,
|
||||
);
|
||||
}
|
||||
return child;
|
||||
},
|
||||
child: Text(
|
||||
data!,
|
||||
key: ValueKey<String>(data!),
|
||||
style: style,
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
10
lib/core/widget/spaced_list_widget.dart
Normal file
10
lib/core/widget/spaced_list_widget.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'package:flutter/widgets.dart';
|
||||
|
||||
extension SpacedWidgets on List<Widget> {
|
||||
List<Widget> spaceBy({double? width, double? height}) => [
|
||||
for (int i = 0; i < length; i++) ...[
|
||||
if (i > 0) SizedBox(width: width, height: height),
|
||||
this[i],
|
||||
],
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user