Last active
September 15, 2019 07:19
-
-
Save kumar-aakash86/94bff2c1262a664f99b9973867eb4075 to your computer and use it in GitHub Desktop.
Render UI with delay
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_web/material.dart'; | |
| import 'package:flutter_web_ui/ui.dart' as ui; | |
| class MyApp extends StatelessWidget { | |
| @override | |
| Widget build(BuildContext context) { | |
| return MaterialApp( | |
| title: 'Demo', | |
| home: Scaffold( | |
| appBar: AppBar( | |
| title: Text('Demo'), | |
| ), | |
| body: Center( | |
| child: FutureBuilder( | |
| future: Future.delayed(Duration(seconds: 5), () => true), | |
| builder: (context, snapshot){ | |
| if(!snapshot.hasData) | |
| return CircularProgressIndicator(); | |
| return Text("Yay"); | |
| } | |
| ) | |
| ), | |
| ), | |
| ); | |
| } | |
| } | |
| Future<void> main() async { | |
| await ui.webOnlyInitializePlatform(); | |
| runApp(MyApp()); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment