Skip to content

Commit

Permalink
[#5] Refactor code
Browse files Browse the repository at this point in the history
  • Loading branch information
nkhanh44 committed Aug 8, 2023
1 parent 9f638a6 commit 905bfaf
Show file tree
Hide file tree
Showing 10 changed files with 2 additions and 89 deletions.
Binary file added assets/images/2.0x/splash_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/2.0x/splash_logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/3.0x/splash_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/3.0x/splash_logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/images/nimble_logo.png
Binary file not shown.
Binary file modified assets/images/splash_background.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/images/splash_logo_white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 0 additions & 20 deletions integration_test/my_home_page_test.dart

This file was deleted.

56 changes: 0 additions & 56 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import 'package:flutter_config/flutter_config.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';
import 'package:survey_flutter/gen/assets.gen.dart';
import 'package:go_router/go_router.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'package:survey_flutter/screens/splash/splash.dart';

void main() async {
Expand Down Expand Up @@ -42,58 +41,3 @@ class MyApp extends StatelessWidget {
);
}
}

class HomeScreen extends StatelessWidget {
const HomeScreen({Key? key}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: FutureBuilder<PackageInfo>(
future: PackageInfo.fromPlatform(),
builder: (context, snapshot) {
return snapshot.hasData
? Text(snapshot.data?.appName ?? "")
: const SizedBox.shrink();
}),
),
body: Center(
child: Column(
children: [
const SizedBox(height: 24),
FractionallySizedBox(
widthFactor: 0.5,
child: Image.asset(
Assets.images.nimbleLogo.path,
fit: BoxFit.fitWidth,
),
),
const SizedBox(height: 24),
Text(AppLocalizations.of(context)!.hello),
Text(
FlutterConfig.get('SECRET'),
style: const TextStyle(color: Colors.black, fontSize: 24),
),
const SizedBox(height: 24)
],
),
),
);
}
}

class SecondScreen extends StatelessWidget {
const SecondScreen({
Key? key,
}) : super(key: key);

@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: const Text("Second Screen"),
),
);
}
}
15 changes: 2 additions & 13 deletions lib/screens/splash/splash.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ class SplashScreen extends StatefulWidget {

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

@override
void initState() {
Expand Down Expand Up @@ -45,21 +44,11 @@ class SplashScreenState extends State<SplashScreen> {
}

Widget _buildAnimatedLogo(BoxConstraints constraints) {
return AnimatedPositioned(
duration: const Duration(seconds: 1),
top: _shouldStartAnimation ? 153.0 : constraints.maxHeight / 2.0,
child: AnimatedOpacity(
return AnimatedOpacity(
opacity: _isLogoVisible ? 1.0 : 0.0,
duration: const Duration(milliseconds: 500),
child: Image.asset(
Assets.images.splashLogoWhite.path,
),
onEnd: () {
setState(() {
_shouldStartAnimation = true;
});
},
),
);
));
}
}

0 comments on commit 905bfaf

Please sign in to comment.