You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
220 lines
6.1 KiB
220 lines
6.1 KiB
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:flutter_screenutil/flutter_screenutil.dart';
|
|
import '../controllers/splash_controller.dart';
|
|
|
|
class SplashView extends GetView<SplashController> {
|
|
const SplashView({Key? key}) : super(key: key);
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
final isDarkMode = Theme.of(context).brightness == Brightness.dark;
|
|
|
|
return Scaffold(
|
|
backgroundColor: isDarkMode ? Colors.black : const Color(0xFFF5F5F7),
|
|
body: Stack(
|
|
children: [
|
|
// 主内容
|
|
Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
// Logo动画
|
|
_buildAnimatedLogo(isDarkMode),
|
|
|
|
// 应用名称
|
|
_buildAppTitle(isDarkMode),
|
|
|
|
// 标语
|
|
_buildSlogan(isDarkMode),
|
|
|
|
// 加载进度条
|
|
SizedBox(height: 40.h),
|
|
_buildLoadingBar(isDarkMode),
|
|
|
|
// 额外信息
|
|
SizedBox(height: 16.h),
|
|
_buildExtraInfo(isDarkMode),
|
|
],
|
|
),
|
|
),
|
|
|
|
// 版本号
|
|
_buildVersionInfo(isDarkMode),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
// 动画Logo
|
|
Widget _buildAnimatedLogo(bool isDarkMode) {
|
|
return TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0.8, end: 1.1),
|
|
duration: const Duration(seconds: 2),
|
|
curve: Curves.easeInOut,
|
|
builder: (context, value, child) {
|
|
// 确保opacity值不超过1.0
|
|
final opacity = value <= 1.0 ? value : 1.0;
|
|
|
|
return Transform.scale(
|
|
scale: value,
|
|
child: AnimatedOpacity(
|
|
opacity: opacity,
|
|
duration: const Duration(milliseconds: 500),
|
|
child: child,
|
|
),
|
|
);
|
|
},
|
|
child: Container(
|
|
width: 96.w,
|
|
height: 96.w,
|
|
decoration: BoxDecoration(
|
|
gradient: const LinearGradient(
|
|
begin: Alignment.topLeft,
|
|
end: Alignment.bottomRight,
|
|
colors: [Colors.blue, Colors.purple],
|
|
),
|
|
borderRadius: BorderRadius.circular(24.r),
|
|
boxShadow: [
|
|
BoxShadow(
|
|
color: Colors.blue.withOpacity(0.3),
|
|
blurRadius: 15,
|
|
offset: const Offset(0, 8),
|
|
spreadRadius: 3,
|
|
),
|
|
],
|
|
),
|
|
child: Icon(
|
|
Icons.headset,
|
|
size: 48.sp,
|
|
color: Colors.white,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
|
|
// 应用标题
|
|
Widget _buildAppTitle(bool isDarkMode) {
|
|
return TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0.0, end: 1.0),
|
|
duration: const Duration(milliseconds: 1500),
|
|
curve: Curves.easeOut,
|
|
builder: (context, value, child) {
|
|
return Opacity(
|
|
opacity: value,
|
|
child: Padding(
|
|
padding: EdgeInsets.only(top: 24.h),
|
|
child: Text(
|
|
'DeepVoice',
|
|
style: TextStyle(
|
|
fontSize: 28.sp,
|
|
fontWeight: FontWeight.bold,
|
|
color: isDarkMode ? Colors.white : Colors.grey[800],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
// 标语
|
|
Widget _buildSlogan(bool isDarkMode) {
|
|
return TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0.0, end: 1.0),
|
|
duration: const Duration(milliseconds: 1500),
|
|
curve: Curves.easeOut,
|
|
builder: (context, value, child) {
|
|
return Opacity(
|
|
opacity: value,
|
|
child: Padding(
|
|
padding: EdgeInsets.only(top: 8.h),
|
|
child: Text(
|
|
'连接世界,岂止声音',
|
|
style: TextStyle(
|
|
fontSize: 14.sp,
|
|
color: isDarkMode ? Colors.grey[400] : Colors.grey[600],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
// 加载进度条
|
|
Widget _buildLoadingBar(bool isDarkMode) {
|
|
return Padding(
|
|
padding: EdgeInsets.symmetric(horizontal: 80.w),
|
|
child: Stack(
|
|
children: [
|
|
Container(
|
|
height: 4.h,
|
|
decoration: BoxDecoration(
|
|
color: isDarkMode ? Colors.grey[800] : Colors.grey[200],
|
|
borderRadius: BorderRadius.circular(2.r),
|
|
),
|
|
),
|
|
Obx(() {
|
|
final progress = controller.loadingProgress;
|
|
return LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
return Container(
|
|
height: 4.h,
|
|
width: constraints.maxWidth * progress,
|
|
decoration: BoxDecoration(
|
|
gradient: const LinearGradient(
|
|
begin: Alignment.centerLeft,
|
|
end: Alignment.centerRight,
|
|
colors: [Colors.blue, Colors.purple],
|
|
),
|
|
borderRadius: BorderRadius.circular(2.r),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}),
|
|
],
|
|
),
|
|
);
|
|
}
|
|
|
|
// 额外信息
|
|
Widget _buildExtraInfo(bool isDarkMode) {
|
|
return TweenAnimationBuilder<double>(
|
|
tween: Tween<double>(begin: 0.0, end: 1.0),
|
|
duration: const Duration(milliseconds: 1500),
|
|
curve: Curves.easeOut,
|
|
builder: (context, value, child) {
|
|
return Opacity(
|
|
opacity: value,
|
|
child: Text(
|
|
'AI语音专家 · 随时随地',
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color: isDarkMode ? Colors.grey[500] : Colors.grey[400],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
);
|
|
}
|
|
|
|
// 版本信息
|
|
Widget _buildVersionInfo(bool isDarkMode) {
|
|
return Positioned(
|
|
bottom: 32.h,
|
|
left: 0,
|
|
right: 0,
|
|
child: Center(
|
|
child: Text(
|
|
controller.version,
|
|
style: TextStyle(
|
|
fontSize: 12.sp,
|
|
color: isDarkMode ? Colors.grey[500] : Colors.grey[400],
|
|
),
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|