now displaying score for pronunciation
parent
6cfdd349bd
commit
191fc69628
@ -1,29 +0,0 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class SpeechToTextScoreWidget extends StatefulWidget {
|
||||
final int score;
|
||||
const SpeechToTextScoreWidget({super.key, required this.score});
|
||||
|
||||
@override
|
||||
SpeechToTextScoreWidgetState createState() => SpeechToTextScoreWidgetState();
|
||||
}
|
||||
|
||||
class SpeechToTextScoreWidgetState extends State<SpeechToTextScoreWidget> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Padding(
|
||||
padding: const EdgeInsets.symmetric(vertical: 8.0),
|
||||
child: AnimatedSwitcher(
|
||||
duration: const Duration(milliseconds: 500),
|
||||
transitionBuilder: (Widget child, Animation<double> animation) {
|
||||
return FadeTransition(opacity: animation, child: child);
|
||||
},
|
||||
child: Text(
|
||||
'Score: ${widget.score}',
|
||||
key: ValueKey<int>(widget.score),
|
||||
style: const TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
|
||||
),
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
import 'package:flutter/material.dart';
|
||||
|
||||
class IconNumberWidget extends StatelessWidget {
|
||||
final IconData icon;
|
||||
final String number;
|
||||
final Color? iconColor;
|
||||
final double? iconSize;
|
||||
final String? toolTip;
|
||||
|
||||
const IconNumberWidget({
|
||||
super.key,
|
||||
required this.icon,
|
||||
required this.number,
|
||||
this.toolTip,
|
||||
this.iconColor,
|
||||
this.iconSize,
|
||||
});
|
||||
|
||||
Widget _content(BuildContext context) {
|
||||
return Row(
|
||||
mainAxisSize: MainAxisSize.min,
|
||||
children: <Widget>[
|
||||
Icon(
|
||||
icon,
|
||||
color: iconColor ?? Theme.of(context).iconTheme.color,
|
||||
size: iconSize ?? Theme.of(context).iconTheme.size,
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
Text(
|
||||
number.toString(),
|
||||
style: TextStyle(
|
||||
fontSize:
|
||||
iconSize ?? Theme.of(context).textTheme.bodyMedium?.fontSize,
|
||||
color: iconColor ?? Theme.of(context).textTheme.bodyMedium?.color,
|
||||
),
|
||||
),
|
||||
],
|
||||
);
|
||||
}
|
||||
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return toolTip != null
|
||||
? Tooltip(message: toolTip!, child: _content(context))
|
||||
: _content(context);
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue