Skip to content

Commit

Permalink
[#5] Refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
nkhanh44 committed Aug 8, 2023
1 parent c66507b commit 9f638a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 3 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,9 @@ class MyApp extends StatelessWidget {
final GoRouter _router = GoRouter(
routes: <GoRoute>[
GoRoute(
path: routePathSplashScreen,
builder: (BuildContext context, GoRouterState state) =>
const SplashScreen()
),
path: routePathSplashScreen,
builder: (BuildContext context, GoRouterState state) =>
const SplashScreen()),
],
);

Expand Down
7 changes: 4 additions & 3 deletions lib/screens/splash/splash.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import 'package:flutter/material.dart';
import 'package:survey_flutter/gen/assets.gen.dart';

class SplashScreen extends StatefulWidget {
const SplashScreen({Key? key}) : super(key: key);

Expand All @@ -9,7 +10,7 @@ class SplashScreen extends StatefulWidget {

class SplashScreenState extends State<SplashScreen> {
bool _isLogoVisible = false;
bool _shouldStartAnimate = false;
bool _shouldStartAnimation = false;

@override
void initState() {
Expand Down Expand Up @@ -46,7 +47,7 @@ class SplashScreenState extends State<SplashScreen> {
Widget _buildAnimatedLogo(BoxConstraints constraints) {
return AnimatedPositioned(
duration: const Duration(seconds: 1),
top: _shouldStartAnimate ? 153.0 : constraints.maxHeight / 2.0,
top: _shouldStartAnimation ? 153.0 : constraints.maxHeight / 2.0,
child: AnimatedOpacity(
opacity: _isLogoVisible ? 1.0 : 0.0,
duration: const Duration(milliseconds: 500),
Expand All @@ -55,7 +56,7 @@ class SplashScreenState extends State<SplashScreen> {
),
onEnd: () {
setState(() {
_shouldStartAnimate = true;
_shouldStartAnimation = true;
});
},
),
Expand Down

0 comments on commit 9f638a6

Please sign in to comment.