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(
minHeight: 80,
),
padding: const EdgeInsets.all(8),
child: Text(
userMessage, userMessage,
style: BotStyle.text(context), style: BotStyle.text(context),
textAlign: TextAlign.center, // Center-align the text textAlign: TextAlign.center,
),
), ),
], ],
), ),

@ -306,31 +306,23 @@ 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,
children: [
Stack(
alignment: Alignment.center, alignment: Alignment.center,
children: [ children: [
// Main content // Main content
const Positioned( const Positioned(
child: PointsGainedAnimation(), child: PointsGainedAnimation(),
), ),
Container( Padding(
padding: const EdgeInsets.all(8), padding: const EdgeInsets.fromLTRB(8, 20, 8, 8),
child: activityWidget, child: activityWidget,
), ),
// Conditionally show the darkening and progress indicator based on the loading state // Conditionally show the darkening and progress indicator based on the loading state
@ -354,8 +346,6 @@ class MessagePracticeActivityCardState extends State<PracticeActivityCard> {
), ),
), ),
], ],
),
],
); );
} }
} }

Loading…
Cancel
Save