Skip to content

Commit

Permalink
task: splash screen and adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
Atuoha committed Sep 21, 2022
1 parent 4069953 commit 614c44d
Show file tree
Hide file tree
Showing 23 changed files with 562 additions and 16 deletions.
Binary file modified assets/images/sp1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/sp2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/sp3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/sp4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/sp5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/sp6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 7 additions & 3 deletions lib/components/loading.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
);
}
Expand Down
28 changes: 24 additions & 4 deletions lib/constants/colors.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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);

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,
);
6 changes: 5 additions & 1 deletion lib/controllers/routes.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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()
};
19 changes: 14 additions & 5 deletions lib/main.dart
Original file line number Diff line number Diff line change
@@ -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';

Expand All @@ -16,16 +16,25 @@ Future<void> main() async {
);
}

class MultiVendor extends StatelessWidget {
class MultiVendor extends StatefulWidget {
const MultiVendor({Key? key}) : super(key: key);

@override
State<MultiVendor> createState() => _MultiVendorState();
}

class _MultiVendorState extends State<MultiVendor> {




@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'MultiVendor App',
theme: ThemeData(fontFamily: 'Roboto'),
debugShowCheckedModeBanner: false,
home: const AccountTypeSelector(),
home: const EntryScreen(),
routes: routes,
);
}
Expand Down
21 changes: 21 additions & 0 deletions lib/models/item_data.dart
Original file line number Diff line number Diff line change
@@ -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,
);
}
8 changes: 6 additions & 2 deletions lib/views/auth/customer_auth.dart
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,6 @@ class _CustomerAuthState extends State<CustomerAuth> {
firebase.collection('users').doc(credential.user!.uid).set({
'fullname': _fullnameController.text.trim(),
'email': _emailController.text.trim(),
'password': _passwordController.text.trim(),
'image': downloadUrl
});
isLoadingFnc();
Expand Down Expand Up @@ -429,7 +428,12 @@ class _CustomerAuthState extends State<CustomerAuth> {
),
const SizedBox(height: 20),
isLoading
? const Center(child: Loading(color:primaryColor))
? const Center(
child: Loading(
color: primaryColor,
kSize: 100,
),
)
: Form(
key: _formKey,
child: Column(
Expand Down
82 changes: 82 additions & 0 deletions lib/views/splash/entry.dart
Original file line number Diff line number Diff line change
@@ -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<EntryScreen> createState() => _EntryScreenState();
}

class _EntryScreenState extends State<EntryScreen> {
_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,),
],
),
),
);
}
}
Loading

0 comments on commit 614c44d

Please sign in to comment.