Skip to content

Instantly share code, notes, and snippets.

@oluyoung
Created May 8, 2024 21:52
Show Gist options
  • Save oluyoung/fc1f5f1f3404766902e7249f2ef6f343 to your computer and use it in GitHub Desktop.
Save oluyoung/fc1f5f1f3404766902e7249f2ef6f343 to your computer and use it in GitHub Desktop.
Generated code from pixels2flutter.dev
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: SignUpScreen(),
);
}
}
class SignUpScreen extends StatefulWidget {
@override
_SignUpScreenState createState() => _SignUpScreenState();
}
class _SignUpScreenState extends State<SignUpScreen> {
bool _termsAccepted = false;
@override
Widget build(BuildContext context) {
return Scaffold(
backgroundColor: Colors.white,
body: SafeArea(
child: Padding(
padding: EdgeInsets.symmetric(horizontal: 24.0),
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
crossAxisAlignment: CrossAxisAlignment.stretch,
children: [
Text(
'Sign Up',
style: TextStyle(
fontSize: 32.0,
fontWeight: FontWeight.bold,
),
textAlign: TextAlign.center,
),
SizedBox(height: 8.0),
Text(
'Hi, we just need a few details about you',
style: TextStyle(
fontSize: 16.0,
),
textAlign: TextAlign.center,
),
SizedBox(height: 48.0),
TextField(
decoration: InputDecoration(
labelText: 'First Name',
border: OutlineInputBorder(),
),
),
SizedBox(height: 16.0),
TextField(
decoration: InputDecoration(
labelText: 'Last Name',
border: OutlineInputBorder(),
),
),
SizedBox(height: 16.0),
TextField(
decoration: InputDecoration(
labelText: 'Date of birth',
border: OutlineInputBorder(),
),
),
SizedBox(height: 24.0),
Row(
children: [
Checkbox(
value: _termsAccepted,
onChanged: (bool? newValue) {
setState(() {
_termsAccepted = newValue!;
});
},
),
Expanded(
child: Text(
'By clicking sign up you agree to our terms and conditions',
style: TextStyle(
fontSize: 14.0,
),
),
),
],
),
SizedBox(height: 24.0),
ElevatedButton(
onPressed: _termsAccepted ? () {} : null,
child: Text('Sign Up'),
style: ElevatedButton.styleFrom(
primary: Colors.green,
padding: EdgeInsets.symmetric(vertical: 16.0),
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(30.0),
),
),
),
],
),
),
),
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment