multiple cases

This commit is contained in:
ycc
2024-03-26 11:48:31 +01:00
parent ae023d3f00
commit fff4e8d85b
3 changed files with 64 additions and 15 deletions

View File

@ -3,6 +3,7 @@ import 'package:flutter/material.dart';
import 'package:flutter/foundation.dart';
import 'audio_player.dart';
import 'audio_recorder.dart';
import 'package:google_fonts/google_fonts.dart';
void main() {
runApp(const MyApp());
@ -61,7 +62,7 @@ class MyHomePage extends StatefulWidget {
class _MyHomePageState extends State<MyHomePage> {
String _key = ' ';
bool showPlayer = false;
bool record = true;
bool record = false;
String? audioPath;
@override
@ -89,11 +90,13 @@ class _MyHomePageState extends State<MyHomePage> {
setState(() {
_key = " ";
// check if the key is a letter between a and z
if (key.length == 1 && key.codeUnitAt(0) >= 65 && key.codeUnitAt(0) <= 90)
if (key.length == 1 && key.codeUnitAt(0) >= 65 && key.codeUnitAt(0) <= 90) {
_key = key;
}
// check if the key is a number between 0 and 9
if (key.length == 1 && key.codeUnitAt(0) >= 48 && key.codeUnitAt(0) <= 57)
if (key.length == 1 && key.codeUnitAt(0) >= 48 && key.codeUnitAt(0) <= 57) {
_key = key;
}
});
return true;
}
@ -165,13 +168,18 @@ class _MyHomePageState extends State<MyHomePage> {
mainAxisAlignment: MainAxisAlignment.center,
children: <Widget>[
Text(
'$_key',
_key+" "+_key.toLowerCase(),
// set text color to white
style: TextStyle(
style: const TextStyle(
color: Colors.lightGreen,
fontSize: 160.0, // Change this to your preferred color
),
),
Text(
_key+" "+_key.toLowerCase(),
// set text color to white
style: GoogleFonts.getFont('Dancing Script',color: Colors.lightGreen,fontSize: 160.0),
),
],
),