Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a Splash Screen #44

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .flutter-plugins-dependencies
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"info":"This is a generated file; do not edit or check into version control.","plugins":{"ios":[{"name":"cloud_firestore","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\cloud_firestore-0.16.0+1\\\\","dependencies":["firebase_core"]},{"name":"firebase_auth","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth-0.20.1\\\\","dependencies":["firebase_core"]},{"name":"firebase_core","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core-0.7.0\\\\","dependencies":[]},{"name":"firebase_database","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_database-6.0.0\\\\","dependencies":["firebase_core"]},{"name":"google_maps_flutter","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.33\\\\","dependencies":[]},{"name":"google_sign_in","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_sign_in-4.5.9\\\\","dependencies":[]},{"name":"location","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.4\\\\","dependencies":[]}],"android":[{"name":"cloud_firestore","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\cloud_firestore-0.16.0+1\\\\","dependencies":["firebase_core"]},{"name":"firebase_auth","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth-0.20.1\\\\","dependencies":["firebase_core"]},{"name":"firebase_core","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core-0.7.0\\\\","dependencies":[]},{"name":"firebase_database","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_database-6.0.0\\\\","dependencies":["firebase_core"]},{"name":"flutter_plugin_android_lifecycle","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\flutter_plugin_android_lifecycle-1.0.11\\\\","dependencies":[]},{"name":"google_maps_flutter","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_maps_flutter-0.5.33\\\\","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_sign_in","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_sign_in-4.5.9\\\\","dependencies":[]},{"name":"location","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\location-2.5.4\\\\","dependencies":[]}],"macos":[{"name":"cloud_firestore","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\cloud_firestore-0.16.0+1\\\\","dependencies":["firebase_core"]},{"name":"firebase_auth","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth-0.20.1\\\\","dependencies":["firebase_core"]},{"name":"firebase_core","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core-0.7.0\\\\","dependencies":[]},{"name":"firebase_database","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_database-6.0.0\\\\","dependencies":["firebase_core"]}],"linux":[],"windows":[],"web":[{"name":"cloud_firestore_web","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\cloud_firestore_web-0.3.0+2\\\\","dependencies":["firebase_core_web"]},{"name":"firebase_auth_web","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_auth_web-0.3.3\\\\","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\firebase_core_web-0.2.1+3\\\\","dependencies":[]},{"name":"google_sign_in_web","path":"H:\\\\flutter\\\\.pub-cache\\\\hosted\\\\pub.dartlang.org\\\\google_sign_in_web-0.9.2\\\\","dependencies":[]}]},"dependencyGraph":[{"name":"cloud_firestore","dependencies":["firebase_core","cloud_firestore_web"]},{"name":"cloud_firestore_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_auth","dependencies":["firebase_core","firebase_auth_web"]},{"name":"firebase_auth_web","dependencies":["firebase_core","firebase_core_web"]},{"name":"firebase_core","dependencies":["firebase_core_web"]},{"name":"firebase_core_web","dependencies":[]},{"name":"firebase_database","dependencies":["firebase_core"]},{"name":"flutter_plugin_android_lifecycle","dependencies":[]},{"name":"google_maps_flutter","dependencies":["flutter_plugin_android_lifecycle"]},{"name":"google_sign_in","dependencies":["google_sign_in_web"]},{"name":"google_sign_in_web","dependencies":[]},{"name":"location","dependencies":[]}],"date_created":"2021-08-31 13:14:38.511882","version":"1.22.0-10.0.pre.87"}
40 changes: 17 additions & 23 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:flutter/foundation.dart';
import 'package:provider/provider.dart';
import 'package:trovami/managers/GroupsManager.dart';
import 'package:trovami/model/userModel.dart';
import 'package:trovami/splashscreen.dart';

import 'Strings.dart';
import 'helpers/RoutesHelper.dart';
Expand All @@ -27,7 +28,6 @@ final ThemeData kDefaultTheme = new ThemeData(
accentColor: Colors.blueGrey,
);


void main() {
// defaultTargetPlatform == TargetPlatform.iOS
// ? MapView.setApiKey("AIzaSyCLw1SjRi8TLDu_Nzcdo2Ufu68H1UXl9BU")
Expand All @@ -36,50 +36,44 @@ void main() {
runApp(
ChangeNotifierProvider(
create: (context) => UserModel(),

child: new MaterialApp(
title: Strings.appName,
debugShowCheckedModeBanner: false,
home: new SignInForm(),
theme: defaultTargetPlatform == TargetPlatform.iOS
? kIOSTheme
: kDefaultTheme,
title: Strings.appName,
debugShowCheckedModeBanner: false,
//home: new SignInForm(),
home: new SplashScreen(),
theme: defaultTargetPlatform == TargetPlatform.iOS
? kIOSTheme
: kDefaultTheme,
// ignore: missing_return
onGenerateRoute: RoutesHelper.provideRoute,
initialRoute: ROUTE_HOME,
),
),
),
);
}

class MyCustomRoute<T> extends MaterialPageRoute<T> {
MyCustomRoute({ WidgetBuilder builder, RouteSettings settings })
MyCustomRoute({WidgetBuilder builder, RouteSettings settings})
: super(builder: builder, settings: settings);

@override
Widget buildTransitions(BuildContext context,
Animation<double> animation,
Animation<double> secondaryAnimation,
Widget child) {
Widget buildTransitions(BuildContext context, Animation<double> animation,
Animation<double> secondaryAnimation, Widget child) {
// if (settings.isInitialRoute)
// return child;
return new FadeTransition( opacity: animation, child: child);
return new FadeTransition(opacity: animation, child: child);
}
}

class MyCustomRoute1<T> extends MaterialPageRoute<T> {
MyCustomRoute1({ WidgetBuilder builder, RouteSettings settings })
MyCustomRoute1({WidgetBuilder builder, RouteSettings settings})
: super(builder: builder, settings: settings);

@override
Widget TransitionBuilder(BuildContext context,
Animation<Offset> animation,
Animation<double> secondaryAnimation,
Widget child) {
Widget TransitionBuilder(BuildContext context, Animation<Offset> animation,
Animation<double> secondaryAnimation, Widget child) {
// if (settings.isInitialRoute)
// return child;
return new SlideTransition( position: animation, child: child);
return new SlideTransition(position: animation, child: child);
}
}


67 changes: 67 additions & 0 deletions lib/splashscreen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
import 'dart:async';

import 'package:flutter/material.dart';

class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
// TODO: implement initState
super.initState();
Timer(Duration(seconds: 3), () {
Navigator.of(context)
.pushReplacement(MaterialPageRoute(builder: (_) => HomePage()));
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.green[700],
body: Center(
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
// logo here
Image.asset(
'assets/images/logo.png',
height: 120,
),
SizedBox(
height: 20,
),
CircularProgressIndicator(
valueColor: AlwaysStoppedAnimation<Color>(Colors.white),
)
],
),
),
);
}
}

class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}

class _HomePageState extends State<HomePage> {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
backgroundColor: Colors.green[700],
title: Text("Title of the app"),
),
body: Container(
child: Center(
child: Text("Home page"),
),
),
);
}
}
Loading