Added New Bot with Animations

pull/1384/head
Matthew 1 year ago
parent 94f87a5312
commit 89e726b963

@ -231,30 +231,6 @@ class ITController {
_setSourceText(); _setSourceText();
getTranslationData(false); getTranslationData(false);
/*sourceText = newSourceText;
final String currentText = choreographer.currentText;
choreographer.startLoading();
final List<ITResponseModel> responses = await Future.wait([
_customInputTranslation(""),
_customInputTranslation(choreographer.currentText),
]);
if (responses[0].goldContinuances != null &&
responses[0].goldContinuances!.isNotEmpty) {
goldRouteTracker = GoldRouteTracker(
responses[0].goldContinuances!,
sourceText!,
);
}
currentITStep = CurrentITStep(
sourceText: sourceText!,
currentText: currentText,
responseModel: responses[1],
storedGoldContinuances: goldRouteTracker.continuances,
);
_addPayloadId(responses[1]);*/
} catch (err, stack) { } catch (err, stack) {
debugger(when: kDebugMode); debugger(when: kDebugMode);
if (err is! http.Response) { if (err is! http.Response) {

@ -142,7 +142,7 @@ class UserController extends BaseController {
await updateMatrixProfile( await updateMatrixProfile(
dateOfBirth: dob, dateOfBirth: dob,
autoPlayMessages: autoPlay, autoPlayMessages: autoPlay ?? false,
activatedFreeTrial: trial, activatedFreeTrial: trial,
interactiveTranslator: interactiveTranslator, interactiveTranslator: interactiveTranslator,
itAutoPlay: itAutoPlay, itAutoPlay: itAutoPlay,

@ -1,8 +1,13 @@
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:rive/rive.dart';
enum BotExpression { surprised, right, addled, left, down, shocked } enum BotExpression { surprised, right, addled, left, down, shocked }
class BotFace extends StatelessWidget { class BotFace extends StatefulWidget {
final double width;
final Color? forceColor;
final BotExpression expression;
const BotFace({ const BotFace({
super.key, super.key,
required this.width, required this.width,
@ -10,21 +15,68 @@ class BotFace extends StatelessWidget {
this.forceColor, this.forceColor,
}); });
final double width; @override
final Color? forceColor; BotFaceState createState() => BotFaceState();
final BotExpression expression; }
class BotFaceState extends State<BotFace> {
Artboard? _artboard;
SMINumber? _input;
@override
void initState() {
super.initState();
_loadRiveFile();
}
double mapExpressionToInput(BotExpression expression) {
switch (expression) {
case BotExpression.surprised:
return 1.0;
case BotExpression.right:
return 2.0;
case BotExpression.shocked:
return 3.0;
case BotExpression.addled:
return 4.0;
default:
return 0.0;
}
}
Future<void> _loadRiveFile() async {
final riveFile = await RiveFile.asset('assets/pangea/bot_faces/pangea_bot.riv');
final artboard = riveFile.mainArtboard;
final controller = StateMachineController
.fromArtboard(artboard, 'BotIconStateMachine');
if (controller != null) {
artboard.addController(controller);
_input = controller.findInput("Enter State") as SMINumber?;
controller.setInputValue(
890, // this should be the id of the input
mapExpressionToInput(widget.expression),
);
}
setState(() {
_artboard = artboard;
});
}
@override @override
Widget build(BuildContext context) { Widget build(BuildContext context) {
return Image.asset(
'assets/pangea/bot_faces/${expression.toString().split('.').last}.png', return SizedBox(
// 'assets/pangea/bot_faces/surprised.png', width: widget.width,
width: width, height: widget.width,
height: width, child: _artboard != null
// color: forceColor ?? ? Rive(
// (Theme.of(context).brightness == Brightness.light artboard: _artboard!,
// ? Theme.of(context).colorScheme.primary fit: BoxFit.cover,
// : Theme.of(context).colorScheme.primary), )
: Container(),
); );
} }
} }

@ -124,6 +124,7 @@ dependencies:
sentry_flutter: ^8.2.0 sentry_flutter: ^8.2.0
shimmer: ^3.0.0 shimmer: ^3.0.0
syncfusion_flutter_xlsio: ^25.1.40 syncfusion_flutter_xlsio: ^25.1.40
rive: 0.11.11
# Pangea# # Pangea#
dev_dependencies: dev_dependencies:
@ -212,4 +213,4 @@ dependency_overrides:
keyboard_shortcuts: keyboard_shortcuts:
git: git:
url: https://github.com/TheOneWithTheBraid/keyboard_shortcuts.git url: https://github.com/TheOneWithTheBraid/keyboard_shortcuts.git
ref: null-safety ref: null-safety

Loading…
Cancel
Save