feat: add welcome screen

This commit is contained in:
mso7nueh
2025-04-29 11:42:20 +03:00
parent af63b82f52
commit b74d683e2c
6 changed files with 135 additions and 1 deletions

View File

@@ -53,15 +53,17 @@ import 'package:eatvio_app/features/settings/presentation/pages/pressure_screen.
import 'package:eatvio_app/features/settings/presentation/pages/settings_screen.dart';
import 'package:eatvio_app/features/support/presentation/pages/support_screen.dart';
import 'package:eatvio_app/features/user_details/presentation/user_details_screen.dart';
import 'package:eatvio_app/features/welcome/presentation/pages/welcome_screen.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:go_router/go_router.dart';
import 'package:shared_preferences/shared_preferences.dart';
class AppRouter {
static GlobalKey<NavigatorState> navigatorKey = GlobalKey<NavigatorState>();
static GoRouter appRouter = GoRouter(
initialLocation: '/my-profile-screen',
initialLocation: '/welcome-screen',
navigatorKey: navigatorKey,
routes: [
GoRoute(
@@ -123,6 +125,20 @@ class AppRouter {
),
],
),
GoRoute(
path: '/welcome-screen',
name: 'welcomeScreen',
builder: (context, state) => const WelcomeScreen(),
redirect: (context, state) async {
final sharedPreferences = await SharedPreferences.getInstance();
final welcomeScreenWasShowed = sharedPreferences.getBool('welcomeScreenWasShowed');
if (welcomeScreenWasShowed == true) {
return '/my-profile-screen';
} else {
return null;
}
},
),
GoRoute(
path: '/consultant-finance-screen',
name: 'consultantFinanceScreen',

View File

@@ -0,0 +1,107 @@
import 'package:flutter/material.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:go_router/go_router.dart';
import 'package:lottie/lottie.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../../core/theme/theme_helper.dart';
class WelcomeScreen extends StatelessWidget {
const WelcomeScreen({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Stack(
clipBehavior: Clip.none,
children: [
Positioned(
left: -20,
top: -20,
right: -20,
bottom: -20,
child: Lottie.asset(
'assets/splash/bg.json',
fit: BoxFit.cover,
),
),
Positioned.fill(
child: Column(
crossAxisAlignment: CrossAxisAlignment.center,
children: [
const SizedBox(height: 40),
SvgPicture.asset('assets/images/logo_welcome.svg'),
const Spacer(),
Padding(
padding: const EdgeInsets.all(16),
child: Material(
borderRadius: BorderRadius.circular(14),
color: Colors.white,
child: Padding(
padding: const EdgeInsets.all(16),
child: Column(
children: [
const SizedBox(height: 20),
const Text(
'Добро пожаловать\nв EATVIO! 🚀',
style: TextStyle(
fontSize: 28,
fontWeight: FontWeight.w800,
height: 1,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 16),
const Text(
'Это первая версия приложения, и мы активно работаем над его улучшением. Если вы заметите ошибку или у вас есть идея — пожалуйста, сообщите нам! Ваша помощь бесценна ❤️',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w500,
height: 1,
),
textAlign: TextAlign.center,
),
const SizedBox(height: 32),
Padding(
padding: const EdgeInsets.symmetric(horizontal: 52),
child: InkWell(
onTap: () async {
final sharedPreferences = await SharedPreferences.getInstance();
await sharedPreferences.setBool('welcomeScreenWasShowed', true);
GoRouter.of(context).go('/my-profile-screen');
},
borderRadius: BorderRadius.circular(20),
child: Ink(
height: 52,
decoration: BoxDecoration(
color: appTheme.blueA400,
borderRadius: BorderRadius.circular(20),
),
child: const Center(
child: Text(
'Начать пользоваться',
style: TextStyle(
fontSize: 16,
fontWeight: FontWeight.w600,
height: 1,
color: Colors.white,
),
),
),
),
),
),
const SizedBox(height: 20),
],
),
),
),
),
],
),
),
],
),
);
}
}