Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nabind47/flutter_training
https://github.com/nabind47/flutter_training
Last synced: about 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/nabind47/flutter_training
- Owner: nabind47
- Created: 2023-12-28T03:09:06.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-01-16T03:45:00.000Z (12 months ago)
- Last Synced: 2024-01-16T10:46:41.430Z (12 months ago)
- Language: Dart
- Size: 303 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Flutter Classes
```dart
import 'package:flutter/cupertino.dart';void main() {
runApp(app);
}
```## Types of widgets
> Stateless ---> stless
> Stateful ---> stful```dart
import 'package:flutter/material.dart';
import 'package:flutter_class/contact_page.dart';void main() {
runApp(const MyApp());
}class MyApp extends StatelessWidget {
const MyApp({super.key});@override
Widget build(BuildContext context) {
return MaterialApp(
title: "Flutter Class",
debugShowCheckedModeBanner: false,
theme: ThemeData(
colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple)),
home: ContactPage(),
);
}
}
``````dart
import 'package:flutter/material.dart';class ContactPage extends StatefulWidget {
const ContactPage({super.key});@override
State createState() => _ContactPageState();
}class _ContactPageState extends State {
@override
Widget build(BuildContext context) {
return const Scaffold();
}
}
``````dart
import 'package:flutter/material.dart';class ContactPage extends StatefulWidget {
const ContactPage({Key? key}) : super(key: key);@override
State createState() => _ContactPageState();
}consclass _ContactPageState extends State {
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text("Contact Page 👋")),
body: SingleChildScrollView(
child: Column(
children: [
for (var student in students) studentsList(student),
],
),
),
);
}Widget studentsList(String name) {
return Padding(
padding: const EdgeInsets.all(12.0),
child: Card(child: Padding(
padding: const EdgeInsets.all(8.0),
child: Row(
children: [
Text(name, style: TextStyle(fontSize: 16)),
],
),
)),
);
}
}
```> Format -> `ctrl + alt + l`
## Resuable Widgets
```dart```
## Future
## Stream
```shell
ctrl + shift + -/+
``````dart
void initState(){
print("Inside the init method"
"");
super.initState();
}
```
> Hot Restart -> main.dart
> Hot Reload -> file -> build method> [flutter url launcher](https://pub.dev/packages/url_launcher)
```dart
InkWell(
onTap: ()async{
SharedPreferences sp = await SharedPreferences.getInstance();
sp.setString("name", "Nabin Dhami");
print(sp.getString("name"));
sp.remove("name");
print(sp.getString("name"));
},
)
``````dart
appBar: AppBar(title: Text("Authentication"), centerTitle: true, automaticallyImplyLeading: false,),
```