diff --git a/lib/main.dart b/lib/main.dart index fa18709..35f2a62 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -1,6 +1,7 @@ import 'package:flutter/material.dart'; import 'package:hashcode/custom/custom_colors.dart'; import 'package:hashcode/screens/home.dart'; +import 'package:hashcode/screens/splash_screen.dart'; void main() { WidgetsFlutterBinding.ensureInitialized(); @@ -12,7 +13,7 @@ class MyApp extends StatelessWidget { Widget build(BuildContext context) { return MaterialApp( theme: ThemeData(accentColor: customDarkBlack), - home: Home(), + home: SplashScreen(), ); } } diff --git a/lib/screens/splash_screen.dart b/lib/screens/splash_screen.dart new file mode 100644 index 0000000..2fa235a --- /dev/null +++ b/lib/screens/splash_screen.dart @@ -0,0 +1,76 @@ +import 'dart:async'; + +import 'package:flutter/material.dart'; + +import '../custom/custom_colors.dart'; +import 'home.dart'; + +class SplashScreen extends StatefulWidget { + const SplashScreen({Key key}) : super(key: key); + + @override + _SplashScreenState createState() => _SplashScreenState(); +} + +class _SplashScreenState extends State + with SingleTickerProviderStateMixin { + AnimationController animationController; + Animation animation; + @override + void initState() { + super.initState(); + animationController = AnimationController( + duration: Duration( + seconds: 2, + ), + vsync: this, + ); + animation = Tween(begin: 0.0, end: 1.0).animate(animationController); + Timer( + Duration(seconds: 2, milliseconds: 50), + () => Navigator.pushReplacement( + context, MaterialPageRoute(builder: (context) => Home()))); + } + + @override + void dispose() { + animationController.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + animationController.forward(); + return Scaffold( + body: Container( + color: Colors.white, + height: MediaQuery.of(context).size.height, + width: double.infinity, + child: Center( + child: Column( + mainAxisAlignment: MainAxisAlignment.center, + children: [ + FadeTransition( + opacity: animation, + child: SizedBox( + child: Image.asset('assets/icon/icon.png'), + ), + ), + SizedBox( + height: 15, + ), + Text( + 'hashcode', + style: TextStyle( + letterSpacing: 1, + color: customDarkBlack, + fontSize: 28, + fontWeight: FontWeight.bold), + ) + ], + ), + ), + ), + ); + } +} diff --git a/pubspec.lock b/pubspec.lock index 1e11639..553eb3b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -21,42 +21,42 @@ packages: name: async url: "https://pub.dartlang.org" source: hosted - version: "2.5.0-nullsafety.3" + version: "2.5.0" boolean_selector: dependency: transitive description: name: boolean_selector url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" characters: dependency: transitive description: name: characters url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.5" + version: "1.1.0" charcode: dependency: transitive description: name: charcode url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0" clock: dependency: transitive description: name: clock url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" collection: dependency: transitive description: name: collection url: "https://pub.dartlang.org" source: hosted - version: "1.15.0-nullsafety.5" + version: "1.15.0" convert: dependency: transitive description: @@ -77,7 +77,7 @@ packages: name: fake_async url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0" flutter: dependency: "direct main" description: flutter @@ -115,14 +115,14 @@ packages: name: matcher url: "https://pub.dartlang.org" source: hosted - version: "0.12.10-nullsafety.3" + version: "0.12.10" meta: dependency: transitive description: name: meta url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.6" + version: "1.3.0" mime: dependency: transitive description: @@ -136,7 +136,7 @@ packages: name: path url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.3" + version: "1.8.0" petitparser: dependency: transitive description: @@ -155,49 +155,49 @@ packages: name: source_span url: "https://pub.dartlang.org" source: hosted - version: "1.8.0-nullsafety.4" + version: "1.8.0" stack_trace: dependency: transitive description: name: stack_trace url: "https://pub.dartlang.org" source: hosted - version: "1.10.0-nullsafety.6" + version: "1.10.0" stream_channel: dependency: transitive description: name: stream_channel url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.3" + version: "2.1.0" string_scanner: dependency: transitive description: name: string_scanner url: "https://pub.dartlang.org" source: hosted - version: "1.1.0-nullsafety.3" + version: "1.1.0" term_glyph: dependency: transitive description: name: term_glyph url: "https://pub.dartlang.org" source: hosted - version: "1.2.0-nullsafety.3" + version: "1.2.0" test_api: dependency: transitive description: name: test_api url: "https://pub.dartlang.org" source: hosted - version: "0.2.19-nullsafety.6" + version: "0.2.19" typed_data: dependency: transitive description: name: typed_data url: "https://pub.dartlang.org" source: hosted - version: "1.3.0-nullsafety.5" + version: "1.3.0" uuid: dependency: transitive description: @@ -211,7 +211,7 @@ packages: name: vector_math url: "https://pub.dartlang.org" source: hosted - version: "2.1.0-nullsafety.5" + version: "2.1.0" xml: dependency: transitive description: diff --git a/pubspec.yaml b/pubspec.yaml index b6186a1..744de12 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -51,6 +51,7 @@ flutter: # To add assets to your application, add an assets section, like this: assets: - assets/courses_gif/ + - assets/icon/icon.png # An image asset can refer to one or more resolution-specific "variants", see # https://flutter.dev/assets-and-images/#resolution-aware.