2020-09-30 01:45:57 +00:00
|
|
|
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<RouteSplash> {
|
|
|
|
_loadUserSettings() async {
|
|
|
|
// sleep for a bit to "simulate" loading
|
2020-09-30 03:02:05 +00:00
|
|
|
await Future.delayed(Duration(seconds: 2));
|
2020-09-30 01:45:57 +00:00
|
|
|
// add some random stuff to the listings
|
|
|
|
var listings = context.read<UserListings>();
|
|
|
|
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++) {
|
2020-09-30 03:23:01 +00:00
|
|
|
listings.add(
|
|
|
|
"k" + (_rng.nextInt(500000) + 100000).toString(),
|
|
|
|
YahooAuctionsItem(
|
2020-09-30 01:45:57 +00:00
|
|
|
name: names[_rng.nextInt(names.length)],
|
|
|
|
price: _rng.nextInt(5000) + 500
|
|
|
|
));
|
|
|
|
}
|
|
|
|
|
|
|
|
setState(() {
|
2020-09-30 03:02:05 +00:00
|
|
|
Navigator.pushNamedAndRemoveUntil(
|
|
|
|
context,
|
|
|
|
'/',
|
|
|
|
(Route<dynamic> route) => false,
|
|
|
|
);
|
2020-09-30 01:45:57 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
void initState() {
|
|
|
|
super.initState();
|
|
|
|
_loadUserSettings();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Widget build(BuildContext context) {
|
|
|
|
return Scaffold(
|
|
|
|
body: Center(
|
2020-09-30 03:02:05 +00:00
|
|
|
child: Column(
|
|
|
|
mainAxisAlignment: MainAxisAlignment.center,
|
|
|
|
children: [
|
|
|
|
Container(
|
|
|
|
margin: const EdgeInsets.all(12.0),
|
|
|
|
child: Text(
|
|
|
|
"Buypeeb Mobile",
|
|
|
|
style: TextStyle(
|
|
|
|
fontSize: 36.0,
|
|
|
|
fontWeight: FontWeight.w200
|
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
CircularProgressIndicator(),
|
|
|
|
]
|
|
|
|
)
|
2020-09-30 01:45:57 +00:00
|
|
|
)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|