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) { Widget build(BuildContext context) {
final PracticeActivityModel practiceActivity = widget.currentActivity; final PracticeActivityModel practiceActivity = widget.currentActivity;
return Container( return Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.all(8),
child: Column( child: Column(
children: [ children: [

@ -71,24 +71,16 @@ class GamifiedTextWidget extends StatelessWidget {
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Center( return Padding(
padding: const EdgeInsets.all(8),
child: Column( child: Column(
mainAxisSize: MainAxisSize.min, // Adjusts the size to fit children
children: [ children: [
const SizedBox(height: 10), // Spacing between the star and text
// Star animation above the text
const StarAnimationWidget(), const StarAnimationWidget(),
const SizedBox(height: 10), // Spacing between the star and text const SizedBox(height: 10),
Container( Text(
constraints: const BoxConstraints( userMessage,
minHeight: 80, style: BotStyle.text(context),
), textAlign: TextAlign.center,
padding: const EdgeInsets.all(8),
child: Text(
userMessage,
style: BotStyle.text(context),
textAlign: TextAlign.center, // Center-align the text
),
), ),
], ],
), ),

@ -306,54 +306,44 @@ class MessagePracticeActivityCardState extends State<PracticeActivityCard> {
} }
} }
String? get userMessage {
if (!fetchingActivity && currentActivity == null) {
return L10n.of(context)!.noActivitiesFound;
}
return null;
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
if (userMessage != null) { if (!fetchingActivity && currentActivity == null) {
return GamifiedTextWidget(userMessage: userMessage!); return GamifiedTextWidget(
userMessage: L10n.of(context)!.noActivitiesFound,
);
} }
return Row( return Stack(
mainAxisSize: MainAxisSize.min, alignment: Alignment.center,
children: [ children: [
Stack( // Main content
alignment: Alignment.center, const Positioned(
children: [ child: PointsGainedAnimation(),
// Main content ),
const Positioned( Padding(
child: PointsGainedAnimation(), padding: const EdgeInsets.fromLTRB(8, 20, 8, 8),
), child: activityWidget,
Container( ),
padding: const EdgeInsets.all(8), // Conditionally show the darkening and progress indicator based on the loading state
child: activityWidget, if (!savoringTheJoy && fetchingActivity) ...[
), // Semi-transparent overlay
// Conditionally show the darkening and progress indicator based on the loading state Container(
if (!savoringTheJoy && fetchingActivity) ...[ color: Colors.black.withOpacity(0.5), // Darkening effect
// Semi-transparent overlay ),
Container( // Circular progress indicator in the center
color: Colors.black.withOpacity(0.5), // Darkening effect const Center(
), child: CircularProgressIndicator(),
// Circular progress indicator in the center ),
const Center( ],
child: CircularProgressIndicator(), // Flag button in the top right corner
), Positioned(
], top: 0,
// Flag button in the top right corner right: 0,
Positioned( child: ContentIssueButton(
top: 0, isActive: currentActivity != null,
right: 0, submitFeedback: submitFeedback,
child: ContentIssueButton( ),
isActive: currentActivity != null,
submitFeedback: submitFeedback,
),
),
],
), ),
], ],
); );

Loading…
Cancel
Save