diff --git a/assets/images/logo_welcome.svg b/assets/images/logo_welcome.svg new file mode 100644 index 00000000..37102693 --- /dev/null +++ b/assets/images/logo_welcome.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/assets/splash/bg.json b/assets/splash/bg.json new file mode 100644 index 00000000..4e4acd76 --- /dev/null +++ b/assets/splash/bg.json @@ -0,0 +1 @@ +{"nm":"background","ddd":0,"h":1920,"w":1080,"meta":{"g":"@lottiefiles/toolkit-js 0.33.2"},"layers":[{"ty":4,"nm":"Shape Layer 1","sr":1,"st":0,"op":155,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[0,0,0]},"s":{"a":0,"k":[100,100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[540,960,0]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}},"ef":[],"shapes":[{"ty":"gr","bm":0,"hd":false,"mn":"ADBE Vector Group","nm":"Rectangle 1","ix":1,"cix":2,"np":3,"it":[{"ty":"rc","bm":0,"hd":false,"mn":"ADBE Vector Shape - Rect","nm":"Rectangle Path 1","d":1,"p":{"a":0,"k":[0,0]},"r":{"a":0,"k":0},"s":{"a":0,"k":[1160,880]}},{"ty":"st","bm":0,"hd":false,"mn":"ADBE Vector Graphic - Stroke","nm":"Stroke 1","lc":1,"lj":1,"ml":4,"o":{"a":0,"k":100},"w":{"a":0,"k":6},"c":{"a":0,"k":[1,1,1]}},{"ty":"gf","bm":0,"hd":false,"mn":"ADBE Vector Graphic - G-Fill","nm":"Gradient Fill 1","e":{"a":1,"k":[{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[374.412,342.611],"t":0},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[22.822,357.191],"t":31},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[-420.714,389.994],"t":61},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[50.932,404.573],"t":91},{"s":[376.797,364.48],"t":120}]},"g":{"p":3,"k":{"a":1,"k":[{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[0,0.00784313725490196,0.4392156862745098,1,0.5,0.10196078431372549,0.4666666666666667,0.9411764705882353,1,0.9490196078431372,0.9490196078431372,0.9490196078431372],"t":0},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[0,0.3411764705882353,0.6039215686274509,0.9411764705882353,0.5,0.0392156862745098,0.4549019607843137,1,1,0.1568627450980392,0.42745098039215684,0.8823529411764706],"t":31},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[0,0.3176470588235294,0.5568627450980392,0.8666666666666667,0.5,0.6392156862745098,0.796078431372549,1,1,1,1,1],"t":61},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[0,0.1843137254901961,0.5019607843137255,0.9294117647058824,0.5,0.0784313725490196,0.596078431372549,0.7529411764705882,1,0,0.43529411764705883,1],"t":91},{"s":[0,0.00784313725490196,0.4392156862745098,1,0.5,0.5686274509803921,0.7411764705882353,0.9686274509803922,1,0.29411764705882354,0.5529411764705883,0.8862745098039215],"t":120}]}},"t":1,"a":{"a":0,"k":0},"h":{"a":0,"k":0},"s":{"a":1,"k":[{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[-430.769,-404.573],"t":0},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[23.726,-364.48],"t":31},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[312.726,-353.48],"t":61},{"o":{"x":0.167,"y":0.167},"i":{"x":0.833,"y":0.833},"s":[29.739,-353.48],"t":91},{"s":[-407.606,-357.125],"t":120}]},"r":1,"o":{"a":0,"k":100}},{"ty":"tr","a":{"a":0,"k":[0,0],"ix":1},"s":{"a":0,"k":[93.29,219.491],"ix":3},"sk":{"a":0,"k":0,"ix":4},"p":{"a":0,"k":[0,0],"ix":2},"r":{"a":0,"k":0,"ix":6},"sa":{"a":0,"k":0,"ix":5},"o":{"a":0,"k":100,"ix":7}}]}],"ind":1},{"ty":1,"nm":"Deep Red Solid 1","sr":1,"st":0,"op":155,"ip":0,"hd":false,"ddd":0,"bm":0,"hasMask":false,"ao":0,"ks":{"a":{"a":0,"k":[540,960,0]},"s":{"a":0,"k":[100,100,100]},"sk":{"a":0,"k":0},"p":{"a":0,"k":[540,960,0]},"r":{"a":0,"k":0},"sa":{"a":0,"k":0},"o":{"a":0,"k":100}},"ef":[],"sc":"#5095ef","sh":1920,"sw":1080,"ind":2}],"v":"4.6.10","fr":15,"op":155,"ip":0,"assets":[]} \ No newline at end of file diff --git a/assets/splash/bg.lottie b/assets/splash/bg.lottie new file mode 100644 index 00000000..b6974b15 Binary files /dev/null and b/assets/splash/bg.lottie differ diff --git a/lib/core/app_router.dart b/lib/core/app_router.dart index 58ccde6e..0e8cd579 100644 --- a/lib/core/app_router.dart +++ b/lib/core/app_router.dart @@ -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 navigatorKey = GlobalKey(); 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', diff --git a/lib/features/welcome/presentation/pages/welcome_screen.dart b/lib/features/welcome/presentation/pages/welcome_screen.dart new file mode 100644 index 00000000..d04528db --- /dev/null +++ b/lib/features/welcome/presentation/pages/welcome_screen.dart @@ -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), + ], + ), + ), + ), + ), + ], + ), + ), + ], + ), + ); + } +} diff --git a/pubspec.yaml b/pubspec.yaml index 28097a40..bce4371f 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -67,6 +67,7 @@ dependencies: http_parser: ^4.1.2 path: ^1.9.0 collection: ^1.19.0 + shared_preferences: ^2.5.3 dependency_overrides: intl: ^0.19.0