Skip to content

Instantly share code, notes, and snippets.

@Billion101
Billion101 / main.dart
Last active October 2, 2025 08:32
counter app
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
class CounterScreen extends StatefulWidget {
const CounterScreen({super.key});
@override
State<CounterScreen> createState() => _CounterScreenState();
}
class _CounterScreenState extends State<CounterScreen> {
int _counter = 0; // Our state variable
@Billion101
Billion101 / main.dart
Last active October 2, 2025 08:33
column widget
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
mainAxisAlignment: MainAxisAlignment.center, // Aligns children vertically
crossAxisAlignment: CrossAxisAlignment.start, // Aligns children horizontally
@Billion101
Billion101 / main.dart
Last active October 2, 2025 08:34
row widget
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: Row(
@Billion101
Billion101 / main.dart
Last active October 2, 2025 08:35
padding widget
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Padding Example')),
body: Padding(
padding: const EdgeInsets.all(16.0),
@Billion101
Billion101 / main.dart
Last active October 2, 2025 08:10
container widget
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: Text('Container Example')),
body: Container(
padding: const EdgeInsets.all(16.0),
@Billion101
Billion101 / main.dart
Last active October 2, 2025 08:11
app bar
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@Billion101
Billion101 / main.dart
Last active October 2, 2025 08:12
create body
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@Billion101
Billion101 / main.dart
Created October 2, 2025 07:32
drawer
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
import 'package:flutter/material.dart';
void main() {
runApp(MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
@Billion101
Billion101 / main.dart
Created October 2, 2025 07:36
list view
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
body: ListView(
padding: EdgeInsets.all(8),
children: [
ListTile(
leading: Icon(Icons.map),
title: Text('Map'),
), // ListTile
ListTile(
leading: Icon(Icons.photo_album),
@Billion101
Billion101 / main.dart
Last active October 2, 2025 08:13
listview.builder
/// Copyright 2025. ⓒ github.com/Touy2004 All rights reserved.
body: ListView.builder(
// Tells the ListView the total number of items in our list.
itemCount: 10,
// The builder function is called for each item. 'index' is the current
itemBuilder: (context, index) {
// Return the widget for the item at the given index.
return ListTile(title: Text('Item at index: $index'));
},