import 'package:buyeeb_mobile/models/user_listings.dart'; import 'package:buyeeb_mobile/models/yahoo_auctions_item.dart'; import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'dart:math'; class RouteSplash extends StatefulWidget { @override _RouteSplashState createState() => _RouteSplashState(); } class _RouteSplashState extends State { bool _ready = false; _loadUserSettings() async { // sleep for a bit to "simulate" loading await Future.delayed(Duration(seconds: 1)); // add some random stuff to the listings var listings = context.read(); var _rng = new Random(); final names = ["Hi Pempa!", "Pebulon Crystal", "The Peebler Chronicles", "Pecha Sludge", "The Forbidden Book of Peebus"]; for (var i = 0; i < 15; i++) { listings.add(YahooAuctionsItem( id: "Henlo", name: names[_rng.nextInt(names.length)], price: _rng.nextInt(5000) + 500 )); } setState(() { _ready = true; Navigator.pushNamed(context, '/'); }); } @override void initState() { super.initState(); _loadUserSettings(); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: CircularProgressIndicator(), ) ); } }