voyagehandbook/lib/views/home.dart

50 lines
1.2 KiB
Dart
Raw Normal View History

2023-03-18 16:55:08 +01:00
import 'package:flutter/material.dart';
import 'package:voyagehandbook/util/drawer.dart';
import 'package:voyagehandbook/util/storage.dart';
class HomeView extends StatefulWidget {
const HomeView({super.key});
@override
State<HomeView> createState() => _HomeViewState();
}
class _HomeViewState extends State<HomeView> {
var _recents = [];
@override
void initState() {
super.initState();
load();
}
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text("Home")),
drawer: genDrawer(1, context),
body: Center(
child: SizedBox(
height: MediaQuery.of(context).size.height,
width: MediaQuery.of(context).size.width * 0.9,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
(_recents.isEmpty)
? const Flexible(
child: Text(
"You haven't opened anything recently, swipe right and start searching."),
)
: const CircularProgressIndicator()
],
),
),
),
);
}
void load() async {
_recents = await StorageAccess.recent;
setState(() {});
}
}