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
+37 -12
View File
@@ -1,7 +1,6 @@
import 'package:flutter/material.dart';
import 'package:frontend/provider/quote_provider.dart';
import 'package:frontend/model/quote.dart';
import 'package:provider/provider.dart';
@@ -15,6 +14,8 @@ class FlashcardsPage extends StatelessWidget {
Widget build(BuildContext context) {
//return const Center(child: Text('flashcards! flip flip'));
final provider = Provider.of<QuoteProvider>(context);
if (provider.randomQuoteText == "dummy" ||
provider.randomQuoteText == "quote text") { provider.nextRandomQuote(); } // initialize the random quote variable
return Card(
margin: const EdgeInsets.all(Constants.edgeInset),
child: Padding(
@@ -22,22 +23,46 @@ class FlashcardsPage extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text('insert random quote body here'),
Padding(
padding: const EdgeInsets.all(Constants.edgeInset*2),
child: Text(provider.randomQuoteText,
style: TextStyle(
fontSize: 35,
),
),
),
Row(
mainAxisAlignment: MainAxisAlignment.center,
children: [
TextButton(
child: Text('flip around'),
onPressed: () {
// TODO: flip the card
},
Padding(
padding: const EdgeInsets.all(Constants.edgeInset),
child: TextButton.icon(
onPressed: provider.flipRandomQuote,
icon: Icon(Icons.repeat,
size: 35,
),
label: Text(Strings.flipFlashcard,
style: TextStyle(
fontSize: 35,
),
),
),
),
TextButton(
child: Text('next card'),
onPressed: () {
// TODO: next random card
},
Padding(
padding: const EdgeInsets.all(Constants.edgeInset),
child: TextButton.icon(
onPressed: provider.nextRandomQuote,
icon: Icon(Icons.arrow_right_alt,
size: 35,
),
label: Text(Strings.nextFlashcard,
style: TextStyle(
fontSize: 35,
),
),
),
),
],
),