Skip to content

Instantly share code, notes, and snippets.

@kumar-aakash86
Last active September 15, 2019 07:19
Show Gist options
  • Select an option

  • Save kumar-aakash86/94bff2c1262a664f99b9973867eb4075 to your computer and use it in GitHub Desktop.

Select an option

Save kumar-aakash86/94bff2c1262a664f99b9973867eb4075 to your computer and use it in GitHub Desktop.
Render UI with delay
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