fixed issue #4

This commit is contained in:
odweta
2026-04-03 17:31:08 +02:00
parent 032634f461
commit e7de0d7e5f
+51 -29
View File
@@ -1,9 +1,6 @@
import 'package:flutter/material.dart';
import 'package:frontend/provider/quote_provider.dart';
import 'package:provider/provider.dart';
import 'package:frontend/values/strings.dart';
import 'package:frontend/values/constants.dart';
@@ -13,6 +10,9 @@ class FlashcardsPage extends StatelessWidget {
@override
Widget build(BuildContext context) {
final provider = Provider.of<QuoteProvider>(context);
final screenWidth = MediaQuery.of(context).size.width;
return Card(
margin: const EdgeInsets.all(Constants.edgeInset),
child: Padding(
@@ -20,43 +20,65 @@ class FlashcardsPage extends StatelessWidget {
child: Column(
mainAxisSize: MainAxisSize.min,
crossAxisAlignment: CrossAxisAlignment.center,
mainAxisAlignment: MainAxisAlignment.center,
children: [
const Spacer(),
Padding(
padding: const EdgeInsets.all(Constants.edgeInset*2),
child: Text(provider.randomQuoteText,
padding: const EdgeInsets.all(Constants.edgeInset),
child: Text(
provider.randomQuoteText,
textAlign: TextAlign.center,
style: TextStyle(
fontSize: 35,
fontSize: screenWidth * 0.06, // responsive text
fontWeight: FontWeight.w500,
),
),
),
Column(
mainAxisAlignment: MainAxisAlignment.end,
const Spacer(),
// Buttons side by side
Row(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
children: [
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,
Expanded(
child: Padding(
padding: const EdgeInsets.all(Constants.edgeInset),
child: TextButton.icon(
onPressed: provider.flipRandomQuote,
icon: const Icon(
Icons.repeat,
size: 28,
),
label: Text(
Strings.flipFlashcard,
style: TextStyle(
fontSize: screenWidth * 0.045,
),
),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
),
),
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,
Expanded(
child: Padding(
padding: const EdgeInsets.all(Constants.edgeInset),
child: TextButton.icon(
onPressed: provider.nextRandomQuote,
icon: const Icon(
Icons.arrow_right_alt,
size: 28,
),
label: Text(
Strings.nextFlashcard,
style: TextStyle(
fontSize: screenWidth * 0.045,
),
),
style: TextButton.styleFrom(
padding: const EdgeInsets.symmetric(vertical: 16),
),
),
),