import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
theme: ThemeData(primarySwatch: Colors.purple),
home: HomePage(),
);
}
}
class HomePage extends StatefulWidget {
@override
_HomePageState createState() => _HomePageState();
}
class _HomePageState extends State<HomePage> {
TextEditingController textfield = TextEditingController();
var hellogoogle = "Hello Gooooogle";
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.pink[400],
appBar: AppBar(
title: Text("HomePage Flutter"),
),
body: Container(
child: Padding(
padding: const EdgeInsets.only(
top: 10,
left: 5,
right: 5,
),
child: SingleChildScrollView(
child: Card(
child: Column(
children: [
Image.asset(
"assets/myimg2.jpg",
fit: BoxFit.cover,
),
SizedBox(height: 40),
Text(hellogoogle,
style: TextStyle(
fontSize: 30.0, fontWeight: FontWeight.bold)),
SizedBox(
height: 20,
),
Padding(
padding: const EdgeInsets.all(15.0),
child: TextField(
controller: textfield,
keyboardType: TextInputType.text,
decoration: InputDecoration(
border: OutlineInputBorder(
borderRadius: const BorderRadius.all(
Radius.circular(0),
),
),
hintText: "Enter your email here",
labelText: "Name"),
),
)
],
),
),
),
),
),
floatingActionButton: FloatingActionButton(
onPressed: () {
setState(() {
hellogoogle = textfield.text;
});
},
elevation: 12,
child: Icon(Icons.refresh),
backgroundColor: Colors.purple,
),
drawer: Drawer(
child: ListView(
children: [
UserAccountsDrawerHeader(
accountName: Text("Himasnhu Kr. Tiwari"),
accountEmail: Text("Kumarhimanshu2219@gmail.com"),
currentAccountPicture: CircleAvatar(
backgroundImage: NetworkImage(
"https://images.unsplash.com/photo-1570295999919-56ceb5ecca61?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80")),
),
ListTile(
onTap: () {},
leading: Icon(Icons.person_add),
title: Text("Name"),
trailing: Icon(Icons.edit),
subtitle: Text("PersonalAccount"),
),
ListTile(
leading: Icon(Icons.person),
title: Text("Account"),
trailing: Icon(Icons.edit),
subtitle: Text("PersonalAccount"),
),
ListTile(
leading: Icon(Icons.email),
title: Text("Email"),
trailing: Icon(Icons.send),
subtitle: Text("123@gmail.com"),
),
ListTile(
leading: Icon(Icons.person),
title: Text("Account"),
trailing: Icon(Icons.edit),
subtitle: Text("PersonalAccount"),
),
],
),
),
);
}
}