Skip to content

Instantly share code, notes, and snippets.

@gausoft
Created November 26, 2020 21:04
Show Gist options
  • Save gausoft/fa688447567fcf1c4bab9e91c3456621 to your computer and use it in GitHub Desktop.
Save gausoft/fa688447567fcf1c4bab9e91c3456621 to your computer and use it in GitHub Desktop.
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:flutter/cupertino.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
title: 'Flutter Overlay Example',
theme: ThemeData(
primarySwatch: Colors.blue,
visualDensity: VisualDensity.adaptivePlatformDensity,
),
home: SplashScreen(),
);
}
}
class SplashScreen extends StatefulWidget {
@override
_SplashScreenState createState() => _SplashScreenState();
}
class _SplashScreenState extends State<SplashScreen> {
@override
void initState() {
super.initState();
startTimeout();
}
startTimeout() {
return Timer(Duration(seconds: 4), changeScreen);
}
changeScreen() async {
Navigator.of(context).pushReplacement(
CupertinoPageRoute(
builder: (BuildContext context) => Scaffold(
//remplacer par page suivante
body: Center(
child: Text('Welcome to home page'),
),
),
),
);
}
@override
Widget build(BuildContext context) {
return Scaffold(
body: Container(
width: double.infinity,
decoration: const BoxDecoration(
image: DecorationImage(
image: NetworkImage(
'https://images.unsplash.com/photo-1602784648782-c9e96b8d29c9?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=334&q=80',
),
fit: BoxFit.cover,
),
),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
ClipRRect(
borderRadius: BorderRadius.circular(60.0),
child: Image.network(
'https://upload.wikimedia.org/wikipedia/commons/0/08/Learn_area_logo.png',
width: 96,
),
),
SizedBox(height: 16.0),
Text(
"Lorem ipsum, dolor sit amet consectetur adipisicing elit.",
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 16.0,
color: Colors.white,
),
),
],
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment