added first working prototype of flashcards

This commit is contained in:
odweta
2026-04-02 20:35:09 +02:00
parent 51ce826de6
commit eae9e34ddf
4 changed files with 68 additions and 13 deletions
+26
View File
@@ -4,6 +4,7 @@ import 'package:flutter/material.dart';
import 'package:frontend/model/quote.dart';
import 'package:frontend/repository/quote_repository.dart';
import 'dart:math';
class QuoteProvider extends ChangeNotifier {
List<Quote> _quotes = [];
@@ -44,6 +45,31 @@ class QuoteProvider extends ChangeNotifier {
filterController.text = '';
}
Quote randomQuote = Quote(
id: 0,
body: "quote text",
author: "dummy"
);
bool randomQuoteDeterminator = true;
String get randomQuoteText {
if (randomQuoteDeterminator) {
return randomQuote.body;
} else {
return randomQuote.author;
}
}
void flipRandomQuote() {
randomQuoteDeterminator = !randomQuoteDeterminator;
notifyListeners();
}
void nextRandomQuote() {
final random = Random();
randomQuote = filteredQuotes[random.nextInt(filteredQuotes.length)];
notifyListeners();
}
void filterQuotes() {
notifyListeners();
}