From c4a6486b7e57459989061848083c63a380213dcd Mon Sep 17 00:00:00 2001 From: YashikaMendhekar Date: Tue, 31 Aug 2021 13:16:04 +0530 Subject: [PATCH] Added a Splash Screen --- .flutter-plugins-dependencies | 1 + lib/main.dart | 40 ++-- lib/splashscreen.dart | 67 +++++++ pubspec.lock | 348 ++++++++++++++++++++++++++++++++++ 4 files changed, 433 insertions(+), 23 deletions(-) create mode 100644 .flutter-plugins-dependencies create mode 100644 lib/splashscreen.dart create mode 100644 pubspec.lock diff --git a/.flutter-plugins-dependencies b/.flutter-plugins-dependencies new file mode 100644 index 0000000..1f34796 --- /dev/null +++ b/.flutter-plugins-dependencies @@ -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"} \ No newline at end of file diff --git a/lib/main.dart b/lib/main.dart index b524184..6ae106b 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -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'; @@ -27,7 +28,6 @@ final ThemeData kDefaultTheme = new ThemeData( accentColor: Colors.blueGrey, ); - void main() { // defaultTargetPlatform == TargetPlatform.iOS // ? MapView.setApiKey("AIzaSyCLw1SjRi8TLDu_Nzcdo2Ufu68H1UXl9BU") @@ -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 extends MaterialPageRoute { - MyCustomRoute({ WidgetBuilder builder, RouteSettings settings }) + MyCustomRoute({WidgetBuilder builder, RouteSettings settings}) : super(builder: builder, settings: settings); @override - Widget buildTransitions(BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child) { + Widget buildTransitions(BuildContext context, Animation animation, + Animation secondaryAnimation, Widget child) { // if (settings.isInitialRoute) // return child; - return new FadeTransition( opacity: animation, child: child); + return new FadeTransition(opacity: animation, child: child); } } class MyCustomRoute1 extends MaterialPageRoute { - MyCustomRoute1({ WidgetBuilder builder, RouteSettings settings }) + MyCustomRoute1({WidgetBuilder builder, RouteSettings settings}) : super(builder: builder, settings: settings); @override - Widget TransitionBuilder(BuildContext context, - Animation animation, - Animation secondaryAnimation, - Widget child) { + Widget TransitionBuilder(BuildContext context, Animation animation, + Animation secondaryAnimation, Widget child) { // if (settings.isInitialRoute) // return child; - return new SlideTransition( position: animation, child: child); + return new SlideTransition(position: animation, child: child); } } - - diff --git a/lib/splashscreen.dart b/lib/splashscreen.dart new file mode 100644 index 0000000..b321a74 --- /dev/null +++ b/lib/splashscreen.dart @@ -0,0 +1,67 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +class SplashScreen extends StatefulWidget { + @override + _SplashScreenState createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State { + @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(Colors.white), + ) + ], + ), + ), + ); + } +} + +class HomePage extends StatefulWidget { + @override + _HomePageState createState() => _HomePageState(); +} + +class _HomePageState extends State { + @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"), + ), + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock new file mode 100644 index 0000000..379dfc3 --- /dev/null +++ b/pubspec.lock @@ -0,0 +1,348 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.0-nullsafety" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety" + characters: + dependency: transitive + description: + name: characters + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety.2" + charcode: + dependency: transitive + description: + name: charcode + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety" + clock: + dependency: transitive + description: + name: clock + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety" + cloud_firestore: + dependency: "direct main" + description: + name: cloud_firestore + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.0+1" + cloud_firestore_platform_interface: + dependency: transitive + description: + name: cloud_firestore_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.2" + cloud_firestore_web: + dependency: transitive + description: + name: cloud_firestore_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.0+2" + collection: + dependency: transitive + description: + name: collection + url: "https://pub.dartlang.org" + source: hosted + version: "1.15.0-nullsafety.2" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + url: "https://pub.dartlang.org" + source: hosted + version: "0.1.3" + fake_async: + dependency: transitive + description: + name: fake_async + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety" + firebase_auth: + dependency: "direct main" + description: + name: firebase_auth + url: "https://pub.dartlang.org" + source: hosted + version: "0.20.1" + firebase_auth_platform_interface: + dependency: transitive + description: + name: firebase_auth_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.0" + firebase_auth_web: + dependency: transitive + description: + name: firebase_auth_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.3.3" + firebase_core: + dependency: "direct main" + description: + name: firebase_core + url: "https://pub.dartlang.org" + source: hosted + version: "0.7.0" + firebase_core_platform_interface: + dependency: transitive + description: + name: firebase_core_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "3.0.1" + firebase_core_web: + dependency: transitive + description: + name: firebase_core_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.1+3" + firebase_database: + dependency: "direct main" + description: + name: firebase_database + url: "https://pub.dartlang.org" + source: hosted + version: "6.0.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_plugin_android_lifecycle: + dependency: transitive + description: + name: flutter_plugin_android_lifecycle + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.11" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + google_maps_flutter: + dependency: "direct main" + description: + name: google_maps_flutter + url: "https://pub.dartlang.org" + source: hosted + version: "0.5.33" + google_maps_flutter_platform_interface: + dependency: transitive + description: + name: google_maps_flutter_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + google_sign_in: + dependency: "direct main" + description: + name: google_sign_in + url: "https://pub.dartlang.org" + source: hosted + version: "4.5.9" + google_sign_in_platform_interface: + dependency: transitive + description: + name: google_sign_in_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.2" + google_sign_in_web: + dependency: transitive + description: + name: google_sign_in_web + url: "https://pub.dartlang.org" + source: hosted + version: "0.9.2" + http: + dependency: "direct main" + description: + name: http + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.2" + http_parser: + dependency: transitive + description: + name: http_parser + url: "https://pub.dartlang.org" + source: hosted + version: "3.1.4" + intl: + dependency: transitive + description: + name: intl + url: "https://pub.dartlang.org" + source: hosted + version: "0.16.1" + js: + dependency: transitive + description: + name: js + url: "https://pub.dartlang.org" + source: hosted + version: "0.6.2" + location: + dependency: "direct main" + description: + name: location + url: "https://pub.dartlang.org" + source: hosted + version: "2.5.4" + matcher: + dependency: transitive + description: + name: matcher + url: "https://pub.dartlang.org" + source: hosted + version: "0.12.10-nullsafety" + meta: + dependency: transitive + description: + name: meta + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.2" + nested: + dependency: transitive + description: + name: nested + url: "https://pub.dartlang.org" + source: hosted + version: "0.0.4" + path: + dependency: transitive + description: + name: path + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety" + pedantic: + dependency: transitive + description: + name: pedantic + url: "https://pub.dartlang.org" + source: hosted + version: "1.9.2" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + url: "https://pub.dartlang.org" + source: hosted + version: "1.0.3" + provider: + dependency: "direct main" + description: + name: provider + url: "https://pub.dartlang.org" + source: hosted + version: "4.3.3" + quiver: + dependency: transitive + description: + name: quiver + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.5" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.99" + source_span: + dependency: transitive + description: + name: source_span + url: "https://pub.dartlang.org" + source: hosted + version: "1.8.0-nullsafety" + stack_trace: + dependency: transitive + description: + name: stack_trace + url: "https://pub.dartlang.org" + source: hosted + version: "1.10.0-nullsafety" + stream_channel: + dependency: transitive + description: + name: stream_channel + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety" + stream_transform: + dependency: transitive + description: + name: stream_transform + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0" + string_scanner: + dependency: transitive + description: + name: string_scanner + url: "https://pub.dartlang.org" + source: hosted + version: "1.1.0-nullsafety" + term_glyph: + dependency: transitive + description: + name: term_glyph + url: "https://pub.dartlang.org" + source: hosted + version: "1.2.0-nullsafety" + test_api: + dependency: transitive + description: + name: test_api + url: "https://pub.dartlang.org" + source: hosted + version: "0.2.19-nullsafety" + typed_data: + dependency: transitive + description: + name: typed_data + url: "https://pub.dartlang.org" + source: hosted + version: "1.3.0-nullsafety.2" + vector_math: + dependency: transitive + description: + name: vector_math + url: "https://pub.dartlang.org" + source: hosted + version: "2.1.0-nullsafety.2" +sdks: + dart: ">=2.10.0-0.0.dev <2.10.0" + flutter: ">=1.16.3 <2.0.0"