refactored welcome string to splash screen

This commit is contained in:
asif
2025-08-30 15:37:18 +05:30
parent 4277ca9169
commit 768d312066
2 changed files with 9 additions and 27 deletions

View File

@@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:kmobile/features/auth/screens/mpin_screen.dart'; import 'package:kmobile/features/auth/screens/mpin_screen.dart';
import 'package:kmobile/features/auth/screens/splash_screen.dart';
import '../app.dart'; import '../app.dart';
import '../features/auth/screens/login_screen.dart'; import '../features/auth/screens/login_screen.dart';
// import '../features/auth/screens/forgot_password_screen.dart'; // import '../features/auth/screens/forgot_password_screen.dart';

View File

@@ -1,70 +1,51 @@
import '../../../l10n/app_localizations.dart'; import '../../../l10n/app_localizations.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'dart:async';
class WelcomeScreen extends StatefulWidget { class SplashScreen extends StatefulWidget {
final VoidCallback onContinue; const SplashScreen({super.key});
const WelcomeScreen({super.key, required this.onContinue});
@override @override
State<WelcomeScreen> createState() => _WelcomeScreenState(); State<SplashScreen> createState() => _SplashScreenState();
} }
class _WelcomeScreenState extends State<WelcomeScreen> { class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
super.initState();
// Automatically go to logizn after 4 seconds
Timer(const Duration(seconds: 4), () {
widget.onContinue();
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Scaffold( return Scaffold(
body: Stack( body: Stack(
children: [ children: [
/// 🔹 Background Image
Positioned.fill( Positioned.fill(
child: Image.asset( child: Image.asset(
'assets/images/kconnect2.webp', 'assets/images/kconnect2.webp',
fit: BoxFit.cover, fit: BoxFit.cover,
), ),
), ),
/// 🔹 Centered Text Overlay
Center( Center(
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, mainAxisSize: MainAxisSize.min,
children: [ children: [
Text( Text(
AppLocalizations.of(context).kconnect, AppLocalizations.of(context).kconnect,
style: TextStyle( style: const TextStyle(
fontSize: 36, fontSize: 36,
fontWeight: FontWeight.bold, fontWeight: FontWeight.bold,
color: Theme.of(context).dialogBackgroundColor, color: Color(0xFFFFFFFF),
letterSpacing: 1.5,
), ),
), ),
const SizedBox(height: 12), const SizedBox(height: 12),
Text( Text(
AppLocalizations.of(context).kccBankFull, AppLocalizations.of(context).kccBankFull,
textAlign: TextAlign.center, textAlign: TextAlign.center,
style: TextStyle( style: const TextStyle(
fontSize: 18, fontSize: 18,
color: Theme.of(context).dialogBackgroundColor, color: Color(0xFFFFFFFF),
letterSpacing: 1.2, letterSpacing: 1.2,
), ),
), ),
], ],
), ),
), ),
/// 🔹 Loading Spinner at Bottom
Positioned( Positioned(
bottom: 40, bottom: 40,
left: 0, left: 0,