Skip to content

Instantly share code, notes, and snippets.

@ctjlewis
Created June 24, 2020 22:27
Show Gist options
  • Save ctjlewis/0fa8539de4691a0b2559fac96a1652ae to your computer and use it in GitHub Desktop.
Save ctjlewis/0fa8539de4691a0b2559fac96a1652ae to your computer and use it in GitHub Desktop.
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