Convert statefull Widget and add request
This commit is contained in:
@@ -3,6 +3,7 @@ import 'dart:math';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rive/rive.dart';
|
import 'package:rive/rive.dart';
|
||||||
import 'package:motula_translate_app/constants.dart';
|
import 'package:motula_translate_app/constants.dart';
|
||||||
|
import 'package:motula_translate_app/screens/home/home_sreen_statefull.dart';
|
||||||
import 'package:motula_translate_app/screens/home/home_screen.dart';
|
import 'package:motula_translate_app/screens/home/home_screen.dart';
|
||||||
import 'package:motula_translate_app/utils/rive_utils.dart';
|
import 'package:motula_translate_app/utils/rive_utils.dart';
|
||||||
|
|
||||||
@@ -91,7 +92,7 @@ class _EntryPointState extends State<EntryPoint> with SingleTickerProviderStateM
|
|||||||
borderRadius: BorderRadius.all(
|
borderRadius: BorderRadius.all(
|
||||||
Radius.circular(24),
|
Radius.circular(24),
|
||||||
),
|
),
|
||||||
child: HomePage(),
|
child: homepagestful(), //HomePage(),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|||||||
113
motula_translate_app/lib/screens/home/home_sreen_statefull.dart
Normal file
113
motula_translate_app/lib/screens/home/home_sreen_statefull.dart
Normal file
@@ -0,0 +1,113 @@
|
|||||||
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import '../../model/word.dart';
|
||||||
|
import 'components/words_screen.dart';
|
||||||
|
|
||||||
|
class homepagestful extends StatefulWidget {
|
||||||
|
const homepagestful({super.key});
|
||||||
|
|
||||||
|
|
||||||
|
@override
|
||||||
|
State<homepagestful> createState() => _homepagestfulState();
|
||||||
|
}
|
||||||
|
|
||||||
|
class _homepagestfulState extends State<homepagestful> {
|
||||||
|
final TextEditingController _textHomepageContoller = TextEditingController();
|
||||||
|
late List<WordsScreen> listaWidget;
|
||||||
|
|
||||||
|
@override
|
||||||
|
void dispose() {
|
||||||
|
_textHomepageContoller.dispose();
|
||||||
|
super.dispose();
|
||||||
|
}
|
||||||
|
|
||||||
|
@override
|
||||||
|
Widget build(BuildContext context) {
|
||||||
|
return Scaffold(
|
||||||
|
body: SingleChildScrollView(
|
||||||
|
child: Column(
|
||||||
|
children: [
|
||||||
|
const SizedBox(height: 50),
|
||||||
|
Image.asset('assets/Logo/logoMottola.png', width: 250, height: 250),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Row(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
Image.asset('assets/icons/italy.png', width: 40, height: 40),
|
||||||
|
const SizedBox(width: 20),
|
||||||
|
Image.asset('assets/icons/next.png', width: 30, height:30),
|
||||||
|
const SizedBox(width: 10),
|
||||||
|
//Text(' --> ', style: TextStyle(fontSize: 30, color: Colors.grey[800])),
|
||||||
|
Image.asset('assets/icons/flagMottola.png', width: 54, height: 54),
|
||||||
|
]),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
TextField(
|
||||||
|
controller: _textHomepageContoller,
|
||||||
|
keyboardType: TextInputType.multiline,
|
||||||
|
maxLines: null,
|
||||||
|
style: TextStyle(fontSize: 20, color: Colors.grey[800]),
|
||||||
|
decoration: const InputDecoration(
|
||||||
|
hintText: 'Parola Italiana',
|
||||||
|
hintStyle: TextStyle(fontSize: 20)
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
Container(
|
||||||
|
margin: const EdgeInsets.all(10.0),
|
||||||
|
width: 500,
|
||||||
|
height: 100,
|
||||||
|
decoration: BoxDecoration(
|
||||||
|
color: const Color(0x9121781C),
|
||||||
|
borderRadius: BorderRadius.circular(10.0),
|
||||||
|
),
|
||||||
|
child: const Column(
|
||||||
|
mainAxisAlignment: MainAxisAlignment.center,
|
||||||
|
crossAxisAlignment: CrossAxisAlignment.center,
|
||||||
|
children: [
|
||||||
|
WordsScreen(),
|
||||||
|
//Align(
|
||||||
|
// alignment: Alignment.center,
|
||||||
|
// child: Text("ESEMPIO",
|
||||||
|
// style: TextStyle(fontSize: 30, color: Color(0xFFFFFFFF),fontWeight: FontWeight.bold)),
|
||||||
|
//),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
),
|
||||||
|
const SizedBox(height: 20),
|
||||||
|
TextButton(
|
||||||
|
onPressed: () {
|
||||||
|
showDialog(
|
||||||
|
context: context,
|
||||||
|
builder: (context) {
|
||||||
|
if (_textHomepageContoller.text.isEmpty){
|
||||||
|
return const AlertDialog(
|
||||||
|
|
||||||
|
content: Text('Inserisci la parola italiana da tradurre', style: TextStyle(color: Color(
|
||||||
|
0xFFFF0000), fontSize: 25, fontWeight: FontWeight.bold)),
|
||||||
|
);
|
||||||
|
}else{
|
||||||
|
//return AlertDialog(
|
||||||
|
// Retrieve the text the that user has entered by using the
|
||||||
|
// TextEditingController.
|
||||||
|
// content: Text(_textHomepageContoller.text),
|
||||||
|
//);
|
||||||
|
|
||||||
|
return WordsScreen();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
},
|
||||||
|
child: Text('Traduci'),
|
||||||
|
style: ElevatedButton.styleFrom(
|
||||||
|
backgroundColor: const Color(0xFFDF930B),
|
||||||
|
padding: const EdgeInsets.symmetric(horizontal: 30, vertical: 20),
|
||||||
|
textStyle: const TextStyle(
|
||||||
|
fontSize: 15,
|
||||||
|
fontWeight: FontWeight.bold)),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user