release
This commit is contained in:
@@ -25,31 +25,24 @@ class HomePage extends StatefulWidget {
|
||||
State<HomePage> createState() => _HomePageState();
|
||||
}
|
||||
|
||||
class _HomePageState extends State<HomePage>
|
||||
with SingleTickerProviderStateMixin {
|
||||
class _HomePageState extends State<HomePage> {
|
||||
final GlobalKey repaintKey = GlobalKey();
|
||||
final SecondaryButtonsManager _secondaryButtonsManager =
|
||||
SecondaryButtonsManager();
|
||||
final FloatingButtonsVisibilityManager _floatingButtonsVisibilityManager =
|
||||
FloatingButtonsVisibilityManager();
|
||||
final CareController _careController = Get.put(CareController());
|
||||
late AnimationController _animationController;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_secondaryButtonsManager.init();
|
||||
_floatingButtonsVisibilityManager.init();
|
||||
_animationController = AnimationController(
|
||||
duration: const Duration(milliseconds: 300),
|
||||
vsync: this,
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
void dispose() {
|
||||
_floatingButtonsVisibilityManager.dispose();
|
||||
_animationController.dispose();
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
@@ -63,35 +56,14 @@ class _HomePageState extends State<HomePage>
|
||||
return Obx(() {
|
||||
final isDark = themeController.isDarkModeRx.value;
|
||||
|
||||
// 触发动画
|
||||
if (_animationController.status != AnimationStatus.forward) {
|
||||
_animationController.forward(from: 0);
|
||||
}
|
||||
|
||||
// 关怀模式开启时显示关怀页面,添加过渡动画
|
||||
// 关怀模式开启时显示关怀页面
|
||||
if (careController.isCareModeEnabled) {
|
||||
return FadeTransition(
|
||||
opacity: Tween<double>(begin: 0, end: 1).animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
),
|
||||
child: const CarePoetryPage(),
|
||||
);
|
||||
return const CarePoetryPage();
|
||||
}
|
||||
|
||||
return FadeTransition(
|
||||
opacity: Tween<double>(begin: 0, end: 1).animate(
|
||||
CurvedAnimation(
|
||||
parent: _animationController,
|
||||
curve: Curves.easeInOut,
|
||||
),
|
||||
),
|
||||
child: Scaffold(
|
||||
backgroundColor: isDark ? const Color(0xFF121212) : Colors.grey[50],
|
||||
body: SafeArea(child: _buildBody(controller, isDark)),
|
||||
),
|
||||
return Scaffold(
|
||||
backgroundColor: isDark ? const Color(0xFF121212) : Colors.grey[50],
|
||||
body: SafeArea(child: _buildBody(controller, isDark)),
|
||||
);
|
||||
});
|
||||
}
|
||||
@@ -168,10 +140,16 @@ class _HomePageState extends State<HomePage>
|
||||
top: 60,
|
||||
left: 16,
|
||||
right: 16,
|
||||
child: CareModeToggle(
|
||||
isEnabled: _careController.isCareModeEnabled,
|
||||
onToggle: _careController.toggleCareMode,
|
||||
isDark: isDark,
|
||||
child: GestureDetector(
|
||||
onTap: () => _careController.resetAutoHideTimer(),
|
||||
child: CareModeToggle(
|
||||
isEnabled: _careController.isCareModeEnabled,
|
||||
onToggle: () {
|
||||
_careController.resetAutoHideTimer();
|
||||
_careController.toggleCareMode();
|
||||
},
|
||||
isDark: isDark,
|
||||
),
|
||||
),
|
||||
)
|
||||
: const SizedBox.shrink(),
|
||||
|
||||
Reference in New Issue
Block a user