0% found this document useful (0 votes)
2 views

flutter_widgets_demo

This document is a Flutter application that demonstrates common widgets such as Text, TextField, Switch, Checkbox, and ElevatedButton. It features a home page with a greeting, a welcome message, and interactive elements that allow user input and navigation to a submission page. The app is structured with a main function, a stateless widget for the main app, and another for the home page, showcasing basic Flutter layout and functionality.

Uploaded by

Prem Gharge
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

flutter_widgets_demo

This document is a Flutter application that demonstrates common widgets such as Text, TextField, Switch, Checkbox, and ElevatedButton. It features a home page with a greeting, a welcome message, and interactive elements that allow user input and navigation to a submission page. The app is structured with a main function, a stateless widget for the main app, and another for the home page, showcasing basic Flutter layout and functionality.

Uploaded by

Prem Gharge
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

import 'package:flutter/material.

dart';

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

class MyApp extends StatelessWidget {


@override
Widget build(BuildContext context) {
return MaterialApp(
debugShowCheckedModeBanner: false,
home: HomePage(),
);
}
}

class HomePage extends StatelessWidget {


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Common Widgets Demo'),
backgroundColor: Colors.blue,
),
body: SingleChildScrollView(
child: Padding(
padding: const EdgeInsets.all(16.0),
child: Column(
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'Hello, Flutter!',
style: TextStyle(
fontSize: 24,
fontWeight: FontWeight.bold,
),
),

SizedBox(height: 16),
Container(
padding: EdgeInsets.all(16),
color: Colors.blue[100],
child: Text('WELCOME TO FLUTTER APP.'),
),
SizedBox(height: 16),
TextField(
decoration: InputDecoration(
labelText: 'Enter your name',
border: OutlineInputBorder(),
),
),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Enable notifications'),
Switch(
value: true,
onChanged: (bool value) {},
),
],
),
SizedBox(height: 16),
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text('Accept terms'),
Checkbox(
value: true,
onChanged: (bool? value) {},
),
],
),
SizedBox(height: 16),
ElevatedButton(
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(builder: (context) => SubmittedPage()),
);
},
child: Text('Click Me'),
),
],
),
),
),
);
}
}

class SubmittedPage extends StatelessWidget {


@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text('Submission Page'),
backgroundColor: Colors.blue,
),
body: Center(
child: Text(
'Submitted',
style: TextStyle(fontSize: 24, fontWeight: FontWeight.bold),
),
),
);
}
}

You might also like