Skip to content
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 added #177

Merged
merged 1 commit into from
Jun 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions android/app/src/main/res/drawable/launch_background.xml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Modify this file to customize your launch splash screen -->
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />

<!-- You can insert your own image assets here -->
<!-- <item>
<item>
<bitmap
android:gravity="center"
android:src="@mipmap/launch_image" />
</item> -->
android:src="@drawable/splash screen.png" />
</item>
</layer-list>
Binary file added assets/splash screen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 5 additions & 2 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:opso/programs%20screen/summer_of_bitcoin.dart';
import 'package:opso/services/notificationService.dart';
import 'home_page.dart';
import 'package:adaptive_theme/adaptive_theme.dart';
import 'splash_screen.dart';

void main() async {
WidgetsFlutterBinding.ensureInitialized();
Expand All @@ -33,7 +34,7 @@ class OpSoApp extends StatelessWidget {
dark: ThemeData.dark(),
initial: AdaptiveThemeMode.system,
builder: (theme, darkTheme) => MaterialApp(
initialRoute: '/landing_page',
initialRoute: '/splash_screen',
routes: {
"/progarm_page": (context) => const HomePage(),
"/girl_script_summer_of_code": (context) => const GSSOCScreen(),
Expand All @@ -47,6 +48,7 @@ class OpSoApp extends StatelessWidget {
const MajorLeagueHackingFellowship(),
"/linux_foundation": (context) => const LinuxFoundation(),
"/landing_page": (context) => const LandingPage(),
'/splash_screen': (context) => SplashScreen(),
},
title: 'OpSo',
debugShowCheckedModeBanner: false,
Expand All @@ -57,8 +59,9 @@ class OpSoApp extends StatelessWidget {
// visualDensity: VisualDensity.adaptivePlatformDensity,
// ),
home: const HomePage(),

),
);
});
}
}
}
26 changes: 26 additions & 0 deletions lib/splash_screen.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'dart:async';

class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}

class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
super.initState();
Timer(Duration(seconds: 3), () {
Navigator.of(context).pushReplacementNamed('/landing_page');
});
}

@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Image.asset('assets/splash screen.png'),
),
);
}
}
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ flutter:
- assets/projects/gsod/
- assets/projects/sob/
- assets/projects/linux_foundation/
- assets/splash screen.png
# An image asset can refer to one or more resolution-specific "variants", see
# https://flutter.dev/assets-and-images/#resolution-aware
# For details regarding adding assets from package dependencies, see
Expand Down
Loading