-
Notifications
You must be signed in to change notification settings - Fork 158
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feat: Implementing the Splash Screen (#41)
* implementing the splash screen * adding the test for the splash screen
- Loading branch information
1 parent
a8e2c50
commit 4bb9ae3
Showing
9 changed files
with
98 additions
and
31 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions
11
lib/app/modules/splashScreen/bindings/splash_screen_binding.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'package:get/get.dart'; | ||
import 'package:ultimate_alarm_clock/app/modules/splashScreen/controllers/splash_screen_controller.dart'; | ||
|
||
class SplashScreenBinding extends Bindings { | ||
@override | ||
void dependencies() { | ||
Get.put<SplashScreenController>( | ||
SplashScreenController() | ||
); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
lib/app/modules/splashScreen/controllers/splash_screen_controller.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import 'package:get/get.dart'; | ||
|
||
class SplashScreenController extends GetxController { | ||
@override | ||
void onInit() { | ||
Future.delayed(const Duration(seconds: 1), () { | ||
Get.offNamed('/home'); | ||
}); | ||
super.onInit(); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
lib/app/modules/splashScreen/views/splash_screen_view.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:ultimate_alarm_clock/app/modules/splashScreen/controllers/splash_screen_controller.dart'; | ||
import 'package:ultimate_alarm_clock/app/utils/constants.dart'; | ||
|
||
class SplashScreenView extends GetView<SplashScreenController> { | ||
const SplashScreenView({Key? key}) : super(key: key); | ||
|
||
@override | ||
Widget build(BuildContext context) { | ||
var width = Get.width; | ||
return Scaffold( | ||
body: SafeArea( | ||
child: Center( | ||
child: Column( | ||
mainAxisAlignment: MainAxisAlignment.center, | ||
children: [ | ||
Padding( | ||
padding: const EdgeInsets.fromLTRB(20, 10, 0, 10), | ||
child: Image.asset( | ||
'assets/images/ic_launcher-playstore-nobg.png', | ||
fit: BoxFit.cover, | ||
width: width / 2, | ||
height: width / 2, | ||
), | ||
), | ||
Text( | ||
'Ultimate Alarm Clock', | ||
style: Theme.of(context) | ||
.textTheme | ||
.displayMedium! | ||
.copyWith(color: kprimaryColor), | ||
), | ||
], | ||
), | ||
), | ||
), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:get/get.dart'; | ||
import 'package:ultimate_alarm_clock/app/modules/splashScreen/controllers/splash_screen_controller.dart'; | ||
import 'package:ultimate_alarm_clock/app/modules/splashScreen/views/splash_screen_view.dart'; | ||
|
||
void main() { | ||
setUpAll(() { | ||
Get.put(SplashScreenController()); | ||
}); | ||
|
||
tearDownAll(() { | ||
Get.reset(); | ||
}); | ||
|
||
testWidgets('SplashScreenView Test', (widgetTester) async { | ||
await widgetTester.pumpWidget( | ||
const GetMaterialApp( | ||
home: SplashScreenView(), | ||
), | ||
); | ||
|
||
expect(find.byType(Image), findsOneWidget); | ||
expect(find.byType(Text), findsOneWidget); | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.