Skip to content

Instantly share code, notes, and snippets.

View jorgecoca's full-sized avatar
📘
Dart & Flutter

Jorge Coca jorgecoca

📘
Dart & Flutter
View GitHub Profile
@jorgecoca
jorgecoca / main.dart
Created September 27, 2025 20:07
Gravity Simulation
import 'package:flutter/material.dart';
import 'package:flutter/physics.dart';
void main() => runApp(MaterialApp(home: GravityDemo()));
class GravityDemo extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: Scaffold(body: GravitySimulationDemo()));
}
@jorgecoca
jorgecoca / main.dart
Created September 26, 2025 19:26
Custom page transitions
import 'package:flutter/material.dart';
void main() {
runApp(const MaterialApp(home: FirstPage()));
}
class FirstPage extends StatelessWidget {
const FirstPage({super.key});
@override
@jorgecoca
jorgecoca / custom_hero.dart
Created September 25, 2025 17:10
Customization of Hero transitions
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:flutter/scheduler.dart' show timeDilation;
void main() => runApp(const MaterialApp(home: RadialExpansionDemo()));
class Photo extends StatelessWidget {
const Photo({super.key, required this.color, this.onTap});
@jorgecoca
jorgecoca / animated_list.dart
Created September 25, 2025 01:30
Example of animated list
import 'package:flutter/material.dart';
void main() => runApp(DemoApp());
class DemoApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: AnimatedListDemo(),
debugShowCheckedModeBanner: false,
@jorgecoca
jorgecoca / main.dart
Last active February 4, 2025 20:17
Flutter Performance Issue
// The expectations are:
// 1. When pressing "Shuffle Data", the list shuffles but each
// item preservers their color
// 2. When pressing the refresh icon on each item, the color of
// that item must change, but the others remain the same
import 'package:flutter/material.dart';
import 'dart:math';
void main() {
import 'package:flutter/material.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(home: Home());
}
}
@jorgecoca
jorgecoca / main.dart
Created February 4, 2025 15:57
Engineer I-III Coding Exercise
// Questions:
//
// 1. In the `BooksListPage`, replace the body of the `Scaffold` with a
// `ListView` that displays each one of the books injected in the constructor
//
// 2. In the new `ListView` created, add the ability on each item to navigate
// to `BookDetailsPage` when the item is pressed.
//
// 3. Modify `BookDetailsPage` to receive a single `Book` as an argument, and
// replace the different widgets with the injected `Book` properties.