1
0
mirror of https://github.com/h7x4/Jisho-Study-Tool.git synced 2024-12-21 13:37:29 +01:00

Update history loading screen

This commit is contained in:
Oystein Kristoffer Tveit 2021-12-04 05:31:27 +01:00
parent 37f2358411
commit 4e60f528cb

View File

@ -1,5 +1,6 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:get_it/get_it.dart'; import 'package:get_it/get_it.dart';
import 'package:jisho_study_tool/view/components/common/loading.dart';
import 'package:sembast/sembast.dart'; import 'package:sembast/sembast.dart';
import '../../models/history/search.dart'; import '../../models/history/search.dart';
@ -37,11 +38,14 @@ class HistoryView extends StatelessWidget {
return StreamBuilder<List<Search>>( return StreamBuilder<List<Search>>(
stream: searchStream, stream: searchStream,
builder: (context, snapshot) { builder: (context, snapshot) {
if (!snapshot.hasData) if (!snapshot.hasData) return const LoadingScreen();
final List<Search> data = snapshot.data!;
if (data.isEmpty)
return const Center( return const Center(
child: Text('The history is empty.\nTry searching for something!'), child: Text('The history is empty.\nTry searching for something!'),
); );
final List<Search> data = snapshot.data!;
return OpaqueBox( return OpaqueBox(
child: ListView.separated( child: ListView.separated(
itemCount: data.length + 1, itemCount: data.length + 1,