home page: avoid refetching sheets on rebuild
This commit is contained in:
@@ -25,11 +25,13 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
String? appName;
|
||||
String? appVersion;
|
||||
bool shuffling = false;
|
||||
late final Future<List<Sheet>> sheets;
|
||||
|
||||
@override
|
||||
void initState() {
|
||||
super.initState();
|
||||
_loadAppInfo();
|
||||
sheets = acquireSheets();
|
||||
}
|
||||
|
||||
Future<void> _loadAppInfo() async {
|
||||
@@ -148,7 +150,7 @@ class _MyHomePageState extends State<MyHomePage> {
|
||||
appBar: AppBar(title: const Text("Sheetless")),
|
||||
endDrawer: _buildDrawer(),
|
||||
body: FutureBuilder(
|
||||
future: acquireSheets(),
|
||||
future: sheets,
|
||||
builder: (BuildContext context, AsyncSnapshot<List<Sheet>> snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
return SheetsWidget(
|
||||
|
||||
Reference in New Issue
Block a user