Created
December 6, 2019 14:27
-
-
Save magillus/4325ebdd326aa25b6de147e4284dc2d8 to your computer and use it in GitHub Desktop.
Flutter form test
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'; | |
final Color darkBlue = Color.fromARGB(255, 18, 32, 47); | |
void main() { | |
runApp(MyApp()); | |
} | |
class MyApp extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MaterialApp( | |
theme: ThemeData.dark().copyWith(scaffoldBackgroundColor: darkBlue), | |
debugShowCheckedModeBanner: false, | |
home: Scaffold( | |
body: Center( | |
child: MyWidget(), | |
), | |
), | |
); | |
} | |
} | |
class MyWidget extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return Column( | |
children: <Widget>[ | |
Text('Hello, World!', style: Theme.of(context).textTheme.display1), | |
Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: textField("First Name"), | |
), | |
Padding( | |
padding: const EdgeInsets.all(8.0), | |
child: textField("Last Name"), | |
), | |
], | |
); | |
} | |
Widget textField(String label) { | |
return TextFormField( | |
decoration: InputDecoration( | |
labelText: label, | |
border: OutlineInputBorder(), | |
), | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment