Stock Manager UI Simple

 import "package:flutter/material.dart";


void main() {
runApp(const MyApp());
}

class MyApp extends StatelessWidget {
const MyApp({super.key});

@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Hello",
debugShowCheckedModeBanner: false,
theme: ThemeData(
primarySwatch: Colors.deepPurple,
),
home: const FlutterApp(),
);
}
}

class FlutterApp extends StatefulWidget {
const FlutterApp({super.key});

@override
State<StatefulWidget> createState() {
return FlutterState();
}
}

class FlutterState extends State<FlutterApp> {
var myController = TextEditingController();
var nyController = TextEditingController();

bool _isObscure = true;

@override
Widget build(BuildContext context) {
/*var arrNames = ["Raman","Rajesh","Ramanujan","jay","Akshar","Aakash","Ajay"];*/

/*The GestureDetector is super helpful in detecting the various types of gestures such as onTap,onDoubleTap,onLongPress,etc.*/
return GestureDetector(
onTap: () {
FocusManager.instance.primaryFocus?.unfocus();
/*The FocusManager.instance.primaryFocus?.unfocus() first checks whether any TextField is in Focus or not.
If the TextField is in focus then it removes the focus from the TextField thereby closing the on-screen keyboard.*/
},
child: Scaffold(
endDrawer: const Drawer(),
drawer: Drawer(
child: ListView(
padding: EdgeInsets.zero,
children: [
UserAccountsDrawerHeader(
accountName: const Text("Heer"),
accountEmail: const Text("Heer@example.com"),
/*currentAccountPicture: const CircleAvatar(backgroundImage: AssetImage("assets/images/Flutter_Logo.png")),*/
currentAccountPicture: const CircleAvatar(
child: Icon(Icons.account_circle, size: 75)),
/*currentAccountPicture: const FlutterLogo(),*/

decoration: BoxDecoration(
color: Colors.deepPurple,
borderRadius: BorderRadius.circular(15),
),
/*child: const Text("Drawer Header", style: TextStyle(color: Colors.white, fontSize: 24)),*/
),
ListTile(
leading: const Icon(
Icons.message,
color: Colors.black,
),
title: const Text("message"),
onTap: () {
Navigator.pop(context);
},
),
const Divider(thickness: 1, color: Colors.black),
ListTile(
leading: const Icon(
Icons.account_circle,
color: Colors.black,
),
title: const Text("Profile"),
onTap: () {
Navigator.pop(context);
},
),
const Divider(thickness: 1, color: Colors.black),
ListTile(
leading: const Icon(
Icons.settings,
color: Colors.black,
),
title: const Text("Settings"),
onTap: () {
Navigator.pop(context);
},
),
const Divider(thickness: 1, color: Colors.black),
ListTile(
leading: const Icon(
Icons.help_outline,
color: Colors.black,
),
title: const Text("Help & feedback"),
onTap: () {
Navigator.pop(context);
},
),
const Divider(thickness: 1, color: Colors.black),
ListTile(
leading: const Icon(
Icons.restore_from_trash,
color: Colors.black,
),
title: const Text("Trash"),
onTap: () {
Navigator.pop(context);
},
),
],
),
),
appBar: AppBar(
title: const Text(
"Flutter Stock Manager",
style: TextStyle(fontWeight: FontWeight.bold),
),
centerTitle: true,
backgroundColor: Colors.grey,
),
body: Center(
child: SizedBox(
width: 350,
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"Login",
style: Theme.of(context).textTheme.headlineMedium,
),
const SizedBox(
height: 45,
),
TextField(
obscureText: false,
controller: myController,
decoration: InputDecoration(
hintText: "please Enter username...",
labelText: "Username",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(
color: Colors.blue,
/*style: BorderStyle.solid,*/
),
),
/*this button is used to toggle the password visibility*/
suffixIcon: IconButton(
onPressed: () {},
icon: const Icon(Icons.account_box),
),
),
),
const SizedBox(
height: 50,
),
TextField(
/*obscureText: false,*/
obscureText: _isObscure,
controller: nyController,
decoration: InputDecoration(
hintText: "please Enter password...",
labelText: "Password",
border: OutlineInputBorder(
borderRadius: BorderRadius.circular(25),
borderSide: const BorderSide(
color: Colors.blue,
),
),
/*this button is used to toggle the password visibility*/
suffixIcon: IconButton(
icon: Icon(
_isObscure ? Icons.visibility : Icons.visibility_off,
color: Colors.black,
),
onPressed: () {
setState(
() {
_isObscure = !_isObscure;
},
);
},
),
),
),
const SizedBox(
height: 50,
),
SizedBox(
width: 350,
child: ElevatedButton(
onPressed: () {
/*print("Data Stored!");*/
showDialog(
context: context,
builder: (context) {
return AlertDialog(
title: Text(nyController.text),
/*"text" property of the controller to get the value entered in the TextField*/
content: Text(myController.text),
);
},
);
},
style: ElevatedButton.styleFrom(
backgroundColor: Colors.blue,
fixedSize: const Size(350.0, 50.0),
),
child: const Center(
child: Text(
"Login",
style: TextStyle(
fontSize: 20,
fontWeight: FontWeight.bold,
color: Colors.white),
),
),
),
),
],
),
),
),
),
);
}
}

Comments

Popular posts from this blog

Second GET API Calling with Bloc simple Example in Flutter

Stack Container Scrollable Card widget UI with Custom Widget

Pagination with Bloc Pattern in Flutter