-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstful.dart
50 lines (45 loc) · 1.16 KB
/
stful.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
import 'package:flutter/material.dart';
void main() {
runApp(MaterialApp(
title: "Stateful App",
home: FavoriteCity(),
));
}
class FavoriteCity extends StatefulWidget {
@override
_FavoriteCityState createState() => _FavoriteCityState();
}
class _FavoriteCityState extends State<FavoriteCity> {
String nameCity;
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("Stateful App"),
),
body: Container(
margin: EdgeInsets.only(top: 10.0),
child: Column(
children: <Widget>[
TextField(
onChanged: (String userInput) {
setState(() {
nameCity = userInput;
});
},
),
Padding(
padding: EdgeInsets.all(30.0),
child: Text(
"Your fvourite city is ${nameCity}",
style: TextStyle(
fontFamily: 'Raleway',
fontWeight: FontWeight.w700,
color: Colors.blueAccent),
)),
],
),
),
);
}
}