Created
August 5, 2021 17:11
-
-
Save termslang/be730dd3890a2e63e7b7c297d4d30245 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import 'package:flutter/material.dart'; | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatefulWidget { | |
@override | |
_LoginDemoState createState() => _LoginDemoState(); | |
} | |
class _LoginDemoState extends State<MyApp> { | |
bool switchValue = false; | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData( | |
canvasColor: switchValue ? Colors.black : Colors.white, | |
primaryColor: switchValue ? Colors.white : Colors.black, | |
primarySwatch: Colors.blue, | |
), | |
home: Scaffold( | |
appBar: AppBar( | |
title: Text("Login Page"), | |
), | |
body: SingleChildScrollView( | |
child: Column( | |
children: <Widget>[ | |
Switch( | |
value: switchValue, | |
onChanged: (bool state) { | |
setState(() { | |
switchValue = state; | |
}); | |
}, | |
), | |
Padding( | |
padding: const EdgeInsets.only(top: 60.0), | |
child: Center( | |
child: Container(width: 200, height: 150, child: FlutterLogo()), | |
), | |
), | |
Padding( | |
padding: EdgeInsets.symmetric(horizontal: 15), | |
child: TextField( | |
decoration: InputDecoration( | |
border: OutlineInputBorder(), | |
labelText: 'Email', | |
hintText: 'Enter valid email id as [email protected]'), | |
), | |
), | |
Padding( | |
padding: const EdgeInsets.only(left: 15.0, right: 15.0, top: 15, bottom: 0), | |
child: TextField( | |
obscureText: true, | |
decoration: InputDecoration( | |
border: OutlineInputBorder(), labelText: 'Password', hintText: 'Enter secure password'), | |
), | |
), | |
TextButton( | |
onPressed: () {}, | |
child: Text( | |
'Forgot Password', | |
style: TextStyle(fontSize: 15), | |
), | |
), | |
Container( | |
height: 50, | |
width: 250, | |
decoration: BoxDecoration(borderRadius: BorderRadius.circular(20)), | |
child: TextButton( | |
onPressed: () {}, | |
child: Text( | |
'Login', | |
style: TextStyle(fontSize: 25), | |
), | |
), | |
), | |
SizedBox( | |
height: 130, | |
), | |
Text('New User? Create Account') | |
], | |
), | |
), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment