You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
fluffychat/lib/pangea/choreographer/widgets/it_bar_buttons.dart

80 lines
2.1 KiB
Dart

2 years ago
import 'package:flutter/material.dart';
2 years ago
import 'package:fluffychat/pangea/controllers/pangea_controller.dart';
import 'package:fluffychat/pangea/utils/instructions.dart';
import 'package:fluffychat/widgets/matrix.dart';
import '../../widgets/common/bot_face_svg.dart';
import '../controllers/choreographer.dart';
import '../controllers/it_controller.dart';
class ITCloseButton extends StatelessWidget {
const ITCloseButton({
2 years ago
super.key,
2 years ago
required this.choreographer,
2 years ago
});
2 years ago
final Choreographer choreographer;
@override
Widget build(BuildContext context) {
return IconButton(
icon: const Icon(Icons.close_outlined),
onPressed: () {
if (choreographer.itController.isEditingSourceText) {
choreographer.itController.setIsEditingSourceText(false);
} else {
choreographer.itController.closeIT();
}
},
);
}
}
class ITBotButton extends StatelessWidget {
2 years ago
const ITBotButton({super.key, required this.choreographer});
2 years ago
final Choreographer choreographer;
@override
Widget build(BuildContext context) {
choreographer.pangeaController.instructions.show(
context,
InstructionsEnum.itInstructions,
choreographer.itBotTransformTargetKey,
true,
);
return IconButton(
icon: const BotFace(width: 40.0, expression: BotExpression.idle),
2 years ago
onPressed: () => choreographer.pangeaController.instructions.show(
context,
InstructionsEnum.itInstructions,
choreographer.itBotTransformTargetKey,
false,
),
);
}
}
class ITRestartButton extends StatelessWidget {
ITRestartButton({
2 years ago
super.key,
2 years ago
required this.controller,
2 years ago
});
2 years ago
final ITController controller;
final PangeaController pangeaController = MatrixState.pangeaController;
@override
Widget build(BuildContext context) {
return IconButton(
onPressed: () async {
controller.choreographer.errorService.resetError();
controller.currentITStep = null;
controller.choreographer.getLanguageHelp();
},
icon: const Icon(Icons.refresh_outlined),
);
}
}