Skip to content

Instantly share code, notes, and snippets.

@magillus
Created December 6, 2019 14:27
Show Gist options
  • Save magillus/4325ebdd326aa25b6de147e4284dc2d8 to your computer and use it in GitHub Desktop.
Save magillus/4325ebdd326aa25b6de147e4284dc2d8 to your computer and use it in GitHub Desktop.
Flutter form test
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