diff --git a/assets/images/sp1.png b/assets/images/sp1.png index 0a25f47..eb272fb 100644 Binary files a/assets/images/sp1.png and b/assets/images/sp1.png differ diff --git a/assets/images/sp2.png b/assets/images/sp2.png index 87acc50..6c3da6a 100644 Binary files a/assets/images/sp2.png and b/assets/images/sp2.png differ diff --git a/assets/images/sp3.png b/assets/images/sp3.png index ea4973b..1ccd7da 100644 Binary files a/assets/images/sp3.png and b/assets/images/sp3.png differ diff --git a/assets/images/sp4.png b/assets/images/sp4.png index 1113bc1..7b2f818 100644 Binary files a/assets/images/sp4.png and b/assets/images/sp4.png differ diff --git a/assets/images/sp5.png b/assets/images/sp5.png index 72c7c02..f26d001 100644 Binary files a/assets/images/sp5.png and b/assets/images/sp5.png differ diff --git a/assets/images/sp6.png b/assets/images/sp6.png new file mode 100644 index 0000000..5304e99 Binary files /dev/null and b/assets/images/sp6.png differ diff --git a/lib/components/loading.dart b/lib/components/loading.dart index eb0325c..297dbea 100644 --- a/lib/components/loading.dart +++ b/lib/components/loading.dart @@ -2,16 +2,20 @@ import 'package:flutter/material.dart'; import 'package:loading_animation_widget/loading_animation_widget.dart'; class Loading extends StatelessWidget { - const Loading({Key? key, required this.color}) : super(key: key); + const Loading({ + Key? key, + required this.color, + required this.kSize, + }) : super(key: key); final Color color; - final double _kSize = 100; + final double kSize; @override Widget build(BuildContext context) { return Center( child: LoadingAnimationWidget.hexagonDots( color: color, - size: _kSize, + size: kSize, ), ); } diff --git a/lib/constants/colors.dart b/lib/constants/colors.dart index 23c65c8..c9270ab 100644 --- a/lib/constants/colors.dart +++ b/lib/constants/colors.dart @@ -3,7 +3,27 @@ import 'package:flutter/material.dart'; const primaryColor = Color(0XFF8DC73F); var litePrimary = const Color(0XFF8DC73F).withOpacity(0.5); -// import 'package:flutter/material.dart'; -// -// const primaryColor = Color(0XFFC32E34); -// var litePrimary = const Color(0XFFC32E34).withOpacity(0.5); \ No newline at end of file + +var titleStyle1 = const TextStyle( + color: primaryColor, + fontWeight: FontWeight.bold, + fontSize: 28, +); + +var titleStyle2 = const TextStyle( + color: Colors.white, + fontWeight: FontWeight.bold, + fontSize: 28, +); + +var contentStyle1 = const TextStyle( + color: primaryColor, + fontWeight: FontWeight.w400, + fontSize: 18, +); + +var contentStyle2 = const TextStyle( + color: Colors.white, + fontWeight: FontWeight.w400, + fontSize: 18, +); \ No newline at end of file diff --git a/lib/controllers/routes.dart b/lib/controllers/routes.dart index 2e6eb55..1a4ebc0 100644 --- a/lib/controllers/routes.dart +++ b/lib/controllers/routes.dart @@ -2,9 +2,13 @@ import 'package:multivendor_shop/views/auth/customer_auth.dart'; import 'package:multivendor_shop/views/auth/forgot_password.dart'; import '../views/auth/account_type_selector.dart'; +import '../views/splash/entry.dart'; +import '../views/splash/splash.dart'; var routes = { CustomerAuth.routeName: (context) => const CustomerAuth(), ForgotPassword.routeName: (context) => const ForgotPassword(), - AccountTypeSelector.routeName: (context) => const AccountTypeSelector() + AccountTypeSelector.routeName: (context) => const AccountTypeSelector(), + SplashScreen.routeName:(context)=>const SplashScreen(), + EntryScreen.routeName:(context)=> const EntryScreen() }; diff --git a/lib/main.dart b/lib/main.dart index 469d4b7..de66095 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,8 +1,8 @@ +import 'dart:async'; +import 'package:firebase_auth/firebase_auth.dart'; import 'package:firebase_core/firebase_core.dart'; import 'package:flutter/material.dart'; -import 'package:multivendor_shop/views/auth/account_type_selector.dart'; -import 'package:multivendor_shop/views/auth/customer_auth.dart'; - +import 'package:multivendor_shop/views/splash/entry.dart'; import 'controllers/routes.dart'; import 'firebase_options.dart'; @@ -16,16 +16,25 @@ Future main() async { ); } -class MultiVendor extends StatelessWidget { +class MultiVendor extends StatefulWidget { const MultiVendor({Key? key}) : super(key: key); + @override + State createState() => _MultiVendorState(); +} + +class _MultiVendorState extends State { + + + + @override Widget build(BuildContext context) { return MaterialApp( title: 'MultiVendor App', theme: ThemeData(fontFamily: 'Roboto'), debugShowCheckedModeBanner: false, - home: const AccountTypeSelector(), + home: const EntryScreen(), routes: routes, ); } diff --git a/lib/models/item_data.dart b/lib/models/item_data.dart new file mode 100644 index 0000000..b47ffb6 --- /dev/null +++ b/lib/models/item_data.dart @@ -0,0 +1,21 @@ +import 'package:flutter/material.dart'; + +class ItemData { + final Color color; + final String image; + final String title; + final String content; + final TextStyle titleStyle; + final TextStyle contentStyle; + final Color btnColor; + + ItemData( + this.color, + this.image, + this.title, + this.content, + this.contentStyle, + this.titleStyle, + this.btnColor, + ); +} diff --git a/lib/views/auth/customer_auth.dart b/lib/views/auth/customer_auth.dart index 7d7ba19..49b1637 100644 --- a/lib/views/auth/customer_auth.dart +++ b/lib/views/auth/customer_auth.dart @@ -252,7 +252,6 @@ class _CustomerAuthState extends State { firebase.collection('users').doc(credential.user!.uid).set({ 'fullname': _fullnameController.text.trim(), 'email': _emailController.text.trim(), - 'password': _passwordController.text.trim(), 'image': downloadUrl }); isLoadingFnc(); @@ -429,7 +428,12 @@ class _CustomerAuthState extends State { ), const SizedBox(height: 20), isLoading - ? const Center(child: Loading(color:primaryColor)) + ? const Center( + child: Loading( + color: primaryColor, + kSize: 100, + ), + ) : Form( key: _formKey, child: Column( diff --git a/lib/views/splash/entry.dart b/lib/views/splash/entry.dart new file mode 100644 index 0000000..e2e32bf --- /dev/null +++ b/lib/views/splash/entry.dart @@ -0,0 +1,82 @@ +import 'dart:async'; +import 'package:firebase_auth/firebase_auth.dart'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:is_first_run/is_first_run.dart'; +import 'package:multivendor_shop/views/splash/splash.dart'; +import '../../components/loading.dart'; +import '../../constants/colors.dart'; +import '../auth/account_type_selector.dart'; + +class EntryScreen extends StatefulWidget { + static const routeName = '/entry-screen'; + + const EntryScreen({Key? key}) : super(key: key); + + @override + State createState() => _EntryScreenState(); +} + +class _EntryScreenState extends State { + _startRun() async { + bool ifr = await IsFirstRun.isFirstRun(); + var duration = const Duration(seconds: 5); + if (ifr != null && !ifr) { + Timer(duration, _navigateToAuthOrHome); + // Timer(duration, _navigateToSplash); + } else { + Timer(duration, _navigateToSplash); + } + } + + _navigateToSplash() { + // Routing to Splash + Navigator.of(context).pushNamed(SplashScreen.routeName); + } + + _navigateToAuthOrHome() { + //Routing to Account Selection Type or Home + FirebaseAuth.instance.authStateChanges().listen((User? user) { + if (user != null) { + // home screen + Navigator.of(context).pushNamed(''); + } else { + // auth screen + Navigator.of(context).pushNamed(AccountTypeSelector.routeName); + } + }); + } + + @override + void initState() { + super.initState(); + _startRun(); + } + + @override + Widget build(BuildContext context) { + SystemChrome.setSystemUIOverlayStyle( + SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + systemNavigationBarColor: litePrimary, + statusBarIconBrightness: Brightness.dark, + systemNavigationBarDividerColor: Colors.grey, + statusBarBrightness: Brightness.dark, + ), + ); + return Scaffold( + body: Container( + constraints: const BoxConstraints.expand(), + color: primaryColor, + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset('assets/images/logo1.png'), + const SizedBox(height: 10), + const Loading(color: Colors.white,kSize: 40,), + ], + ), + ), + ); + } +} diff --git a/lib/views/splash/splash.dart b/lib/views/splash/splash.dart new file mode 100644 index 0000000..0daf0a7 --- /dev/null +++ b/lib/views/splash/splash.dart @@ -0,0 +1,253 @@ +import 'dart:math'; +import 'package:flutter/material.dart'; +import 'package:flutter/services.dart'; +import 'package:liquid_swipe/liquid_swipe.dart'; +import 'package:multivendor_shop/models/item_data.dart'; +import '../../constants/colors.dart'; +import '../auth/account_type_selector.dart'; + +class SplashScreen extends StatefulWidget { + static const routeName = '/splash-screen'; + + const SplashScreen({Key? key}) : super(key: key); + + @override + State createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State { + int page = 0; + late LiquidController liquidController; + + final List pages = [ + ItemData( + primaryColor, + 'assets/images/sp5.png', + 'Multivendz', + 'A place to find the best', + contentStyle2, + titleStyle2, + Colors.white, + ), + ItemData( + Colors.white, + 'assets/images/sp2.png', + 'Swift checkouts', + 'Ensuring swift checkouts', + contentStyle1, + titleStyle1, + primaryColor, + ), + ItemData( + primaryColor, + 'assets/images/sp3.png', + 'Easy buy', + 'We\'ve made the process friendly', + contentStyle2, + titleStyle2, + Colors.white, + ), + ItemData( + Colors.white, + 'assets/images/sp4.png', + 'Wholesome happiness', + 'We\'ll make your happiness a priority', + contentStyle1, + titleStyle1, + primaryColor, + ), + ItemData( + primaryColor, + 'assets/images/sp6.png', + 'We deliver', + 'Packages at your door step', + contentStyle2, + titleStyle2, + Colors.white, + ), + ItemData( + Colors.white, + 'assets/images/sp1.png', + 'Box in', + 'Let\'s make it easy for you', + contentStyle1, + titleStyle1, + primaryColor, + ), + ]; + + pageChangeCallback(int lpage) { + setState(() { + page = lpage; + }); + } + + Widget _buildDot(int index) { + double select = Curves.easeOut.transform( + max(0.0, 1.0 - (page - index).abs()), + ); + double zoom = 1.0 + (2.0 - 1.0) * select; + return SizedBox( + width: 25.0, + child: Center( + child: Material( + color: pages[page].btnColor, + type: MaterialType.circle, + child: SizedBox( + width: 8.0 * zoom, + height: 8.0 * zoom, + ), + ), + ), + ); + } + + @override + void initState() { + liquidController = LiquidController(); + super.initState(); + } + + @override + Widget build(BuildContext context) { + SystemChrome.setSystemUIOverlayStyle( + SystemUiOverlayStyle( + statusBarColor: Colors.transparent, + systemNavigationBarColor: litePrimary, + statusBarIconBrightness: Brightness.dark, + systemNavigationBarDividerColor: Colors.grey, + statusBarBrightness: Brightness.dark, + ), + ); + + return Scaffold( + body: Stack( + children: [ + LiquidSwipe.builder( + itemCount: pages.length, + itemBuilder: (context, index) { + return Container( + width: double.infinity, + color: pages[index].color, + child: Column( + crossAxisAlignment: CrossAxisAlignment.center, + mainAxisSize: MainAxisSize.max, + mainAxisAlignment: MainAxisAlignment.center, + children: [ + Image.asset( + pages[index].image, + height: 400, + fit: BoxFit.contain, + ), + Column( + children: [ + Text( + pages[index].title, + style: pages[index].titleStyle, + ), + const SizedBox(height: 10), + Text( + pages[index].content, + style: pages[index].contentStyle, + ), + page == pages.length - 1 + ? Directionality( + textDirection: TextDirection.rtl, + child: ElevatedButton.icon( + style: ElevatedButton.styleFrom( + primary: primaryColor, + shape: RoundedRectangleBorder( + borderRadius: BorderRadius.circular(20), + ), + padding: const EdgeInsets.all(15), + ), + icon: const Icon( + Icons.chevron_left, + color: Colors.white, + ), + onPressed: () => + Navigator.of(context).pushNamed( + AccountTypeSelector.routeName, + ), + label: const Text( + 'Get started', + style: TextStyle( + color: Colors.white, + ), + ), + ), + ) + : const SizedBox.shrink() + ], + ), + ], + ), + ); + }, + slideIconWidget: Icon( + Icons.arrow_back_ios, + color: pages[page].color, + ), + onPageChangeCallback: pageChangeCallback, + waveType: WaveType.liquidReveal, + liquidController: liquidController, + enableSideReveal: true, + ignoreUserGestureWhileAnimating: true, + ), + Padding( + padding: const EdgeInsets.all(20), + child: Column( + children: [ + const Expanded(child: SizedBox()), + Row( + mainAxisAlignment: MainAxisAlignment.center, + children: List.generate(pages.length, _buildDot), + ), + ], + ), + ), + Align( + alignment: Alignment.bottomRight, + child: Padding( + padding: const EdgeInsets.all(25.0), + child: TextButton( + onPressed: () { + liquidController.animateToPage( + page: pages.length - 1, duration: 700); + }, + child: Text( + "Skip to End", + style: TextStyle( + fontWeight: FontWeight.bold, + color: pages[page].btnColor, + ), + ), + ), + ), + ), + Align( + alignment: Alignment.bottomLeft, + child: Padding( + padding: const EdgeInsets.all(25.0), + child: TextButton( + onPressed: () { + liquidController.jumpToPage( + page: liquidController.currentPage + 1 > pages.length - 1 + ? 0 + : liquidController.currentPage + 1); + }, + child: Text( + "Next", + style: TextStyle( + fontWeight: FontWeight.bold, + color: pages[page].btnColor, + ), + ), + ), + ), + ) + ], + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index f10e6ba..29c3e96 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -120,6 +120,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.3.0" + ffi: + dependency: transitive + description: + name: ffi + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.1" + file: + dependency: transitive + description: + name: file + url: "https://pub.dartlang.org" + source: hosted + version: "6.1.4" firebase_auth: dependency: "direct main" description: @@ -317,6 +331,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "0.17.0" + is_first_run: + dependency: "direct main" + description: + name: is_first_run + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" js: dependency: transitive description: @@ -338,6 +359,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.0.0" + liquid_swipe: + dependency: "direct main" + description: + name: liquid_swipe + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" loading_animation_widget: dependency: "direct main" description: @@ -366,6 +394,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.7.0" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.0" path: dependency: transitive description: @@ -373,6 +408,27 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "1.8.1" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.7" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.3" petitparser: dependency: transitive description: @@ -380,6 +436,13 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "5.0.0" + platform: + dependency: transitive + description: + name: platform + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" plugin_platform_interface: dependency: transitive description: @@ -387,6 +450,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.3" + process: + dependency: transitive + description: + name: process + url: "https://pub.dartlang.org" + source: hosted + version: "4.2.4" + provider: + dependency: transitive + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.3" quiver: dependency: transitive description: @@ -394,6 +471,62 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "3.1.0" + shared_preferences: + dependency: transitive + description: + name: shared_preferences + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.15" + shared_preferences_android: + dependency: transitive + description: + name: shared_preferences_android + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.13" + shared_preferences_ios: + dependency: transitive + description: + name: shared_preferences_ios + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + shared_preferences_linux: + dependency: transitive + description: + name: shared_preferences_linux + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" + shared_preferences_macos: + dependency: transitive + description: + name: shared_preferences_macos + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" + shared_preferences_platform_interface: + dependency: transitive + description: + name: shared_preferences_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0" + shared_preferences_web: + dependency: transitive + description: + name: shared_preferences_web + url: "https://pub.dartlang.org" + source: hosted + version: "2.0.4" + shared_preferences_windows: + dependency: transitive + description: + name: shared_preferences_windows + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.1" sky_engine: dependency: transitive description: flutter @@ -455,6 +588,20 @@ packages: url: "https://pub.dartlang.org" source: hosted version: "2.1.2" + win32: + dependency: transitive + description: + name: win32 + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.0+2" xml: dependency: transitive description: @@ -471,4 +618,4 @@ packages: version: "3.1.1" sdks: dart: ">=2.17.6 <3.0.0" - flutter: ">=2.10.0" + flutter: ">=3.0.0" diff --git a/pubspec.yaml b/pubspec.yaml index c4b5859..b9e48cc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -42,6 +42,8 @@ dependencies: flutter_launcher_icons: ^0.10.0 firebase_auth: ^3.9.0 firebase_storage: ^10.3.8 + liquid_swipe: ^3.0.0 + is_first_run: ^1.0.0 dev_dependencies: flutter_test: diff --git a/sign up progress.png b/sign up progress.png new file mode 100644 index 0000000..3e767a9 Binary files /dev/null and b/sign up progress.png differ diff --git a/sp1.png b/sp1.png new file mode 100644 index 0000000..0c4c669 Binary files /dev/null and b/sp1.png differ diff --git a/sp2.png b/sp2.png new file mode 100644 index 0000000..91b5146 Binary files /dev/null and b/sp2.png differ diff --git a/sp3.png b/sp3.png new file mode 100644 index 0000000..d68b603 Binary files /dev/null and b/sp3.png differ diff --git a/sp4.png b/sp4.png new file mode 100644 index 0000000..cd3f664 Binary files /dev/null and b/sp4.png differ diff --git a/sp5.png b/sp5.png new file mode 100644 index 0000000..47ac6c8 Binary files /dev/null and b/sp5.png differ diff --git a/sp6.png b/sp6.png new file mode 100644 index 0000000..3e9ecc4 Binary files /dev/null and b/sp6.png differ