-
Notifications
You must be signed in to change notification settings - Fork 108
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
Splash Screen UI and tests #38
base: master
Are you sure you want to change the base?
Conversation
lib/helpers/RoutesHelper.dart
Outdated
@@ -2,6 +2,8 @@ | |||
import 'package:flutter/cupertino.dart'; | |||
import 'package:flutter/foundation.dart'; | |||
import 'package:flutter/material.dart'; | |||
import 'package:trovami/signinpage.dart'; | |||
import 'package:trovami/ui/splash/splash_screen.dart'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are your thoughts on organizing the code in folders?
UI would seem to be unnecessary. What else would go in UI? Maybe all the screens?
What else would go in SplashScreen? Having a folder per screen seems like an unnecessary extra folder unless we store all things having to do with the screen like model/helpers, assets, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking of a folder that has only the UI elements. Maybe we can name it better. Not really sure what. Maybe "views"? I thought of ui because it makes it clear that it has only "UI" elements in it and should contain no business logic.
It will contain all our screens and common widgets.
How about this,
lib
|- views
|---- widgets (all the common widgets used across screens)
|---- screens (.dart files for each screen)
lib/ui/splash/splash_screen.dart
Outdated
child: Text( | ||
Strings.appName, | ||
textAlign: TextAlign.center, | ||
style: new TextStyle(fontSize: 50.0), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we merge my CloudStoreTable PR first, you can try out my new ThemeManager to define reusable styles!
Besides being able to swap out "Skins" we could use them to adjust UI for different screen sizes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah! That's a good idea. I'll change it once we merge that PR.
import 'package:trovami/helpers/RoutesHelper.dart'; | ||
import 'package:trovami/ui/splash/splash_screen.dart'; | ||
|
||
void main() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't used tests like this. You'll have to teach it to me. Does it run as a separate app?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's the same app. No different tool required. It's part of the flutter sdk. The one there is a widget test, https://flutter.dev/docs/cookbook/testing/widget/introduction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You basically write the test and run flutter test
import 'package:trovami/ui/splash/splash_screen.dart'; | ||
|
||
void main() { | ||
testWidgets('Shows splash screen for a few seconds and Navigates to Log in page', (WidgetTester tester) async { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test doesn't actually "Show the splash screen for a few seconds" ?
It displays the splash screen and waits for however long the splash screen is coded to stay up?
Just making sure I understand what pumpAndSettle does
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol, yeah I realized that too. I am kinda new to write tests too but just starting to know a lot more. I can probably test if the splashscreen widget was mounted that would test the appearance of splash screen I suppose.
lib/ui/splash/splash_screen.dart
Outdated
@override | ||
void initState() { | ||
super.initState(); | ||
Future.delayed(Duration(seconds: 2),(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 seconds feels too fast.
Consider 3 4 or 5 seconds?
One thing we could do is make it long (5 seconds) but allow user to dismiss by touching screen.
Pretty Screen! I would place "Trovami" maybe 1/3rd down from Top, and use bigger white bold text.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think dismissing on touch would just be more work for now. We can keep it simple and make it 5 secs np.
Yeah, I'll adjust the name as per your suggestion.
Adds a splash screen to the app that navigates to login page after 2 seconds. + Tested