Created
June 24, 2020 22:27
-
-
Save ctjlewis/0fa8539de4691a0b2559fac96a1652ae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() => runApp(MyApp()); | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Launch Screen', theme: ThemeData(), home: MyHome()); | |
} | |
} | |
class Screen2 extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Center(child: Text("Hello world!")); | |
} | |
} | |
class MyHome extends StatefulWidget { | |
const MyHome({ Key key }) : super(key: key); | |
@override | |
_MyHomeState createState() => _MyHomeState(); | |
} | |
class _MyHomeState extends State<MyHome> { | |
bool isLoading = true; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
title: 'Launch Screen', | |
theme: ThemeData( | |
primarySwatch: Colors.blue, | |
), | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text("Launch Screen"), | |
), | |
body: Container( | |
child: isLoading | |
? Center( | |
child: Column( | |
mainAxisAlignment: MainAxisAlignment.center, | |
children: [ | |
Text("Loading..."), | |
RaisedButton( | |
child: Text("Press me!"), | |
onPressed: () => setState( | |
() => isLoading = false | |
) | |
) | |
] | |
), | |
) | |
: Screen2(), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment