Merge pull request #804 from pangeachat/shrink-activity-done-popup

dynamic sizing for practice activity toolbar content
pull/1428/head
ggurdin 1 year ago committed by GitHub
commit ea04ce9d2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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…
Cancel
Save