dynamic sizing for practice activity toolbar content
This commit is contained in:
parent
fa4cb10276
commit
9f485ccb05
3 changed files with 41 additions and 59 deletions
|
|
@ -94,7 +94,7 @@ class MultipleChoiceActivityState extends State<MultipleChoiceActivity> {
|
|||
Widget build(BuildContext context) {
|
||||
final PracticeActivityModel practiceActivity = widget.currentActivity;
|
||||
|
||||
return Container(
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
children: [
|
||||
|
|
|
|||
|
|
@ -71,24 +71,16 @@ class GamifiedTextWidget extends StatelessWidget {
|
|||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Center(
|
||||
return Padding(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Column(
|
||||
mainAxisSize: MainAxisSize.min, // Adjusts the size to fit children
|
||||
children: [
|
||||
const SizedBox(height: 10), // Spacing between the star and text
|
||||
// Star animation above the text
|
||||
const StarAnimationWidget(),
|
||||
const SizedBox(height: 10), // Spacing between the star and text
|
||||
Container(
|
||||
constraints: const BoxConstraints(
|
||||
minHeight: 80,
|
||||
),
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: Text(
|
||||
userMessage,
|
||||
style: BotStyle.text(context),
|
||||
textAlign: TextAlign.center, // Center-align the text
|
||||
),
|
||||
const SizedBox(height: 10),
|
||||
Text(
|
||||
userMessage,
|
||||
style: BotStyle.text(context),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
],
|
||||
),
|
||||
|
|
|
|||
|
|
@ -306,54 +306,44 @@ class MessagePracticeActivityCardState extends State<PracticeActivityCard> {
|
|||
}
|
||||
}
|
||||
|
||||
String? get userMessage {
|
||||
if (!fetchingActivity && currentActivity == null) {
|
||||
return L10n.of(context)!.noActivitiesFound;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
if (userMessage != null) {
|
||||
return GamifiedTextWidget(userMessage: userMessage!);
|
||||
if (!fetchingActivity && currentActivity == null) {
|
||||
return GamifiedTextWidget(
|
||||
userMessage: L10n.of(context)!.noActivitiesFound,
|
||||
);
|
||||
}
|
||||
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
return Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
Stack(
|
||||
alignment: Alignment.center,
|
||||
children: [
|
||||
// Main content
|
||||
const Positioned(
|
||||
child: PointsGainedAnimation(),
|
||||
),
|
||||
Container(
|
||||
padding: const EdgeInsets.all(8),
|
||||
child: activityWidget,
|
||||
),
|
||||
// Conditionally show the darkening and progress indicator based on the loading state
|
||||
if (!savoringTheJoy && fetchingActivity) ...[
|
||||
// Semi-transparent overlay
|
||||
Container(
|
||||
color: Colors.black.withOpacity(0.5), // Darkening effect
|
||||
),
|
||||
// Circular progress indicator in the center
|
||||
const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
],
|
||||
// Flag button in the top right corner
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: ContentIssueButton(
|
||||
isActive: currentActivity != null,
|
||||
submitFeedback: submitFeedback,
|
||||
),
|
||||
),
|
||||
],
|
||||
// Main content
|
||||
const Positioned(
|
||||
child: PointsGainedAnimation(),
|
||||
),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(8, 20, 8, 8),
|
||||
child: activityWidget,
|
||||
),
|
||||
// Conditionally show the darkening and progress indicator based on the loading state
|
||||
if (!savoringTheJoy && fetchingActivity) ...[
|
||||
// Semi-transparent overlay
|
||||
Container(
|
||||
color: Colors.black.withOpacity(0.5), // Darkening effect
|
||||
),
|
||||
// Circular progress indicator in the center
|
||||
const Center(
|
||||
child: CircularProgressIndicator(),
|
||||
),
|
||||
],
|
||||
// Flag button in the top right corner
|
||||
Positioned(
|
||||
top: 0,
|
||||
right: 0,
|
||||
child: ContentIssueButton(
|
||||
isActive: currentActivity != null,
|
||||
submitFeedback: submitFeedback,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue