213 lines
7.9 KiB
Dart
213 lines
7.9 KiB
Dart
import 'package:animated_text_kit/animated_text_kit.dart';
|
|
import 'package:flutter/material.dart';
|
|
import 'package:get/get.dart';
|
|
import 'package:Tripz/constant/colors.dart';
|
|
import 'package:Tripz/constant/info.dart';
|
|
import 'package:Tripz/constant/style.dart';
|
|
|
|
import 'constant/box_name.dart';
|
|
import 'controller/home/splash_screen_controlle.dart';
|
|
import 'main.dart';
|
|
|
|
class SplashScreen extends StatelessWidget {
|
|
final SplashScreenController splashScreenController =
|
|
Get.put(SplashScreenController());
|
|
|
|
SplashScreen({super.key});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return Scaffold(
|
|
body: Container(
|
|
decoration: const BoxDecoration(
|
|
gradient: LinearGradient(
|
|
begin: Alignment.topCenter,
|
|
end: Alignment.bottomCenter,
|
|
colors: [
|
|
AppColor.primaryColor,
|
|
// AppColor.primaryColor,
|
|
AppColor.secondaryColor,
|
|
AppColor.secondaryColor,
|
|
],
|
|
),
|
|
),
|
|
child: Center(
|
|
child: Column(
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
children: [
|
|
GetBuilder<SplashScreenController>(
|
|
builder: (_) {
|
|
return ScaleTransition(
|
|
scale: splashScreenController.animation,
|
|
child: FadeTransition(
|
|
opacity: splashScreenController.animation,
|
|
child: Column(
|
|
children: [
|
|
DefaultTextStyle(
|
|
style: AppStyle.headTitle.copyWith(
|
|
color: AppColor.primaryColor,
|
|
fontSize: 48,
|
|
fontWeight: FontWeight.bold,
|
|
),
|
|
child: AnimatedTextKit(
|
|
animatedTexts: [
|
|
WavyAnimatedText(
|
|
AppInformation.appName,
|
|
speed: const Duration(milliseconds: 200),
|
|
),
|
|
],
|
|
isRepeatingAnimation: false,
|
|
onFinished: () {
|
|
// Trigger any additional animations here
|
|
},
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
DefaultTextStyle(
|
|
style: AppStyle.title.copyWith(
|
|
color: AppColor.writeColor.withOpacity(0.8),
|
|
fontSize: 18,
|
|
),
|
|
child: AnimatedTextKit(
|
|
animatedTexts: [
|
|
TyperAnimatedText(
|
|
'Your Journey Begins Here'.tr,
|
|
speed: const Duration(milliseconds: 100),
|
|
),
|
|
],
|
|
isRepeatingAnimation: false,
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
);
|
|
},
|
|
),
|
|
Padding(
|
|
padding:
|
|
const EdgeInsets.symmetric(horizontal: 40, vertical: 20),
|
|
child: Column(
|
|
children: [
|
|
Obx(() => LinearProgressIndicator(
|
|
value: splashScreenController.progress.value,
|
|
backgroundColor: AppColor.writeColor.withOpacity(0.2),
|
|
valueColor: AlwaysStoppedAnimation<Color>(
|
|
AppColor.primaryColor),
|
|
minHeight: 3,
|
|
)),
|
|
const SizedBox(height: 16),
|
|
Text(
|
|
'Version: ${box.read(BoxName.packagInfo) ?? '1.0.0'}',
|
|
style: AppStyle.subtitle.copyWith(
|
|
color: AppColor.writeColor.withOpacity(0.6),
|
|
),
|
|
),
|
|
const SizedBox(height: 20),
|
|
],
|
|
),
|
|
),
|
|
],
|
|
),
|
|
),
|
|
),
|
|
bottomNavigationBar: Padding(
|
|
padding: const EdgeInsets.only(bottom: 16.0),
|
|
child: Text(
|
|
'Version: ${box.read(BoxName.packagInfo) ?? '1.0.0'}',
|
|
style: AppStyle.subtitle.copyWith(
|
|
color: AppColor.writeColor.withOpacity(0.6),
|
|
),
|
|
textAlign: TextAlign.center,
|
|
),
|
|
),
|
|
);
|
|
}
|
|
}
|
|
// class SplashScreen extends StatelessWidget {
|
|
// final SplashScreenController splashScreenController =
|
|
// Get.put(SplashScreenController());
|
|
|
|
// SplashScreen({super.key});
|
|
|
|
// @override
|
|
// Widget build(BuildContext context) {
|
|
// return Scaffold(
|
|
// // Using a Container with BoxDecoration for gradient background
|
|
// body: Container(
|
|
// decoration: const BoxDecoration(
|
|
// gradient: LinearGradient(
|
|
// begin: Alignment.topCenter,
|
|
// end: Alignment.bottomCenter,
|
|
// colors: [
|
|
// AppColor.primaryColor,
|
|
// AppColor.secondaryColor,
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// child: Center(
|
|
// child: Column(
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
// children: [
|
|
// GetBuilder<SplashScreenController>(
|
|
// builder: (_) {
|
|
// return ScaleTransition(
|
|
// scale: splashScreenController.animation,
|
|
// child: FadeTransition(
|
|
// opacity: splashScreenController.animation,
|
|
// child: Image.asset(
|
|
// 'assets/images/logo.gif',
|
|
// width: Get.width * 0.4, // Slightly smaller logo
|
|
// ),
|
|
// ),
|
|
// );
|
|
// },
|
|
// ),
|
|
// const SizedBox(height: 20),
|
|
// DefaultTextStyle(
|
|
// style: AppStyle.headTitle2.copyWith(color: AppColor.writeColor),
|
|
// textAlign: TextAlign.center,
|
|
// child: AnimatedTextKit(
|
|
// animatedTexts: [
|
|
// FadeAnimatedText(AppInformation.appName,
|
|
// duration: const Duration(milliseconds: 1000)),
|
|
// ],
|
|
// isRepeatingAnimation: false, // Only animate once
|
|
// pause: const Duration(milliseconds: 500),
|
|
// ),
|
|
// ),
|
|
// const SizedBox(height: 8),
|
|
// DefaultTextStyle(
|
|
// style: AppStyle.title
|
|
// .copyWith(color: AppColor.writeColor.withOpacity(0.8)),
|
|
// textAlign: TextAlign.center,
|
|
// child: AnimatedTextKit(
|
|
// animatedTexts: [
|
|
// FadeAnimatedText('Powered By ${AppInformation.appName}',
|
|
// duration: const Duration(milliseconds: 1000)),
|
|
// ],
|
|
// isRepeatingAnimation: false, // Only animate once
|
|
// pause: const Duration(milliseconds: 500),
|
|
// ),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// ),
|
|
// bottomNavigationBar: Padding(
|
|
// padding: const EdgeInsets.only(bottom: 16.0),
|
|
// child: Row(
|
|
// mainAxisAlignment: MainAxisAlignment.center,
|
|
// children: [
|
|
// Text(
|
|
// 'Version: ${box.read(BoxName.packagInfo) ?? '1.0.0'}', // More descriptive label
|
|
// style: AppStyle.subtitle
|
|
// .copyWith(color: AppColor.writeColor.withOpacity(0.6)),
|
|
// ),
|
|
// ],
|
|
// ),
|
|
// ),
|
|
// );
|
|
// }
|
|
// }
|