RecognitionResultsWidget.dart 2.33 KB
// import 'package:flutter/material.dart';
// import 'package:provider/provider.dart';
// import 'package:speech_to_text/speech_to_text_provider.dart';

// /// Show the most recently recognized speech results and use the level
// /// information to animate the microphone.
// ///
// /// Note that the provider is initialized elsewhere and just accessed
// /// here.
// class RecognitionResultsWidget extends StatelessWidget {
//   const RecognitionResultsWidget({super.key});

//   @override
//   Widget build(BuildContext context) {
//     var speechProvider = Provider.of<SpeechToTextProvider>(context);
//     return Column(
//       children: <Widget>[
//         const Center(
//           child: Text(
//             'Recognized Words',
//             style: TextStyle(fontSize: 22.0),
//           ),
//         ),
//         Expanded(
//           child: Stack(
//             children: <Widget>[
//               Container(
//                 color: Theme.of(context).secondaryHeaderColor,
//                 child: Center(
//                   child: Text(
//                     speechProvider.lastResult?.recognizedWords ?? '',
//                     textAlign: TextAlign.center,
//                   ),
//                 ),
//               ),
//               Positioned.fill(
//                 bottom: 10,
//                 child: Align(
//                   alignment: Alignment.bottomCenter,
//                   child: Container(
//                     width: 40,
//                     height: 40,
//                     alignment: Alignment.center,
//                     decoration: BoxDecoration(
//                       boxShadow: [
//                         BoxShadow(
//                             blurRadius: .26,
//                             spreadRadius: speechProvider.lastLevel * 1.5,
//                             color: Colors.black.withOpacity(.05))
//                       ],
//                       color: Colors.white,
//                       borderRadius: const BorderRadius.all(Radius.circular(50)),
//                     ),
//                     child: IconButton(
//                       icon: const Icon(Icons.mic),
//                       onPressed: () {},
//                     ),
//                   ),
//                 ),
//               ),
//             ],
//           ),
//         ),
//       ],
//     );
//   }
// }