* chore: move logic for lastUsedByActivityType into ConstructIdentifier * feat: vocab practice * add vocab activity progress bar * fix: shuffle audio practice choices * update UI of vocab practice Added buttons, increased text size and change position, cards flip over and turn red/green on click and respond to hover input * add xp sparkle, shimmering choice card placeholder * spacing changes fix padding, make choice cards spacing/sizing responsive to screen size, replace shimmer cards with stationary circle indicator * don't include duplicate lemma choices * use constructID and show lemma/emoji on choice cards add method to clear cache in case the results was an error, and add a retry button on error * gain xp immediately and take out continue session also refactor the choice cards to have separate widgets for each type and a parent widget to give each an id for xp sparkle * add practice finished page with analytics * Color tweaks on completed page and time card placeholder * add timer * give XP for bonuses and change timer to use stopwatch * simplify card logic, lock practice when few vocab words * merge analytics changes and fix bugs * reload on language change - derive XP data from new analytics - Don't allow any clicks after correct answer selected * small fixes, added tooltip, added copy to l10 * small tweaks and comments * formatting and import sorting --------- Co-authored-by: avashilling <165050625+avashilling@users.noreply.github.com>
67 lines
1.9 KiB
Dart
67 lines
1.9 KiB
Dart
import 'dart:math';
|
|
|
|
import 'package:flutter/material.dart';
|
|
|
|
import 'package:fluffychat/config/app_config.dart';
|
|
import 'package:fluffychat/config/themes.dart';
|
|
|
|
class AnimatedProgressBar extends StatelessWidget {
|
|
final double height;
|
|
final double widthPercent;
|
|
|
|
final Color barColor;
|
|
final Color? backgroundColor;
|
|
final Duration? duration;
|
|
|
|
const AnimatedProgressBar({
|
|
required this.height,
|
|
required this.widthPercent,
|
|
this.barColor = AppConfig.goldLight,
|
|
this.backgroundColor,
|
|
this.duration,
|
|
super.key,
|
|
});
|
|
|
|
@override
|
|
Widget build(BuildContext context) {
|
|
return LayoutBuilder(
|
|
builder: (context, constraints) {
|
|
return Stack(
|
|
alignment: Alignment.centerLeft,
|
|
children: [
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 2),
|
|
child: Container(
|
|
height: height,
|
|
width: constraints.maxWidth,
|
|
decoration: BoxDecoration(
|
|
borderRadius: const BorderRadius.all(
|
|
Radius.circular(AppConfig.borderRadius),
|
|
),
|
|
color: backgroundColor ??
|
|
Theme.of(context).colorScheme.secondaryContainer,
|
|
),
|
|
),
|
|
),
|
|
Padding(
|
|
padding: const EdgeInsets.symmetric(horizontal: 2),
|
|
child: AnimatedContainer(
|
|
duration: duration ?? FluffyThemes.animationDuration,
|
|
height: height,
|
|
width: widthPercent == 0
|
|
? 0
|
|
: max(18, constraints.maxWidth * widthPercent),
|
|
decoration: BoxDecoration(
|
|
color: barColor,
|
|
borderRadius: const BorderRadius.all(
|
|
Radius.circular(AppConfig.borderRadius),
|
|
),
|
|
),
|
|
),
|
|
),
|
|
],
|
|
);
|
|
},
|
|
);
|
|
}
|
|
}
|